|
|
@@ -142,15 +142,77 @@
|
|
|
<select id="findWaybillOrderCount" parameterType="com.sckw.transport.model.dto.WaybillListAppDTO" resultType="java.util.Map">
|
|
|
SELECT
|
|
|
count(1) total,
|
|
|
- count(case when wos.status in (101, 201, 203, 301, 302, 401, 402, 501, 503, 504) then 1 end) proceed,
|
|
|
- count(case when wos.status = 502 then 1 end) finish,
|
|
|
- count(case when wos.status in (102, 103, 202) then 1 end) cancel,
|
|
|
- count(case when wos.status in (101, 201, 203, 301, 302, 401, 402, 501, 503, 504) then 1 end) ndexProceed,
|
|
|
- count(case when wos.status in (102, 103, 202, 502) then 1 end) ndexFinish
|
|
|
- from kwt_waybill_order_subtask wos
|
|
|
- where wos.del_flag = 0
|
|
|
- <if test="lOrderId != null and lOrderId != ''">
|
|
|
- and wos.l_order_id = #{lOrderId, jdbcType=BIGINT}
|
|
|
+ count(case when wo.status in (101, 201, 203, 301, 302, 401, 402, 501, 503, 504) then 1 end) proceed,
|
|
|
+ count(case when wo.status = 502 then 1 end) finish,
|
|
|
+ count(case when wo.status in (102, 103, 202) then 1 end) cancel,
|
|
|
+ count(case when wo.status in (101, 201, 203, 301, 302, 401, 402, 501, 503, 504) then 1 end) ndexProceed,
|
|
|
+ count(case when wo.status in (102, 103, 202, 502) then 1 end) ndexFinish
|
|
|
+ from kwt_waybill_order wo
|
|
|
+ where wo.del_flag = 0
|
|
|
+ <if test="entId != null and entId != ''">
|
|
|
+ and wo.ent_id = #{entId, jdbcType=VARCHAR}
|
|
|
+ </if>
|
|
|
+ <if test="userIds != null and userIds.size() > 0">
|
|
|
+ and wo.create_by IN
|
|
|
+ <foreach collection="userIds" open="(" close=")" item="item" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="entIds != null and entIds.size() > 0">
|
|
|
+ and wo.ent_id IN
|
|
|
+ <foreach collection="entIds" open="(" close=")" item="item" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="queryWstatus != null and queryWstatus != ''">
|
|
|
+ AND wo.status in
|
|
|
+ <foreach collection="queryWstatus.split(',')" item="item" open="(" close=")" separator=",">
|
|
|
+ #{item}
|
|
|
+ </foreach>
|
|
|
+ </if>
|
|
|
+ <if test="(loadCityCode != null and loadCityCode != '') or (unloadCityCode != null and unloadCityCode != '')">
|
|
|
+ and wo.id in (
|
|
|
+ SELECT DISTINCT w_order_id from kwt_waybill_order_address where del_flag = 0
|
|
|
+ <if test="loadCityCode != null and loadCityCode != ''">
|
|
|
+ and address_type = 1
|
|
|
+ and left(city_code, #{loadCityCodeLevel, jdbcType=INTEGER}) = left( #{loadCityCode, jdbcType=INTEGER}, #{loadCityCodeLevel, jdbcType=INTEGER} )
|
|
|
+ </if>
|
|
|
+ <if test="unloadCityCode != null and unloadCityCode != ''">
|
|
|
+ and address_type = 2
|
|
|
+ and left(city_code, #{unloadCityCodeLevel, jdbcType=INTEGER}) = left( #{unloadCityCode, jdbcType=INTEGER}, #{unloadCityCodeLevel, jdbcType=INTEGER} )
|
|
|
+ </if>
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test="(startLoadTime != null and startLoadTime != '') or (endLoadTime != null and endLoadTime != '')
|
|
|
+ or (startUnloadTime != null and startUnloadTime != '') or (endUnloadTime != null and endUnloadTime != '')">
|
|
|
+ and wo.id in (
|
|
|
+ SELECT DISTINCT w_order_id from kwt_waybill_order_subtask where del_flag = 0
|
|
|
+ <if test="startLoadTime != null and startLoadTime != ''">
|
|
|
+ and DATE(load_time) <![CDATA[ >= ]]> #{startLoadTime,jdbcType=TIMESTAMP}
|
|
|
+ </if>
|
|
|
+ <if test="endLoadTime != null and endLoadTime != ''">
|
|
|
+ and DATE(load_time) <![CDATA[ >= ]]> #{startLoadTime,jdbcType=TIMESTAMP}
|
|
|
+ </if>
|
|
|
+ <if test="startUnloadTime != null and startUnloadTime != ''">
|
|
|
+ and DATE(load_time) <![CDATA[ >= ]]> #{startLoadTime,jdbcType=TIMESTAMP}
|
|
|
+ </if>
|
|
|
+ <if test="endUnloadTime != null and endUnloadTime != ''">
|
|
|
+ and DATE(load_time) <![CDATA[ >= ]]> #{startLoadTime,jdbcType=TIMESTAMP}
|
|
|
+ </if>
|
|
|
+ )
|
|
|
+ </if>
|
|
|
+ <if test="startSendCarTime != null and startSendCarTime != '' " >
|
|
|
+ and DATE( wo.create_time) <![CDATA[ >= ]]> #{startSendCarTime,jdbcType=TIMESTAMP}
|
|
|
+ </if>
|
|
|
+ <if test="endSendCarTime != null and endSendCarTime != '' " >
|
|
|
+ and DATE( wo.create_time ) <![CDATA[ <= ]]> #{endSendCarTime,jdbcType=TIMESTAMP}
|
|
|
+ </if>
|
|
|
+ <if test="keywords != null and keywords != ''">
|
|
|
+ and (
|
|
|
+ wo.w_order_no like concat('%',#{keywords},'%')
|
|
|
+ or wo.truck_no like concat('%',#{keywords},'%')
|
|
|
+ or wo.driver_name like concat('%',#{keywords},'%')
|
|
|
+ )
|
|
|
</if>
|
|
|
</select>
|
|
|
</mapper>
|