Commit 27e82649 authored by 周健威's avatar 周健威

Merge branch 'master-bug-rent' into dev

# Conflicts:
#	xx-vehicle/xx-vehicle-server/src/main/resources/mapper/VehicleMapper.xml
parents ad1c33e0 2962da62
...@@ -1028,6 +1028,11 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR ...@@ -1028,6 +1028,11 @@ public class VehicleBiz extends BaseBiz<VehicleMapper, Vehicle> implements UserR
} }
if(MapUtils.isNotEmpty(yearMonthAndParam)){ if(MapUtils.isNotEmpty(yearMonthAndParam)){
params.put("yearMonthAndParam",yearMonthAndParam); params.put("yearMonthAndParam",yearMonthAndParam);
String bitStr = "";
for(String key : yearMonthAndParam.keySet()) {
bitStr+= "1";
}
params.put("yearMonthAndParamBitStr", bitStr);
} }
} }
......
...@@ -523,16 +523,14 @@ ...@@ -523,16 +523,14 @@
<!-- yearNo4Where 标识时间参数不用于where条件,用于select部分 --> <!-- yearNo4Where 标识时间参数不用于where条件,用于select部分 -->
<if test=" yearMonthAndParam !=null and yearNo4Where != null and yearNo4Where == true"> <if test=" yearMonthAndParam !=null and yearNo4Where != null and yearNo4Where == true">
,(max( ,(max(
<foreach collection="yearMonthAndParam" index="yearMonth" item="andOperation" separator="and"> vbi.bit_str = #{yearMonthAndParamBitStr}
<include refid="yearMonthAndParamSql"></include>
</foreach>
<!-- 租车列表 不过滤前后预约记录不符的车辆 但是合并标示车型是否有车 即 hasVehicle--> <!-- 租车列表 不过滤前后预约记录不符的车辆 但是合并标示车型是否有车 即 hasVehicle-->
<if test="withoutRecordWhere != null and withoutRecordWhere = 1 and startCompanyId != null and endCompanyId != null "> <if test="withoutRecordWhere != null and withoutRecordWhere = 1 and startCompanyId != null and endCompanyId != null ">
and (abr.to_lift_company is null or abr.to_lift_company = #{startCompanyId}) and (abr.to_lift_company is null or abr.to_lift_company = #{startCompanyId})
and (abr.to_return_company is null or abr.to_return_company = #{endCompanyId}) and (abr.to_return_company is null or abr.to_return_company = #{endCompanyId})
</if> </if>
) )
)as hasVehicle ) as hasVehicle
</if> </if>
<if test="lon != null and lat != null"> <if test="lon != null and lat != null">
,st_distance_sphere(point(#{lon}, #{lat}), point(bc.longitude, bc.latitude)) as distance ,st_distance_sphere(point(#{lon}, #{lat}), point(bc.longitude, bc.latitude)) as distance
...@@ -618,8 +616,18 @@ ...@@ -618,8 +616,18 @@
<sql id="searchUsableSql"> <sql id="searchUsableSql">
from vehicle v from vehicle v
<if test=" yearMonthAndParam !=null "> <if test=" yearMonthAndParam !=null ">
left join left join (
vehicle_book_info vbi on v.`id` = vbi.vehicle select
vbi.vehicle,
BIT_OR(
CONCAT(
<foreach collection="yearMonthAndParam" index="yearMonth" item="andOperation" separator=",">
<include refid="yearMonthAndParamSql"></include>
</foreach>
)
) as bit_str
from vehicle_book_info vbi group by vbi.vehicle
) vbi on v.`id` = vbi.vehicle
</if> </if>
left join vehicle_model vm on v.model_id = vm.id left join vehicle_model vm on v.model_id = vm.id
left join branch_company bc on v.park_branch_company_id = bc.id left join branch_company bc on v.park_branch_company_id = bc.id
...@@ -634,11 +642,8 @@ ...@@ -634,11 +642,8 @@
<where> <where>
<!-- 若需根据预定日期条件查询,针对换为位操作 --> <!-- 若需根据预定日期条件查询,针对换为位操作 -->
<!-- yearNo4Where 标识时间参数是否用于where条件 --> <!-- yearNo4Where 标识时间参数是否用于where条件 -->
<if test=" yearMonthAndParam !=null and yearNo4Where == null"> <if test=" yearMonthAndParam !=null and yearMonthAndParam != null and yearNo4Where == null">
<foreach collection="yearMonthAndParam" index="yearMonth" item="andOperation"> vbi.bit_str = #{yearMonthAndParamBitStr}
and
<include refid="yearMonthAndParamSql"></include>
</foreach>
</if> </if>
<!-- 根据前后record 过滤车辆 --> <!-- 根据前后record 过滤车辆 -->
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment