|
@@ -46,6 +46,12 @@
|
|
|
t1.arrival_time
|
|
t1.arrival_time
|
|
|
END) as arrivalTime,
|
|
END) as arrivalTime,
|
|
|
t1.address_detail as addressDetail,
|
|
t1.address_detail as addressDetail,
|
|
|
|
|
+ t1.unloading_place as unloadingPlace,
|
|
|
|
|
+ t1.contract_no as contractNo,
|
|
|
|
|
+ t1.dispatch_number as dispatchNumber,
|
|
|
|
|
+ t1.fleet_volum as fleetVolum,
|
|
|
|
|
+ t1.freight_collect as freightCollect,
|
|
|
|
|
+ t1.freight_pay as freightPay,
|
|
|
t1.receipt_no as receiptNo,
|
|
t1.receipt_no as receiptNo,
|
|
|
t1.bill_no as billNo,
|
|
t1.bill_no as billNo,
|
|
|
t1.station,
|
|
t1.station,
|
|
@@ -57,7 +63,6 @@
|
|
|
ELSE
|
|
ELSE
|
|
|
t1.fleet_id
|
|
t1.fleet_id
|
|
|
END) as fleetId,
|
|
END) as fleetId,
|
|
|
-
|
|
|
|
|
(CASE WHEN
|
|
(CASE WHEN
|
|
|
t1.shipping_mode != '散货'
|
|
t1.shipping_mode != '散货'
|
|
|
THEN
|
|
THEN
|
|
@@ -65,15 +70,9 @@
|
|
|
ELSE
|
|
ELSE
|
|
|
t8.cname
|
|
t8.cname
|
|
|
END) as fleetName,
|
|
END) as fleetName,
|
|
|
-
|
|
|
|
|
- (CASE WHEN
|
|
|
|
|
- t1.shipping_mode != '散货'
|
|
|
|
|
- THEN
|
|
|
|
|
- t4.short_name
|
|
|
|
|
- ELSE
|
|
|
|
|
- t8.short_name
|
|
|
|
|
- END) as fleetShortName,
|
|
|
|
|
-
|
|
|
|
|
|
|
+ (CASE t1.shipping_mode
|
|
|
|
|
+ WHEN '散货' THEN t8.short_name
|
|
|
|
|
+ ELSE t4.short_name END) as fleetShortName,
|
|
|
(CASE WHEN
|
|
(CASE WHEN
|
|
|
t1.shipping_mode != '散货'
|
|
t1.shipping_mode != '散货'
|
|
|
THEN
|
|
THEN
|
|
@@ -91,7 +90,6 @@
|
|
|
ELSE
|
|
ELSE
|
|
|
t1.status
|
|
t1.status
|
|
|
END) as status,
|
|
END) as status,
|
|
|
-
|
|
|
|
|
(CASE WHEN
|
|
(CASE WHEN
|
|
|
t1.shipping_mode != '散货'
|
|
t1.shipping_mode != '散货'
|
|
|
THEN
|
|
THEN
|
|
@@ -103,7 +101,7 @@
|
|
|
left join land_order_item t2 on t1.id = t2.order_id
|
|
left join land_order_item t2 on t1.id = t2.order_id
|
|
|
left join basic_corps_desc t3 on t1.corp_id = t3.id
|
|
left join basic_corps_desc t3 on t1.corp_id = t3.id
|
|
|
left join basic_corps_desc t4 on t2.fleet_id = t4.id
|
|
left join basic_corps_desc t4 on t2.fleet_id = t4.id
|
|
|
- left join basic_corps_desc t8 on t1.fleet_id = t4.id
|
|
|
|
|
|
|
+ left join basic_corps_desc t8 on t8.id = t1.fleet_id
|
|
|
left join blade_user t5 on t1.salesman = t5.id
|
|
left join blade_user t5 on t1.salesman = t5.id
|
|
|
left join blade_dept t6 on t1.dispatch_dept = t6.id
|
|
left join blade_dept t6 on t1.dispatch_dept = t6.id
|
|
|
left join blade_user t7 on t1.dispatcher = t7.id
|
|
left join blade_user t7 on t1.dispatcher = t7.id
|
|
@@ -114,7 +112,6 @@
|
|
|
<if test="acct.corpName != null and acct.corpName != ''">and t3.cname like concat('%', #{acct.corpName}, '%')</if>
|
|
<if test="acct.corpName != null and acct.corpName != ''">and t3.cname like concat('%', #{acct.corpName}, '%')</if>
|
|
|
<if test="acct.salesmanName != null and acct.salesmanName != ''">and t5.name like concat('%', #{acct.salesmanName}, '%')</if>
|
|
<if test="acct.salesmanName != null and acct.salesmanName != ''">and t5.name like concat('%', #{acct.salesmanName}, '%')</if>
|
|
|
<if test="acct.corpShortName != null and acct.corpShortName != ''">and t3.short_name like concat('%', #{acct.corpShortName}, '%')</if>
|
|
<if test="acct.corpShortName != null and acct.corpShortName != ''">and t3.short_name like concat('%', #{acct.corpShortName}, '%')</if>
|
|
|
-
|
|
|
|
|
<if test="acct.fleetId != null and acct.shippingMode != '散货'">and t2.fleet_id = #{acct.fleetId}</if>
|
|
<if test="acct.fleetId != null and acct.shippingMode != '散货'">and t2.fleet_id = #{acct.fleetId}</if>
|
|
|
<if test="acct.fleetId != null and acct.shippingMode == '散货'">and t1.fleet_id = #{acct.fleetId}</if>
|
|
<if test="acct.fleetId != null and acct.shippingMode == '散货'">and t1.fleet_id = #{acct.fleetId}</if>
|
|
|
<if test="acct.fleetShortName != null and acct.fleetShortName != ''">and t4.short_name like concat('%', #{acct.fleetShortName}, '%')</if>
|
|
<if test="acct.fleetShortName != null and acct.fleetShortName != ''">and t4.short_name like concat('%', #{acct.fleetShortName}, '%')</if>
|
|
@@ -124,13 +121,10 @@
|
|
|
<if test="acct.plateNo != null and acct.plateNo != '' and acct.shippingMode != '散货'">and t2.plate_no like concat('%', #{acct.plateNo}, '%')</if>
|
|
<if test="acct.plateNo != null and acct.plateNo != '' and acct.shippingMode != '散货'">and t2.plate_no like concat('%', #{acct.plateNo}, '%')</if>
|
|
|
<if test="acct.plateNo != null and acct.plateNo != '' and acct.shippingMode == '散货'">and t1.plate_no like concat('%', #{acct.plateNo}, '%')</if>
|
|
<if test="acct.plateNo != null and acct.plateNo != '' and acct.shippingMode == '散货'">and t1.plate_no like concat('%', #{acct.plateNo}, '%')</if>
|
|
|
<if test="acct.ctnDetail != null and acct.ctnDetail != '' and acct.shippingMode != '散货'">and t2.ctn_type like concat('%', #{acct.ctnDetail}, '%')</if>
|
|
<if test="acct.ctnDetail != null and acct.ctnDetail != '' and acct.shippingMode != '散货'">and t2.ctn_type like concat('%', #{acct.ctnDetail}, '%')</if>
|
|
|
-
|
|
|
|
|
<if test="acct.beginArrivalTime != null and acct.beginArrivalTime != '' and acct.shippingMode != '散货'">and t2.arrival_time >= #{acct.beginArrivalTime}</if>
|
|
<if test="acct.beginArrivalTime != null and acct.beginArrivalTime != '' and acct.shippingMode != '散货'">and t2.arrival_time >= #{acct.beginArrivalTime}</if>
|
|
|
<if test="acct.endArrivalTime != null and acct.endArrivalTime != '' and acct.shippingMode != '散货'">and t2.arrival_time <= #{acct.endArrivalTime}</if>
|
|
<if test="acct.endArrivalTime != null and acct.endArrivalTime != '' and acct.shippingMode != '散货'">and t2.arrival_time <= #{acct.endArrivalTime}</if>
|
|
|
-
|
|
|
|
|
- <if test="acct.beginArrivalTime != null and acct.beginArrivalTime != '' and acct.shippingMode = '散货'">and t1.arrival_time >= #{acct.beginArrivalTime}</if>
|
|
|
|
|
- <if test="acct.endArrivalTime != null and acct.endArrivalTime != '' and acct.shippingMode = '散货'">and t1.arrival_time <= #{acct.endArrivalTime}</if>
|
|
|
|
|
-
|
|
|
|
|
|
|
+ <if test="acct.beginArrivalTime != null and acct.beginArrivalTime != '' and acct.shippingMode == '散货'">and t1.arrival_time >= #{acct.beginArrivalTime}</if>
|
|
|
|
|
+ <if test="acct.endArrivalTime != null and acct.endArrivalTime != '' and acct.shippingMode == '散货'">and t1.arrival_time <= #{acct.endArrivalTime}</if>
|
|
|
<if test="acct.salesman != null">and t1.salesman = #{acct.salesman}</if>
|
|
<if test="acct.salesman != null">and t1.salesman = #{acct.salesman}</if>
|
|
|
<if test="acct.dispatcher != null">and t1.dispatcher = #{acct.dispatcher}</if>
|
|
<if test="acct.dispatcher != null">and t1.dispatcher = #{acct.dispatcher}</if>
|
|
|
<if test="acct.dispatchDept != null">and t1.dispatchDept = #{acct.dispatchDept}</if>
|
|
<if test="acct.dispatchDept != null">and t1.dispatchDept = #{acct.dispatchDept}</if>
|
|
@@ -145,77 +139,19 @@
|
|
|
<if test="acct.status == 2 and acct.shippingMode != '散货'">and t2.status not in (0, 1, 4)</if>
|
|
<if test="acct.status == 2 and acct.shippingMode != '散货'">and t2.status not in (0, 1, 4)</if>
|
|
|
<if test="acct.status == 3 and acct.shippingMode != '散货'">and t2.status = 4</if>
|
|
<if test="acct.status == 3 and acct.shippingMode != '散货'">and t2.status = 4</if>
|
|
|
|
|
|
|
|
- <if test="acct.status == 1 and acct.shippingMode == '散货'">and t1.status in (0, 1)</if>
|
|
|
|
|
- <if test="acct.status == 2 and acct.shippingMode == '散货'">and t1.status not in (0, 1, 5)</if>
|
|
|
|
|
- <if test="acct.status == 3 and acct.shippingMode == '散货'">and t1.status = 5</if>
|
|
|
|
|
- </where>
|
|
|
|
|
- group by t1.id, t2.id, t2.plate_no, t2.arrival_time
|
|
|
|
|
- order by t2.arrival_time desc
|
|
|
|
|
- </select>
|
|
|
|
|
|
|
+ <if test="acct.status == 1 and acct.shippingMode == '散货' and acct.userRoleControl != '车队' and acct.userRoleControl != '司机'">and t1.status in (0, 1)</if>
|
|
|
|
|
+ <if test="acct.status == 2 and acct.shippingMode == '散货' and acct.userRoleControl != '车队' and acct.userRoleControl != '司机'">and t1.status not in (0, 1, 5)</if>
|
|
|
|
|
|
|
|
|
|
+ <if test="acct.status == 1 and acct.shippingMode == '散货' and acct.userRoleControl == '车队'">and t1.status = 2</if>
|
|
|
|
|
+ <if test="acct.status == 2 and acct.shippingMode == '散货' and acct.userRoleControl == '车队'">and t1.status in (3, 4)</if>
|
|
|
|
|
|
|
|
- <select id="selectBulkLoadList" resultType="org.springblade.land.vo.OrderAcctVO">
|
|
|
|
|
- select t1.id as orderId,
|
|
|
|
|
- t1.corp_id as corpId,
|
|
|
|
|
- t3.cname as corpName,
|
|
|
|
|
- t3.short_name as corpShortName,
|
|
|
|
|
- t1.salesman,
|
|
|
|
|
- t5.name as salesmanName,
|
|
|
|
|
- t1.salesman_dept as salesmanDept,
|
|
|
|
|
- t1.create_user as createUser,
|
|
|
|
|
- t1.dispatcher,
|
|
|
|
|
- t7.name as dispatcherName,
|
|
|
|
|
- t1.dispatch_dept as dispatchDept,
|
|
|
|
|
- t6.dept_name as dispatchDeptName,
|
|
|
|
|
- t1.arrival_time as arrivalTime,
|
|
|
|
|
- t1.address_detail as addressDetail,
|
|
|
|
|
- t1.receipt_no as receiptNo,
|
|
|
|
|
- t1.bill_no as billNo,
|
|
|
|
|
- t1.station,
|
|
|
|
|
- t1.fleet_id as fleetId,
|
|
|
|
|
- t4.cname as fleetName,
|
|
|
|
|
- t4.short_name as fleetShortName,
|
|
|
|
|
- t1.plate_no,
|
|
|
|
|
- t1.status,
|
|
|
|
|
- t1.remarks
|
|
|
|
|
- from land_order t1
|
|
|
|
|
- left join basic_corps_desc t3 on t1.corp_id = t3.id
|
|
|
|
|
- left join basic_corps_desc t4 on t1.fleet_id = t4.id
|
|
|
|
|
- left join blade_user t5 on t1.salesman = t5.id
|
|
|
|
|
- left join blade_dept t6 on t1.dispatch_dept = t6.id
|
|
|
|
|
- left join blade_user t7 on t1.dispatcher = t7.id
|
|
|
|
|
- <where>
|
|
|
|
|
- t1.tenant_id = #{acct.tenantId}
|
|
|
|
|
- and t1.is_deleted = 0
|
|
|
|
|
- <if test="acct.corpName != null and acct.corpName != ''">and t3.cname like concat('%', #{acct.corpName}, '%')</if>
|
|
|
|
|
- <if test="acct.salesmanName != null and acct.salesmanName != ''">and t5.name like concat('%', #{acct.salesmanName}, '%')</if>
|
|
|
|
|
- <if test="acct.corpShortName != null and acct.corpShortName != ''">and t3.short_name like concat('%', #{acct.corpShortName}, '%')</if>
|
|
|
|
|
|
|
+ <if test="acct.status == 1 and acct.shippingMode == '散货' and acct.userRoleControl == '司机'">and t1.status = 3</if>
|
|
|
|
|
+ <if test="acct.status == 2 and acct.shippingMode == '散货' and acct.userRoleControl == '司机'">and t1.status = 4</if>
|
|
|
|
|
|
|
|
- <if test="acct.fleetId != null">and t1.fleet_id = #{acct.fleetId}</if>
|
|
|
|
|
- <if test="acct.fleetShortName != null and acct.fleetShortName != ''">and t4.short_name like concat('%', #{acct.fleetShortName}, '%')</if>
|
|
|
|
|
- <if test="acct.addressDetail != null and acct.addressDetail != ''">and t1.address_detail like concat('%', #{acct.addressDetail}, '%')</if>
|
|
|
|
|
- <if test="acct.receiptNo != null and acct.receiptNo != ''">and t1.receipt_no like concat('%', #{acct.receiptNo}, '%')</if>
|
|
|
|
|
- <if test="acct.billNo != null and acct.billNo != ''">and t1.bill_no like concat('%', #{acct.billNo}, '%')</if>
|
|
|
|
|
- <if test="acct.plateNo != null and acct.plateNo != ''">and t1.plate_no like concat('%', #{acct.plateNo}, '%')</if>
|
|
|
|
|
-
|
|
|
|
|
- <if test="acct.beginArrivalTime != null and acct.beginArrivalTime != ''">and t1.arrival_time >= #{acct.beginArrivalTime}</if>
|
|
|
|
|
- <if test="acct.endArrivalTime != null and acct.endArrivalTime != ''">and t1.arrival_time <= #{acct.endArrivalTime}</if>
|
|
|
|
|
-
|
|
|
|
|
- <if test="acct.salesman != null">and t1.salesman = #{acct.salesman}</if>
|
|
|
|
|
- <if test="acct.dispatcher != null">and t1.dispatcher = #{acct.dispatcher}</if>
|
|
|
|
|
- <if test="acct.dispatchDept != null">and t1.dispatchDept = #{acct.dispatchDept}</if>
|
|
|
|
|
- <if test="acct.salesmanDeptList != null">and t1.salesman_dept in
|
|
|
|
|
- <foreach item="dept" collection="acct.salesmanDeptList" open="(" separator="," close=")">
|
|
|
|
|
- #{dept}
|
|
|
|
|
- </foreach>
|
|
|
|
|
- </if>
|
|
|
|
|
- <if test="acct.shippingMode != null and acct.shippingMode != ''">and t1.shipping_mode = #{acct.shippingMode}</if>
|
|
|
|
|
- <if test="acct.status == 1">and t1.status in (0, 1)</if>
|
|
|
|
|
- <if test="acct.status == 2">and t1.status not in (0, 1, 5)</if>
|
|
|
|
|
- <if test="acct.status == 3">and t1.status = 5</if>
|
|
|
|
|
|
|
+ <if test="acct.status == 3 and acct.shippingMode == '散货'">and t1.status = 5</if>
|
|
|
</where>
|
|
</where>
|
|
|
- group by t1.id, t1.plate_no, t1.arrival_time
|
|
|
|
|
- order by t1.arrival_time desc
|
|
|
|
|
|
|
+ group by t1.id, t2.id, t2.plate_no, t2.arrival_time
|
|
|
|
|
+ order by t2.arrival_time desc
|
|
|
</select>
|
|
</select>
|
|
|
|
|
|
|
|
</mapper>
|
|
</mapper>
|