KwtWaybillOrderMapper.xml 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="com.sckw.transport.dao.KwtWaybillOrderMapper">
  4. <resultMap id="BaseResultMap" type="com.sckw.transport.model.KwtWaybillOrder">
  5. <id column="id" jdbcType="BIGINT" property="id"/>
  6. <result column="ent_id" jdbcType="BIGINT" property="entId"/>
  7. <result column="l_order_id" jdbcType="BIGINT" property="lOrderId"/>
  8. <result column="w_order_no" jdbcType="VARCHAR" property="wOrderNo"/>
  9. <result column="truck_no" jdbcType="VARCHAR" property="truckNo"/>
  10. <result column="type" jdbcType="VARCHAR" property="type"/>
  11. <result column="driver_id" jdbcType="BIGINT" property="driverId"/>
  12. <result column="driver_name" jdbcType="VARCHAR" property="driverName"/>
  13. <result column="driver_phone" jdbcType="VARCHAR" property="driverPhone"/>
  14. <result column="driver_idcard" jdbcType="VARCHAR" property="driverIdcard"/>
  15. <result column="entrust_amount" jdbcType="DECIMAL" property="entrustAmount"/>
  16. <result column="unload_amount" jdbcType="DECIMAL" property="unloadAmount"/>
  17. <result column="load_amount" jdbcType="DECIMAL" property="loadAmount"/>
  18. <result column="deficit_amount" jdbcType="DECIMAL" property="deficitAmount"/>
  19. <result column="remark" jdbcType="VARCHAR" property="remark"/>
  20. <result column="status" jdbcType="INTEGER" property="status"/>
  21. <result column="create_by" jdbcType="BIGINT" property="createBy"/>
  22. <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
  23. <result column="start_time" jdbcType="TIMESTAMP" property="startTime"/>
  24. <result column="end_time" jdbcType="TIMESTAMP" property="endTime"/>
  25. <result column="update_by" jdbcType="BIGINT" property="updateBy"/>
  26. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
  27. <result column="del_flag" jdbcType="INTEGER" property="delFlag"/>
  28. </resultMap>
  29. <sql id="Base_Column_List">
  30. id
  31. , ent_id, l_order_id, w_order_no, truck_no, driver_id, entrust_amount, unload_amount,
  32. load_amount, deficit_amount, remark, `status`, create_by, create_time, update_by,
  33. update_time, del_flag,start_time,end_time
  34. </sql>
  35. <select id="selectWaybillOrderCarList" resultType="com.sckw.transport.model.dto.OrderCarDTO">
  36. SELECT a.id as wOrderId,
  37. a.w_order_no as wOrderNo,
  38. a.driver_id as driverId,
  39. a.driver_name as driverName,
  40. a.driver_phone as driverPhone,
  41. a.driver_idcard as driverIdcard,
  42. a.l_order_id as lOrderId,
  43. b.l_order_no as lOrderNo,
  44. b.t_order_id as tOrderId,
  45. b.t_order_no as tOrderNo
  46. FROM kwt_waybill_order a
  47. LEFT JOIN kwt_logistics_order b ON a.l_order_id = b.id
  48. WHERE a.del_flag = '0'
  49. and b.del_flag = '0'
  50. and b.t_order_id = #{id,jdbcType=VARCHAR} limit #{page}
  51. , #{pageSize}
  52. </select>
  53. <select id="selectWaybillOrderCarCount" resultType="java.lang.Long">
  54. SELECT count(a.id)
  55. FROM kwt_waybill_order a
  56. LEFT JOIN kwt_logistics_order b ON a.l_order_id = b.id
  57. WHERE a.del_flag = '0'
  58. and b.del_flag = '0'
  59. and b.t_order_id = #{id,jdbcType=VARCHAR}
  60. </select>
  61. <select id="statistics" resultType="com.sckw.mongo.model.TobleTop">
  62. SELECT count(a.id) AS total
  63. FROM kwt_waybill_order a
  64. LEFT JOIN kwt_waybill_order_track b ON a.id = b.w_order_id
  65. AND a.del_flag = '0'
  66. AND b.del_flag = '0'
  67. <where>
  68. <if test="id != null and id !=''">
  69. a.driver_id = #{id,jdbcType=BIGINT}
  70. </if>
  71. <if test="status != null and status.size() > 0">
  72. AND b.`status` IN
  73. <foreach collection="status" item="item" open="(" close=")" separator=",">
  74. #{item}
  75. </foreach>
  76. </if>
  77. </where>
  78. </select>
  79. <select id="selectDriverOrder" resultType="java.lang.Long">
  80. SELECT a.l_order_id as lOrderId
  81. FROM kwt_waybill_order a
  82. LEFT JOIN kwt_waybill_order_track b ON a.id = b.w_order_id
  83. AND a.del_flag = '0'
  84. AND b.del_flag = '0'
  85. AND a.type='0'
  86. <where>
  87. <if test="id != null and id !=''">
  88. a.driver_id = #{id,jdbcType=BIGINT}
  89. </if>
  90. <if test="status != null and status.size() > 0">
  91. AND a.`status` IN
  92. <foreach collection="status" item="item" open="(" close=")" separator=",">
  93. #{item}
  94. </foreach>
  95. </if>
  96. </where>
  97. group by lOrderId
  98. </select>
  99. <select id="getWaybillData" resultType="com.sckw.transport.model.vo.WaybillDetailVO">
  100. </select>
  101. <select id="selectWaybillRelate" resultType="com.sckw.transport.model.dto.WayBillDetailDTO">
  102. SELECT
  103. `order`.`id` AS `wOrderId`,
  104. `order`.`w_order_no` AS `wOrderNo`,
  105. `order`.`truck_no` AS `truckNo`,
  106. `order`.`entrust_amount` AS `entrustAmount`,
  107. `order`.`truck_id` AS `truckId`,
  108. `order`.`driver_id` AS `driverId`,
  109. `order`.`driver_name` AS `driverName`,
  110. `order`.`driver_phone` AS `driverPhone`,
  111. `order`.`driver_idcard` AS `driverIdcard`,
  112. `order`.`type`,
  113. `order`.`start_time` AS `startTime`,
  114. `order`.`end_time` AS `endTime`,
  115. `order`.`create_by` AS `createBy`,
  116. `logistics`.`id` AS `lOrderId`,
  117. `logistics`.`l_order_no` AS `lOrderNo`,
  118. `logistics`.`price_type` AS `priceType`,
  119. `goods`.`goods_name` AS goodsName
  120. FROM
  121. `kwt_waybill_order` `order`
  122. LEFT JOIN `kwt_logistics_order` `logistics` ON `logistics`.`id` = `order`.`l_order_id`
  123. LEFT JOIN `kwt_logistics_order_goods` `goods` ON `goods`.`l_order_id` = `order`.`l_order_id`
  124. WHERE
  125. `order`.`id` = #{id,jdbcType=BIGINT}
  126. </select>
  127. </mapper>