KwpLedgerLogisticsMapper.xml 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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.payment.dao.KwpLedgerLogisticsMapper">
  4. <resultMap id="BaseResultMap" type="com.sckw.payment.model.KwpLedgerLogistics">
  5. <!--@mbg.generated-->
  6. <!--@Table kwp_ledger_logistics-->
  7. <id column="id" jdbcType="BIGINT" property="id"/>
  8. <result column="ent_id" jdbcType="BIGINT" property="entId"/>
  9. <result column="l_ledger_no" jdbcType="VARCHAR" property="lLedgerNo"/>
  10. <result column="name" jdbcType="VARCHAR" property="name"/>
  11. <result column="start_time" jdbcType="TIMESTAMP" property="startTime"/>
  12. <result column="end_time" jdbcType="TIMESTAMP" property="endTime"/>
  13. <result column="tax_rate" jdbcType="INTEGER" property="taxRate"/>
  14. <result column="trading" jdbcType="VARCHAR" property="trading"/>
  15. <result column="total_price" jdbcType="DECIMAL" property="totalPrice"/>
  16. <result column="ex_tax_price" jdbcType="DECIMAL" property="exTaxPrice"/>
  17. <result column="settle_price" jdbcType="DECIMAL" property="settlePrice"/>
  18. <result column="actual_price" jdbcType="DECIMAL" property="actualPrice"/>
  19. <result column="audit_user" jdbcType="VARCHAR" property="auditUser"/>
  20. <result column="audit_phone" jdbcType="VARCHAR" property="auditPhone"/>
  21. <result column="url" jdbcType="VARCHAR" property="url"/>
  22. <result column="generate_time" jdbcType="TIMESTAMP" property="generateTime"/>
  23. <result column="receipt_time" jdbcType="TIMESTAMP" property="receiptTime"/>
  24. <result column="order_count" jdbcType="INTEGER" property="orderCount"/>
  25. <result column="remark" jdbcType="VARCHAR" property="remark"/>
  26. <result column="status" jdbcType="INTEGER" property="status"/>
  27. <result column="create_by" jdbcType="BIGINT" property="createBy"/>
  28. <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
  29. <result column="update_by" jdbcType="BIGINT" property="updateBy"/>
  30. <result column="update_time" jdbcType="TIMESTAMP" property="updateTime"/>
  31. <result column="del_flag" jdbcType="INTEGER" property="delFlag"/>
  32. </resultMap>
  33. <sql id="Base_Column_List">
  34. <!--@mbg.generated-->
  35. id,
  36. ent_id,
  37. l_ledger_no,
  38. `name`,
  39. start_time,
  40. end_time,
  41. tax_rate,
  42. trading,
  43. total_price,
  44. ex_tax_price,
  45. settle_price,
  46. actual_price,
  47. audit_user,
  48. audit_phone,
  49. url,
  50. generate_time,
  51. receipt_time,
  52. order_count,
  53. remark,
  54. `status`,
  55. create_by,
  56. create_time,
  57. update_by,
  58. update_time,
  59. del_flag
  60. </sql>
  61. <sql id="list_col">
  62. kll.id,
  63. kll.l_ledger_no lLedgerNo,
  64. kll.name,
  65. kll.start_time startTime,
  66. kll.end_time endTime,
  67. kll.tax_rate taxRate,
  68. kll.trading,
  69. kll.total_price totalPrice,
  70. kll.ex_tax_price exTaxPrice,
  71. kll.settle_price settlePrice,
  72. kll.actual_price actualPrice,
  73. kll.audit_phone auditPhone,
  74. kll.audit_user auditUser,
  75. kll.url,
  76. kll.generate_time generateTime,
  77. kll.receipt_time receiptTime,
  78. kll.remark,
  79. kll.status,
  80. kllu.contacts,
  81. kllu.phone,
  82. kllu.firm_name firmName,
  83. kll.order_count orderCount
  84. </sql>
  85. <sql id="pageList">
  86. select
  87. <include refid="list_col"/>
  88. from kwp_ledger_logistics kll
  89. inner join kwp_ledger_logistics_unit kllu on kll.id = kllu.l_ledger_id and kllu.del_flag = 0
  90. <where>
  91. kll.del_flag = 0
  92. and kllu.unit_type = #{logisticsReq.unitType,jdbcType=INTEGER}
  93. and kllu.top_ent_id = #{logisticsReq.entId,jdbcType=BIGINT}
  94. <if test="logisticsReq.status != null">
  95. and kll.status = #{logisticsReq.status}
  96. </if>
  97. <if test="logisticsReq.trading != null">
  98. and kll.trading = #{logisticsReq.trading,jdbcType=INTEGER}
  99. </if>
  100. <if test="logisticsReq.startCreateTime != null and logisticsReq.startCreateTime != '' and logisticsReq.endCreateTime != null and logisticsReq.endCreateTime != ''">
  101. and kll.generate_time between #{logisticsReq.startCreateTime,jdbcType=TIMESTAMP}
  102. and #{logisticsReq.endCreateTime,jdbcType=TIMESTAMP}
  103. </if>
  104. <if test="logisticsReq.keywords != null and logisticsReq.keywords != ''">
  105. and (
  106. kll.l_ledger_no like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
  107. or kllu.firm_name like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
  108. or kllu.contacts like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
  109. )
  110. </if>
  111. </where>
  112. order by kll.generate_time desc
  113. </sql>
  114. <select id="shipperSelect" resultType="com.sckw.payment.model.dto.LedgerShipperDto">
  115. <include refid="pageList"/>
  116. </select>
  117. <select id="carrierSelect" resultType="com.sckw.payment.model.dto.LedgerCarrierDto">
  118. <include refid="pageList"/>
  119. </select>
  120. <select id="countOrder" resultType="java.util.Map">
  121. SELECT count(1) "0",
  122. count(IF(kll.status = 1, 1, NULL)) "1",
  123. count(IF(kll.status = 2, 1, NULL)) "2",
  124. count(IF(kll.status = 3, 1, NULL)) "3",
  125. count(IF(kll.status = 4, 1, NULL)) "4",
  126. count(IF(kll.status = 5, 1, NULL)) "5",
  127. count(IF(kll.status = 6, 1, NULL)) "6"
  128. FROM kwp_ledger_logistics kll
  129. inner join kwp_ledger_logistics_unit kllu on kll.id = kllu.l_ledger_id and kllu.del_flag = 0
  130. WHERE kll.del_flag = 0
  131. and kllu.unit_type = #{unitType,jdbcType=INTEGER}
  132. and kllu.top_ent_id = #{logisticsReq.entId,jdbcType=BIGINT}
  133. </select>
  134. <select id="selectCarrierIds" resultType="com.sckw.payment.model.dto.LedgerCarrierDto">
  135. select
  136. <include refid="list_col"/>
  137. from kwp_ledger_logistics kll
  138. inner join kwp_ledger_logistics_unit kllu on kll.id = kllu.l_ledger_id and kllu.del_flag = 0
  139. <where>
  140. kll.del_flag = 0
  141. and kllu.unit_type = 1
  142. and kll.id in
  143. <foreach collection="ids" item="id" close=")" open="(" separator=",">
  144. #{id,jdbcType=BIGINT}
  145. </foreach>
  146. </where>
  147. order by kll.generate_time desc
  148. </select>
  149. <select id="selectShipperIds" resultType="com.sckw.payment.model.dto.LedgerShipperDto">
  150. select
  151. <include refid="list_col"/>
  152. from kwp_ledger_logistics kll
  153. inner join kwp_ledger_logistics_unit kllu on kll.id = kllu.l_ledger_id and kllu.del_flag = 0
  154. <where>
  155. kll.del_flag = 0
  156. and kllu.unit_type = 2
  157. and kll.id in
  158. <foreach collection="ids" item="id" close=")" open="(" separator=",">
  159. #{id,jdbcType=BIGINT}
  160. </foreach>
  161. </where>
  162. order by kll.generate_time desc
  163. </select>
  164. <select id="selectId" resultType="com.sckw.payment.model.dto.LedgerLogisticsDto">
  165. select
  166. <include refid="list_col"/>
  167. from kwp_ledger_logistics kll
  168. inner join kwp_ledger_logistics_unit kllu on kll.id = kllu.l_ledger_id and kllu.del_flag = 0
  169. <where>
  170. kll.del_flag = 0
  171. and kllu.unit_type = #{unitType,jdbcType=INTEGER}
  172. and kll.id = #{id}
  173. </where>
  174. </select>
  175. </mapper>