|
@@ -381,4 +381,71 @@
|
|
|
</when>
|
|
</when>
|
|
|
</choose>
|
|
</choose>
|
|
|
</select>
|
|
</select>
|
|
|
|
|
+ <select id="findWaybillOrderCount" resultType="com.sckw.transport.model.vo.WaybillCountVo">
|
|
|
|
|
+ SELECT
|
|
|
|
|
+ count(case when c.status = 8 then 1 end) totalComplete,
|
|
|
|
|
+ count(case when c.status not in (1, 9, 10, 11) then 1 end) totalTake,
|
|
|
|
|
+ count(case when c.status in (3, 4, 5, 6) then 1 end) totalExecute,
|
|
|
|
|
+ count(DISTINCT case when lo.status in (0, 1, 2, 3) then lo.id end) totalUnfinished,
|
|
|
|
|
+ IFNULL(SUM(c.entrust_amount), 0.0) entrustAmount, IFNULL(SUM(c.load_amount), 0.0) loadAmount,
|
|
|
|
|
+ IFNULL(SUM(c.unload_amount), 0.0) unloadAmount, IFNULL(SUM(c.deficit_amount), 0.0) deficitAmount,
|
|
|
|
|
+ MIN(wot1.operate_time) loadTime, MAX(wot2.operate_time) unloadTime
|
|
|
|
|
+ from kwt_waybill_order wo
|
|
|
|
|
+ left join kwt_waybill_order_subtask c on wo.id = c.w_order_id
|
|
|
|
|
+ left join kwt_waybill_order_ticket wot1 on wot1.w_order_id = wo.id and wot1.type = 1 and c.unit = wot1.unit and wot1.type = 1 and wot1.del_flag = 0
|
|
|
|
|
+ left join kwt_waybill_order_ticket wot2 on wot2.w_order_id = wo.id and wot2.type = 2 and c.unit = wot2.unit and wot1.type = 2 and wot2.del_flag = 0
|
|
|
|
|
+
|
|
|
|
|
+ left join kwt_logistics_order lo on lo.id = c.l_order_id
|
|
|
|
|
+ where c.del_flag = 0 and lo.del_flag = 0
|
|
|
|
|
+ <if test="driverId != null and driverId != ''">
|
|
|
|
|
+ and wo.driver_id = #{driverId, jdbcType=BIGINT}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="truckId != null and truckId != ''">
|
|
|
|
|
+ and wo.truck_id = #{truckId, jdbcType=BIGINT}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="passStatus != null and passStatus != ''">
|
|
|
|
|
+ and c.status = 8
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="loadCountStatus != null and loadCountStatus != ''">
|
|
|
|
|
+ and c.status in (5, 6, 7, 8, 12, 13)
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="unloadCountStatus != null and unloadCountStatus != ''">
|
|
|
|
|
+ and c.status in (7, 8, 12, 13)
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="tOrderId != null and tOrderId != ''">
|
|
|
|
|
+ and lo.t_order_id = #{tOrderId, jdbcType=BIGINT}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="lOrderId != null and lOrderId != ''">
|
|
|
|
|
+ and lo.id = #{lOrderId, jdbcType=BIGINT}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="logisticsStatus != null and logisticsStatus != ''">
|
|
|
|
|
+ and lo.status = #{logisticsStatus, jdbcType=INTEGER}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="upperlOrderId != null and upperlOrderId != ''">
|
|
|
|
|
+ and FIND_IN_SET(#{upperlOrderId, jdbcType=BIGINT}, lo.pids)
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="belowlOrderId != null and belowlOrderId != ''">
|
|
|
|
|
+ and FIND_IN_SET(lo.id, #{belowlOrderId, jdbcType=VARCHAR})
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="ownOrderId != null and ownOrderId != ''">
|
|
|
|
|
+ and lo.id != #{ownOrderId, jdbcType=BIGINT}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </select>
|
|
|
|
|
+ <select id="selectDataByLorderId" resultType="java.lang.Integer">
|
|
|
|
|
+ SELECT COUNT(b.id)
|
|
|
|
|
+ FROM kwt_waybill_order_subtask k
|
|
|
|
|
+ left join kwt_waybill_order a on k.w_order_id = a.id and a.del_flag = 0 and k.del_flag = 0
|
|
|
|
|
+ LEFT JOIN kwt_logistics_order b ON k.l_order_id = b.id AND a.del_flag = 0 AND b.del_flag = 0
|
|
|
|
|
+ <where>
|
|
|
|
|
+ <if test="id != null and id !=''">
|
|
|
|
|
+ and b.id = #{id}
|
|
|
|
|
+ </if>
|
|
|
|
|
+ <if test="statusList != null and statusList.size() >0">
|
|
|
|
|
+ AND a.`status` IN
|
|
|
|
|
+ <foreach collection="statusList" item="item" open="(" close=")" separator=",">
|
|
|
|
|
+ #{item}
|
|
|
|
|
+ </foreach>
|
|
|
|
|
+ </if>
|
|
|
|
|
+ </where>
|
|
|
|
|
+ </select>
|
|
|
</mapper>
|
|
</mapper>
|