|
|
@@ -176,6 +176,7 @@
|
|
|
and FIND_IN_SET(id, #{belowlOrderId, jdbcType=VARCHAR})
|
|
|
</if>
|
|
|
</select>
|
|
|
+
|
|
|
<select id="selectWaybillOrderCarListGroupByTruckNo" resultType="com.sckw.transport.model.dto.OrderCarDTO">
|
|
|
SELECT
|
|
|
a.truck_no AS truckNo,
|
|
|
@@ -198,4 +199,138 @@
|
|
|
a.truck_no
|
|
|
limit #{page},#{pageSize}
|
|
|
</select>
|
|
|
+
|
|
|
+ <select id="findStatisticsCountByDriver" resultType="java.util.Map" >
|
|
|
+ select
|
|
|
+ tabA.total + tabB.total as waitTotal, tabC.total departureTotal, tabD.total executeTotal, tabE.total endTotal
|
|
|
+ from
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ count(1) total, 0 indexNum
|
|
|
+ FROM kwt_logistics_order_circulate loc
|
|
|
+ LEFT JOIN kwt_logistics_order lo on lo.id = loc.l_order_id
|
|
|
+ where loc.del_flag = 0 and lo.del_flag = 0 and loc.status = 0 and loc.w_order_id is null
|
|
|
+ and loc.driver_id = #{driverId, jdbcType=BIGINT}
|
|
|
+ ) tabA
|
|
|
+ left join
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ count(1) total, 0 indexNum
|
|
|
+ FROM kwt_waybill_order wo
|
|
|
+ LEFT JOIN kwt_logistics_order lo on lo.id = wo.l_order_id
|
|
|
+ where wo.del_flag = 0 and lo.del_flag = 0 and wo.status = 1
|
|
|
+ and wo.driver_id = #{driverId, jdbcType=BIGINT}
|
|
|
+ ) tabB on tabB.indexNum = tabA.indexNum
|
|
|
+ left join
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ count(1) total, 0 indexNum
|
|
|
+ FROM kwt_waybill_order wo
|
|
|
+ LEFT JOIN kwt_logistics_order lo on lo.id = wo.l_order_id
|
|
|
+ where wo.del_flag = 0 and lo.del_flag = 0 and wo.status = 2
|
|
|
+ and wo.driver_id = #{driverId, jdbcType=BIGINT}
|
|
|
+ ) tabC on tabC.indexNum = tabA.indexNum
|
|
|
+ left join
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ count(1) total, 0 indexNum
|
|
|
+ FROM kwt_waybill_order wo
|
|
|
+ LEFT JOIN kwt_logistics_order lo on lo.id = wo.l_order_id
|
|
|
+ where wo.del_flag = 0 and lo.del_flag = 0 and wo.status in (3, 4, 5, 6)
|
|
|
+ and wo.driver_id = #{driverId, jdbcType=BIGINT}
|
|
|
+ ) tabD on tabD.indexNum = tabA.indexNum
|
|
|
+ left join
|
|
|
+ (
|
|
|
+ SELECT
|
|
|
+ count(1) total, 0 indexNum
|
|
|
+ FROM kwt_waybill_order wo
|
|
|
+ LEFT JOIN kwt_logistics_order lo on lo.id = wo.l_order_id
|
|
|
+ where wo.del_flag = 0 and lo.del_flag = 0 and wo.status in (7, 8, 9, 10, 11, 12)
|
|
|
+ and wo.driver_id = #{driverId, jdbcType=BIGINT}
|
|
|
+ ) tabE on tabE.indexNum = tabA.indexNum
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="findStatisticsSumByDriver" resultType="java.util.Map" parameterType="java.util.Map">
|
|
|
+ SELECT
|
|
|
+ count(1) total, IFNULL(sum(wo.entrust_amount), 0.0) entrustAmount, IFNULL(sum(wo.load_amount), 0.0) loadAmount,
|
|
|
+ IFNULL(sum(wo.unload_amount), 0.0) unloadAmount, IFNULL(sum(wo.deficit_amount), 0.0) deficitAmount,
|
|
|
+ IFNULL(sum(wo.deficit_price), 0.0) deficitPrice
|
|
|
+ FROM kwt_waybill_order wo
|
|
|
+ LEFT JOIN kwt_logistics_order lo on lo.id = wo.l_order_id
|
|
|
+ where wo.del_flag = 0 and lo.del_flag = 0
|
|
|
+ <if test="busStatus != null and busStatus == 4">
|
|
|
+ and wo.status in (7, 8, 9, 10, 11, 12)
|
|
|
+ </if>
|
|
|
+ <if test="driverId != null and driverId != ''">
|
|
|
+ and wo.driver_id = #{driverId, jdbcType=BIGINT}
|
|
|
+ </if>
|
|
|
+ <if test="month != null and month != ''">
|
|
|
+ and LEFT(wo.create_time, 7) = #{month, jdbcType=TIMESTAMP}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="findWaitWaybillOrderByDriver" resultType="com.sckw.transport.model.vo.WaybillOrderDriverVo" parameterType="java.util.Map">
|
|
|
+ SELECT * from (
|
|
|
+ SELECT
|
|
|
+ wo.id wOrderId, wo.w_order_no wOrderNo, wo.l_order_id lOrderId, lo.l_order_no lOrderNo, wo.type,
|
|
|
+ wo.ent_id carrierEntId, 'xxxxx' carrierFirmName, log.goods_name goodsName, wo.start_time startTime,
|
|
|
+ wo.end_time endTime, wo.entrust_amount entrustAmount, woa1.name loadName, woa1.city_code loadCityCode,
|
|
|
+ woa1.city_name loadCityName, woa1.detail_address loadDetailAddress, woa2.name unloadName, woa2.city_code unloadCityCode,
|
|
|
+ woa2.city_name unloadCityName, woa2.detail_address unloadDetailAddress, wo.load_amount loadAmount, wo.unload_amount unloadAmount,
|
|
|
+ wo.deficit_amount deficitAmount, wo.deficit_price deficitPrice, wo.truck_no truckNo, wo.status, wo.create_time createTime
|
|
|
+ FROM kwt_waybill_order wo
|
|
|
+ LEFT JOIN kwt_logistics_order lo on lo.id = wo.l_order_id
|
|
|
+ LEFT JOIN kwt_waybill_order_address woa1 on woa1.w_order_id = wo.id and woa1.type = 1
|
|
|
+ LEFT JOIN kwt_waybill_order_address woa2 on woa2.w_order_id = wo.id and woa2.type = 2
|
|
|
+ LEFT JOIN kwt_logistics_order_goods log on log.l_order_id = wo.l_order_id
|
|
|
+ where wo.del_flag = 0 and lo.del_flag = 0 and wo.status = 1
|
|
|
+ and wo.driver_id = #{driverId, jdbcType=BIGINT}
|
|
|
+ UNION
|
|
|
+ SELECT
|
|
|
+ loc.id wOrderId, null wOrderNo, loc.l_order_id lOrderId, lo.l_order_no lOrderNo, loc.type,
|
|
|
+ loc.ent_id carrierEntId, 'xxxxx' carrierFirmName, log.goods_name goodsName, loc.start_time startTime,
|
|
|
+ loc.end_time endTime, loc.entrust_amount entrustAmount, woa1.name loadName, woa1.city_code loadCityCode,
|
|
|
+ woa1.city_name loadCityName, woa1.detail_address loadDetailAddress, woa2.name unloadName, woa2.city_code unloadCityCode,
|
|
|
+ woa2.city_name unloadCityName, woa2.detail_address unloadDetailAddress, null loadAmount, null unloadAmount,
|
|
|
+ null deficitAmount, null deficitPrice, loc.truck_no truckNo, 1 status, loc.update_time createTime
|
|
|
+ FROM kwt_logistics_order_circulate loc
|
|
|
+ LEFT JOIN kwt_logistics_order lo on lo.id = loc.l_order_id
|
|
|
+ LEFT JOIN kwt_waybill_order_address woa1 on woa1.w_order_id = lo.id and woa1.type = 1
|
|
|
+ LEFT JOIN kwt_waybill_order_address woa2 on woa2.w_order_id = lo.id and woa2.type = 2
|
|
|
+ LEFT JOIN kwt_logistics_order_goods log on log.l_order_id = loc.l_order_id
|
|
|
+ where loc.del_flag = 0 and lo.del_flag = 0 and loc.status = 0 and loc.w_order_id is null
|
|
|
+ and loc.driver_id = #{driverId, jdbcType=BIGINT}
|
|
|
+ ) tab order by createTime desc
|
|
|
+ </select>
|
|
|
+
|
|
|
+ <select id="findOtherWaybillOrderByDriver" resultType="com.sckw.transport.model.vo.WaybillOrderDriverVo" parameterType="java.util.Map">
|
|
|
+ SELECT
|
|
|
+ wo.id wOrderId, wo.w_order_no wOrderNo, wo.l_order_id lOrderId, lo.l_order_no lOrderNo, wo.type,
|
|
|
+ wo.ent_id carrierEntId, 'xxxxx' carrierFirmName, log.goods_name goodsName, wo.start_time startTime,
|
|
|
+ wo.end_time endTime, wo.entrust_amount entrustAmount, woa1.name loadName, woa1.city_code loadCityCode,
|
|
|
+ woa1.city_name loadCityName, woa1.detail_address loadDetailAddress, woa2.name unloadName, woa2.city_code unloadCityCode,
|
|
|
+ woa2.city_name unloadCityName, woa2.detail_address unloadDetailAddress, wo.load_amount loadAmount, wo.unload_amount unloadAmount,
|
|
|
+ wo.deficit_amount deficitAmount, wo.deficit_price deficitPrice, wo.truck_no truckNo, wo.status, wo.create_time createTime
|
|
|
+ FROM kwt_waybill_order wo
|
|
|
+ LEFT JOIN kwt_logistics_order lo on lo.id = wo.l_order_id
|
|
|
+ LEFT JOIN kwt_waybill_order_address woa1 on woa1.w_order_id = wo.id and woa1.type = 1
|
|
|
+ LEFT JOIN kwt_waybill_order_address woa2 on woa2.w_order_id = wo.id and woa2.type = 2
|
|
|
+ LEFT JOIN kwt_logistics_order_goods log on log.l_order_id = wo.l_order_id
|
|
|
+ where wo.del_flag = 0 and lo.del_flag = 0
|
|
|
+ <if test="driverId != null and driverId != ''">
|
|
|
+ and wo.driver_id = #{driverId, jdbcType=BIGINT}
|
|
|
+ </if>
|
|
|
+ <if test="busStatus != null and busStatus == 2">
|
|
|
+ and wo.status = 2
|
|
|
+ </if>
|
|
|
+ <if test="busStatus != null and busStatus == 3">
|
|
|
+ and wo.status in (3, 4, 5, 6)
|
|
|
+ </if>
|
|
|
+ <if test="busStatus != null and busStatus == 4">
|
|
|
+ and wo.status in (7, 8, 9, 10, 11, 12)
|
|
|
+ </if>
|
|
|
+ <if test="month != null and month != ''">
|
|
|
+ and LEFT(wo.create_time, 7) = #{month, jdbcType=TIMESTAMP}
|
|
|
+ </if>
|
|
|
+ </select>
|
|
|
</mapper>
|