KwpLedgerLogisticsMapper.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  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="INTEGER" 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. <select id="shipperSelect" resultType="com.sckw.payment.model.dto.LedgerShipperDto">
  62. select 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. from kwp_ledger_logistics kll
  85. inner join kwp_ledger_logistics_unit kllu on kll.id = kllu.l_ledger_id and kllu.del_flag = 0
  86. <where>
  87. kll.del_flag = 0
  88. and kllu.unit_type = 1
  89. and kllu.ent_id = #{logisticsReq.entId,jdbcType=BIGINT}
  90. <if test="logisticsReq.status != null">
  91. and kll.status = #{logisticsReq.status}
  92. </if>
  93. <if test="logisticsReq.trading != null">
  94. and kll.trading = #{logisticsReq.trading,jdbcType=INTEGER}
  95. </if>
  96. <if test="logisticsReq.startCreateTime != null and logisticsReq.startCreateTime != '' and logisticsReq.endCreateTime != null and logisticsReq.endCreateTime != ''">
  97. and kll.generate_time between #{logisticsReq.startCreateTime,jdbcType=TIMESTAMP}
  98. and #{logisticsReq.endCreateTime,jdbcType=TIMESTAMP}
  99. </if>
  100. <if test="logisticsReq.keywords != null and logisticsReq.keywords != ''">
  101. and (
  102. kll.l_ledger_no like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
  103. or kllu.firm_name like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
  104. or kllu.contacts like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
  105. )
  106. </if>
  107. </where>
  108. order by kll.generate_time desc
  109. </select>
  110. <select id="carrierSelect" resultType="com.sckw.payment.model.dto.LedgerCarrierDto">
  111. select kll.id,
  112. kll.l_ledger_no lLedgerNo,
  113. kll.name,
  114. kll.start_time startTime,
  115. kll.end_time endTime,
  116. kll.tax_rate taxRate,
  117. kll.trading,
  118. kll.total_price totalPrice,
  119. kll.ex_tax_price exTaxPrice,
  120. kll.settle_price settlePrice,
  121. kll.actual_price actualPrice,
  122. kll.audit_phone auditPhone,
  123. kll.audit_user auditUser,
  124. kll.url,
  125. kll.generate_time generateTime,
  126. kll.receipt_time receiptTime,
  127. kll.remark,
  128. kll.status,
  129. kllu.contacts,
  130. kllu.phone,
  131. kllu.firm_name firmName,
  132. kll.order_count orderCount
  133. from kwp_ledger_logistics kll
  134. inner join kwp_ledger_logistics_unit kllu on kll.id = kllu.l_ledger_id and kllu.del_flag = 0
  135. <where>
  136. kll.del_flag = 0
  137. and kllu.unit_type = 2
  138. and kllu.ent_id = #{logisticsReq.entId,jdbcType=BIGINT}
  139. <if test="logisticsReq.status != null">
  140. and kll.status = #{logisticsReq.status}
  141. </if>
  142. <if test="logisticsReq.trading != null">
  143. and kll.trading = #{logisticsReq.trading,jdbcType=INTEGER}
  144. </if>
  145. <if test="logisticsReq.startCreateTime != null and logisticsReq.endCreateTime != null">
  146. and kll.generate_time between #{logisticsReq.startCreateTime,jdbcType=TIMESTAMP}
  147. and #{logisticsReq.endCreateTime,jdbcType=TIMESTAMP}
  148. </if>
  149. <if test="logisticsReq.keywords != null and logisticsReq.keywords != ''">
  150. and (
  151. kll.l_ledger_no like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
  152. or kllu.firm_name like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
  153. or kllu.contacts like concat('%', #{logisticsReq.keywords,jdbcType=VARCHAR}, '%')
  154. )
  155. </if>
  156. </where>
  157. order by kll.generate_time desc
  158. </select>
  159. <select id="countOrder" resultType="java.util.Map">
  160. SELECT count(1) "0",
  161. count(IF(kll.status = 1, 1, NULL)) "1",
  162. count(IF(kll.status = 2, 1, NULL)) "2",
  163. count(IF(kll.status = 3, 1, NULL)) "3",
  164. count(IF(kll.status = 4, 1, NULL)) "4",
  165. count(IF(kll.status = 5, 1, NULL)) "5",
  166. count(IF(kll.status = 6, 1, NULL)) "6"
  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 kll.del_flag = 0
  170. and kllu.unit_type = #{unitType,jdbcType=INTEGER}
  171. and kllu.ent_id = #{entId,jdbcType=BIGINT}
  172. </select>
  173. <select id="selectCarrierIds" resultType="com.sckw.payment.model.dto.LedgerCarrierDto">
  174. select kll.id,
  175. kll.l_ledger_no lLedgerNo,
  176. kll.name,
  177. kll.start_time startTime,
  178. kll.end_time endTime,
  179. kll.tax_rate taxRate,
  180. kll.trading,
  181. kll.total_price totalPrice,
  182. kll.ex_tax_price exTaxPrice,
  183. kll.settle_price settlePrice,
  184. kll.actual_price actualPrice,
  185. kll.audit_phone auditPhone,
  186. kll.audit_user auditUser,
  187. kll.url,
  188. kll.generate_time generateTime,
  189. kll.receipt_time receiptTime,
  190. kll.remark,
  191. kll.status,
  192. kllu.contacts,
  193. kllu.phone,
  194. kllu.firm_name firmName,
  195. kll.order_count orderCount
  196. from kwp_ledger_logistics kll
  197. inner join kwp_ledger_logistics_unit kllu on kll.id = kllu.l_ledger_id and kllu.del_flag = 0
  198. <where>
  199. kll.del_flag = 0
  200. and kllu.unit_type = 1
  201. and kll.id in
  202. <foreach collection="ids" item="id" close=")" open="(" separator=",">
  203. #{id,jdbcType=BIGINT}
  204. </foreach>
  205. </where>
  206. order by kll.generate_time desc
  207. </select>
  208. <select id="selectShipperIds" resultType="com.sckw.payment.model.dto.LedgerShipperDto">
  209. select kll.id,
  210. kll.l_ledger_no lLedgerNo,
  211. kll.name,
  212. kll.start_time startTime,
  213. kll.end_time endTime,
  214. kll.tax_rate taxRate,
  215. kll.trading,
  216. kll.total_price totalPrice,
  217. kll.ex_tax_price exTaxPrice,
  218. kll.settle_price settlePrice,
  219. kll.actual_price actualPrice,
  220. kll.audit_phone auditPhone,
  221. kll.audit_user auditUser,
  222. kll.url,
  223. kll.generate_time generateTime,
  224. kll.receipt_time receiptTime,
  225. kll.remark,
  226. kll.status,
  227. kllu.contacts,
  228. kllu.phone,
  229. kllu.firm_name firmName,
  230. kll.order_count orderCount
  231. from kwp_ledger_logistics kll
  232. inner join kwp_ledger_logistics_unit kllu on kll.id = kllu.l_ledger_id and kllu.del_flag = 0
  233. <where>
  234. kll.del_flag = 0
  235. and kllu.unit_type = 1
  236. and kll.id in
  237. <foreach collection="ids" item="id" close=")" open="(" separator=",">
  238. #{id,jdbcType=BIGINT}
  239. </foreach>
  240. </where>
  241. order by kll.generate_time desc
  242. </select>
  243. <select id="selectId" resultType="com.sckw.payment.model.dto.LedgerLogisticsDto">
  244. select kll.id,
  245. kll.l_ledger_no lLedgerNo,
  246. kll.name,
  247. kll.start_time startTime,
  248. kll.end_time endTime,
  249. kll.tax_rate taxRate,
  250. kll.trading,
  251. kll.total_price totalPrice,
  252. kll.ex_tax_price exTaxPrice,
  253. kll.settle_price settlePrice,
  254. kll.actual_price actualPrice,
  255. kll.audit_phone auditPhone,
  256. kll.audit_user auditUser,
  257. kll.url,
  258. kll.generate_time generateTime,
  259. kll.receipt_time receiptTime,
  260. kll.remark,
  261. kll.status,
  262. kllu.contacts,
  263. kllu.phone,
  264. kllu.firm_name firmName,
  265. kll.order_count orderCount
  266. from kwp_ledger_logistics kll
  267. inner join kwp_ledger_logistics_unit kllu on kll.id = kllu.l_ledger_id and kllu.del_flag = 0
  268. <where>
  269. kll.del_flag = 0
  270. and kllu.unit_type = 1
  271. and kll.id = #{id}
  272. </where>
  273. </select>
  274. </mapper>