Commit 8d458574 authored by jiaorz's avatar jiaorz

Merge branch 'master-background-manager' into dev

parents 86beb7c1 6355212d
...@@ -493,6 +493,15 @@ ...@@ -493,6 +493,15 @@
<if test="status != null and status != 0 and status != -1 and status != -2 and status != 3 and status != 5 and status != 7"> <if test="status != null and status != 0 and status != -1 and status != -2 and status != 3 and status != 5 and status != 7">
and v1.status = #{status} and v1.status = #{status}
</if> </if>
<if test="status != null and status == 3 ">
and v4.id is null and v1.status = 2
</if>
<if test="status != null and status == 5 ">
and v4.id is not null and v1.status = 2 and v4.state = 0
</if>
<if test="status != null and status == 7 ">
and v4.id is not null and v1.status = 2 and v4.state = 1
</if>
<if test="status != null and status == 0 "> <if test="status != null and status == 0 ">
and v4.state = 0 and v4.state = 0
</if> </if>
......
...@@ -44,8 +44,6 @@ ...@@ -44,8 +44,6 @@
v.`status`, v.`status`,
v.number_plate, v.number_plate,
v.brand, v.brand,
-- IFNULL(v.park_branch_company_id,v.expect_destination_branch_company_id) AS subordinate_branch,
-- IFNULL(bc.name,bc1.name) AS subBranchName,
v.park_branch_company_id, v.park_branch_company_id,
bc.name as parkBranchCompanyName, bc.name as parkBranchCompanyName,
v.expect_destination_branch_company_id, v.expect_destination_branch_company_id,
...@@ -80,15 +78,13 @@ ...@@ -80,15 +78,13 @@
left join left join
vehicle_book_info vbi on v.`id` = vbi.vehicle vehicle_book_info vbi on v.`id` = vbi.vehicle
</if> </if>
-- LEFT JOIN branch_company bc ON v.park_branch_company_id = bc.id
-- LEFT JOIN branch_company bc1 ON v.expect_destination_branch_company_id = bc1.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
-- 目的地分公司 -- 目的地分公司
LEFT JOIN branch_company bc1 ON v.expect_destination_branch_company_id = bc1.id LEFT JOIN branch_company bc1 ON v.expect_destination_branch_company_id = bc1.id
-- 所属分公司 -- 所属分公司
LEFT JOIN branch_company bc2 ON v.subordinate_branch = bc2.id LEFT JOIN branch_company bc2 ON v.subordinate_branch = bc2.id
LEFT JOIN vehicle_book_record v2 on v2.vehicle_id = v.id LEFT JOIN vehicle_book_record v2 on v2.id = (select id from vehicle_book_record where vehicle_id = v.id order by update_time DESC LIMIT 1)
LEFT JOIN vehicle_departure_log v3 on v2.id = v3.book_record_id LEFT JOIN vehicle_departure_log v3 on v2.id = v3.book_record_id
where where
v.is_del=0 v.is_del=0
...@@ -116,15 +112,15 @@ ...@@ -116,15 +112,15 @@
<if test="insuranceCompany !=null"> <if test="insuranceCompany !=null">
and v.insurance_company = #{insuranceCompany} and v.insurance_company = #{insuranceCompany}
</if> </if>
<if test="belongToName !=null"> <if test="belongToName !=null and belongToName != ''">
and v.belong_to_name = #{belongToName} and v.belong_to_name = like concat('%',#{belongToName},'%')
</if> </if>
<if test="vin !=null and vin != ''"> <if test="vin !=null and vin != ''">
and v.vin = #{vin} and v.vin = #{vin}
</if> </if>
<!-- <if test="subordinateBranch !=null">--> <!-- <if test="subordinateBranch !=null">-->
<!-- and v.subordinate_branch = #{subordinateBranch}--> <!-- and v.subordinate_branch = #{subordinateBranch}-->
<!-- </if>--> <!-- </if>-->
<if test="code !=null"> <if test="code !=null">
and v.code = #{code} and v.code = #{code}
</if> </if>
...@@ -164,17 +160,16 @@ ...@@ -164,17 +160,16 @@
and ( v.park_branch_company_id = #{subordinateBranch}) and ( v.park_branch_company_id = #{subordinateBranch})
</if> </if>
<if test=" addrProvince !=null or addrCity !=null or zoneId !=null "> <if test=" addrProvince !=null or addrCity !=null or zoneId !=null ">
<if test="addrProvince !=null"> <if test="addrProvince !=null">
and bc.addr_province=#{addrProvince} and bc.addr_province=#{addrProvince}
</if> </if>
<if test="addrCity !=null"> <if test="addrCity !=null">
and bc.addr_city=#{addrCity} and bc.addr_city=#{addrCity}
</if> </if>
<if test="zoneId !=null"> <if test="zoneId !=null">
and bc.zone_id=#{zoneId} and bc.zone_id=#{zoneId}
</if> </if>
</if> </if>
order by v.code
) r ORDER BY r.parkBranchCompanyName ) r ORDER BY r.parkBranchCompanyName
</select> </select>
...@@ -228,29 +223,31 @@ ...@@ -228,29 +223,31 @@
LEFT JOIN branch_company bc1 ON v.expect_destination_branch_company_id = bc1.id LEFT JOIN branch_company bc1 ON v.expect_destination_branch_company_id = bc1.id
-- 所属分公司 -- 所属分公司
LEFT JOIN branch_company bc2 ON v.subordinate_branch = bc2.id LEFT JOIN branch_company bc2 ON v.subordinate_branch = bc2.id
LEFT JOIN vehicle_book_record v2 on v2.id = (select id from vehicle_book_record where vehicle_id = v.id order by update_time DESC LIMIT 1)
LEFT JOIN vehicle_departure_log v3 on v2.id = v3.book_record_id
where where
v.is_del=0 v.is_del=0
<if test="companyList != null"> <if test="companyList != null">
and ( v.park_branch_company_id in ( and ( v.park_branch_company_id in (
<trim suffixOverrides=","> <trim suffixOverrides=",">
<foreach collection="companyList" item="companyId"> <foreach collection="companyList" item="companyId">
#{companyId}, #{companyId},
</foreach> </foreach>
</trim> </trim>
) )
<!--or v.expect_destination_branch_company_id in ( <!--or v.expect_destination_branch_company_id in (
<trim suffixOverrides=","> <trim suffixOverrides=",">
<foreach collection="companyList" item="companyId"> <foreach collection="companyList" item="companyId">
#{companyId}, #{companyId},
</foreach> </foreach>
</trim> </trim>
)--> )-->
<!-- or v.subordinate_branch in (--> <!-- or v.subordinate_branch in (-->
<!-- <trim suffixOverrides=",">--> <!-- <trim suffixOverrides=",">-->
<!-- <foreach collection="companyList" item="companyId">--> <!-- <foreach collection="companyList" item="companyId">-->
<!-- #{companyId},--> <!-- #{companyId},-->
<!-- </foreach>--> <!-- </foreach>-->
<!-- </trim>--> <!-- </trim>-->
) )
</if> </if>
<if test="mRangeDateEnd !=null"> <if test="mRangeDateEnd !=null">
...@@ -277,21 +274,27 @@ ...@@ -277,21 +274,27 @@
<if test="insuranceCompany !=null"> <if test="insuranceCompany !=null">
and v.insurance_company = #{insuranceCompany} and v.insurance_company = #{insuranceCompany}
</if> </if>
<if test="belongToName !=null"> <if test="belongToName !=null and belongToName != ''">
and v.belong_to_name = #{belongToName} and v.belong_to_name = like concat('%',#{belongToName},'%')
</if> </if>
<if test="vin !=null and vin != ''"> <if test="vin !=null and vin != ''">
and v.vin = #{vin} and v.vin = #{vin}
</if> </if>
<!-- <if test="subordinateBranch !=null">--> <!-- <if test="subordinateBranch !=null">-->
<!-- and v.subordinate_branch = #{subordinateBranch}--> <!-- and v.subordinate_branch = #{subordinateBranch}-->
<!-- </if>--> <!-- </if>-->
<if test="code !=null"> <if test="code !=null">
and v.code = #{code} and v.code = #{code}
</if> </if>
<if test="status !=null"> <if test="status !=null and status != 6 and status != 7">
and v.status = #{status} and v.status = #{status}
</if> </if>
<if test="status !=null and status == 6">
and v3.id is not NULL and v2.book_type = 3 and v3.state = 0
</if>
<if test="status !=null and status == 7">
and v3.id is not NULL and v2.book_type = 6 and v3.state = 0
</if>
<if test="numberPlate !=null and numberPlate != ''"> <if test="numberPlate !=null and numberPlate != ''">
and v.number_plate like concat('%',#{numberPlate},'%') and v.number_plate like concat('%',#{numberPlate},'%')
</if> </if>
...@@ -329,7 +332,6 @@ ...@@ -329,7 +332,6 @@
and bc.zone_id=#{zoneId} and bc.zone_id=#{zoneId}
</if> </if>
</if> </if>
order by v.code
) r ORDER BY r.parkBranchCompanyName ) r ORDER BY r.parkBranchCompanyName
</select> </select>
......
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