OrderProcessRecordDao.xml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549
  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.kmall.admin.dao.OrderProcessRecordDao">
  4. <resultMap type="com.kmall.admin.entity.OrderProcessRecordEntity" id="orderProcessRecordMap">
  5. <result property="id" column="id"/>
  6. <result property="orderSn" column="order_sn"/>
  7. <result property="userId" column="user_id"/>
  8. <result property="orderBizType" column="order_biz_type"/>
  9. <result property="addOrderStartTime" column="add_order_start_time"/>
  10. <result property="addOrderSuccTime" column="add_order_succ_time"/>
  11. <result property="isAddOrderSend" column="is_add_order_send"/>
  12. <result property="payStartTime" column="pay_start_time"/>
  13. <result property="paySuccTime" column="pay_succ_time"/>
  14. <result property="paymentStartTime" column="payment_start_time"/>
  15. <result property="paymentSuccTime" column="payment_succ_time"/>
  16. <result property="isPaymentSend" column="is_payment_send"/>
  17. <result property="eleOrderStartTime" column="ele_order_start_time"/>
  18. <result property="eleOrderSuccTime" column="ele_order_succ_time"/>
  19. <result property="isEleOrderSend" column="is_ele_order_send"/>
  20. <result property="waybillStartTime" column="waybill_start_time"/>
  21. <result property="waybillSuccTime" column="waybill_succ_time"/>
  22. <result property="logisticsNo" column="logistics_no"/>
  23. <result property="customsStartTime" column="customs_start_time"/>
  24. <result property="customsSuccTime" column="customs_succ_time"/>
  25. <result property="invtNo" column="invt_no"/>
  26. <result property="isCustomsSend" column="is_customs_send"/>
  27. <result property="shipmentStartTime" column="shipment_start_time"/>
  28. <result property="shipmentSuccTime" column="shipment_succ_time"/>
  29. <result property="processContent" column="process_content"/>
  30. <result property="tstm" column="tstm"/>
  31. <result property="payTransactionId" column="ali_trade_no"/>
  32. </resultMap>
  33. <select id="queryObject" resultType="com.kmall.admin.entity.OrderProcessRecordEntity">
  34. select
  35. r.`id`,
  36. r.`order_sn`,
  37. r.`user_id`,
  38. r.`order_biz_type`,
  39. `add_order_start_time`,
  40. `add_order_succ_time`,
  41. `is_add_order_send`,
  42. `pay_start_time`,
  43. `pay_succ_time`,
  44. `payment_start_time`,
  45. `payment_succ_time`,
  46. `is_payment_send`,
  47. `ele_order_start_time`,
  48. `ele_order_succ_time`,
  49. `is_ele_order_send`,
  50. `waybill_start_time`,
  51. `waybill_succ_time`,
  52. `logistics_no`,
  53. `customs_start_time`,
  54. `customs_succ_time`,
  55. `invt_no`,
  56. `is_customs_send`,
  57. `shipment_start_time`,
  58. `shipment_succ_time`,
  59. `process_content`,
  60. `customs_send_sms_status`,
  61. r.`tstm`,
  62. o.ali_trade_no
  63. from mall_order_process_record r inner join mall_order o on r.order_sn = o.order_sn
  64. where id = #{id}
  65. </select>
  66. <select id="queryObjectByOrderSn" resultType="com.kmall.admin.entity.OrderProcessRecordEntity">
  67. select
  68. r.`id`,
  69. r.`order_sn`,
  70. r.`user_id`,
  71. r.`order_biz_type`,
  72. `add_order_start_time`,
  73. `add_order_succ_time`,
  74. `is_add_order_send`,
  75. `pay_start_time`,
  76. `pay_succ_time`,
  77. `payment_start_time`,
  78. `payment_succ_time`,
  79. `is_payment_send`,
  80. `ele_order_start_time`,
  81. `ele_order_succ_time`,
  82. `is_ele_order_send`,
  83. `waybill_start_time`,
  84. `waybill_succ_time`,
  85. `logistics_no`,
  86. `customs_start_time`,
  87. `customs_succ_time`,
  88. `invt_no`,
  89. `is_customs_send`,
  90. `shipment_start_time`,
  91. `shipment_succ_time`,
  92. `process_content`,
  93. `customs_send_sms_status`,
  94. customs_msg as clearMsg,
  95. r.`tstm`,
  96. o.ali_trade_no as pay_transaction_id
  97. from mall_order_process_record r inner join mall_order o on r.order_sn = o.order_sn
  98. where r.order_sn = #{orderSn}
  99. </select>
  100. <select id="queryList" resultType="com.kmall.admin.entity.OrderProcessRecordEntity">
  101. select
  102. `id`,
  103. `order_sn`,
  104. `user_id`,
  105. `order_biz_type`,
  106. `add_order_start_time`,
  107. `add_order_succ_time`,
  108. `is_add_order_send`,
  109. `pay_start_time`,
  110. `pay_succ_time`,
  111. `payment_start_time`,
  112. `payment_succ_time`,
  113. `is_payment_send`,
  114. `ele_order_start_time`,
  115. `ele_order_succ_time`,
  116. `is_ele_order_send`,
  117. `waybill_start_time`,
  118. `waybill_succ_time`,
  119. `logistics_no`,
  120. `customs_start_time`,
  121. `customs_succ_time`,
  122. `invt_no`,
  123. `is_customs_send`,
  124. `shipment_start_time`,
  125. `shipment_succ_time`,
  126. `process_content`,
  127. `customs_send_sms_status`,
  128. `tstm`
  129. from mall_order_process_record
  130. WHERE 1=1
  131. <if test="name != null and name.trim() != ''">
  132. AND name LIKE concat('%',#{name},'%')
  133. </if>
  134. <choose>
  135. <when test="sidx != null and sidx.trim() != ''">
  136. order by ${sidx} ${order}
  137. </when>
  138. <otherwise>
  139. order by id desc
  140. </otherwise>
  141. </choose>
  142. <if test="offset != null and limit != null">
  143. limit #{offset}, #{limit}
  144. </if>
  145. </select>
  146. <select id="queryTotal" resultType="int">
  147. select count(*) from mall_order_process_record
  148. WHERE 1=1
  149. <if test="name != null and name.trim() != ''">
  150. AND name LIKE concat('%',#{name},'%')
  151. </if>
  152. </select>
  153. <select id="queryListBySendSmsStatus" resultType="com.kmall.admin.entity.OrderProcessRecordEntity">
  154. select
  155. r.`id`,
  156. r.`order_sn`,
  157. r.`user_id`,
  158. r.`order_biz_type`,
  159. `add_order_start_time`,
  160. `add_order_succ_time`,
  161. `is_add_order_send`,
  162. `pay_start_time`,
  163. `pay_succ_time`,
  164. `payment_start_time`,
  165. `payment_succ_time`,
  166. `is_payment_send`,
  167. `ele_order_start_time`,
  168. `ele_order_succ_time`,
  169. `is_ele_order_send`,
  170. `waybill_start_time`,
  171. `waybill_succ_time`,
  172. `logistics_no`,
  173. `customs_start_time`,
  174. `customs_succ_time`,
  175. `invt_no`,
  176. `is_customs_send`,
  177. `shipment_start_time`,
  178. `shipment_succ_time`,
  179. `process_content`,
  180. r.`tstm`,
  181. o.ali_trade_no as pay_transaction_id,
  182. o.pay_mobile as payMobile,
  183. r.customs_send_sms_status as customsSendSmsStatus
  184. from mall_order_process_record r inner join mall_order o on r.order_sn = o.order_sn
  185. where r.is_customs_send='1' and r.customs_send_sms_status=#{customsSendSmsStatus}
  186. </select>
  187. <insert id="save" parameterType="com.kmall.admin.entity.OrderProcessRecordEntity" useGeneratedKeys="true" keyProperty="id">
  188. insert into mall_order_process_record(
  189. `order_sn`,
  190. `user_id`,
  191. `order_biz_type`,
  192. `add_order_start_time`,
  193. `add_order_succ_time`,
  194. `is_add_order_send`,
  195. `pay_start_time`,
  196. `pay_succ_time`,
  197. `payment_start_time`,
  198. `payment_succ_time`,
  199. `is_payment_send`,
  200. `ele_order_start_time`,
  201. `ele_order_succ_time`,
  202. `is_ele_order_send`,
  203. `waybill_start_time`,
  204. `waybill_succ_time`,
  205. `logistics_no`,
  206. `customs_start_time`,
  207. `customs_succ_time`,
  208. `invt_no`,
  209. `is_customs_send`,
  210. `shipment_start_time`,
  211. `shipment_succ_time`,
  212. `process_content`,
  213. `customs_send_sms_status`,
  214. `tstm`)
  215. values(
  216. #{orderSn},
  217. #{userId},
  218. #{orderBizType},
  219. #{addOrderStartTime},
  220. #{addOrderSuccTime},
  221. #{isAddOrderSend},
  222. #{payStartTime},
  223. #{paySuccTime},
  224. #{paymentStartTime},
  225. #{paymentSuccTime},
  226. #{isPaymentSend},
  227. #{eleOrderStartTime},
  228. #{eleOrderSuccTime},
  229. #{isEleOrderSend},
  230. #{waybillStartTime},
  231. #{waybillSuccTime},
  232. #{logisticsNo},
  233. #{customsStartTime},
  234. #{customsSuccTime},
  235. #{invtNo},
  236. #{isCustomsSend},
  237. #{shipmentStartTime},
  238. #{shipmentSuccTime},
  239. #{processContent},
  240. '0',
  241. #{tstm})
  242. </insert>
  243. <update id="update" parameterType="com.kmall.admin.entity.OrderProcessRecordEntity">
  244. update mall_order_process_record
  245. <set>
  246. <if test="orderSn != null">`order_sn` = #{orderSn}, </if>
  247. <if test="userId != null">`user_id` = #{userId}, </if>
  248. <if test="orderBizType != null">`order_biz_type` = #{orderBizType}, </if>
  249. <if test="addOrderStartTime != null">`add_order_start_time` = #{addOrderStartTime}, </if>
  250. <if test="addOrderSuccTime != null">`add_order_succ_time` = #{addOrderSuccTime}, </if>
  251. <if test="isAddOrderSend != null">`is_add_order_send` = #{isAddOrderSend}, </if>
  252. <if test="payStartTime != null">`pay_start_time` = #{payStartTime}, </if>
  253. <if test="paySuccTime != null">`pay_succ_time` = #{paySuccTime}, </if>
  254. <if test="paymentStartTime != null">`payment_start_time` = #{paymentStartTime}, </if>
  255. <if test="paymentSuccTime != null">`payment_succ_time` = #{paymentSuccTime}, </if>
  256. <if test="isPaymentSend != null">`is_payment_send` = #{isPaymentSend}, </if>
  257. <if test="eleOrderStartTime != null">`ele_order_start_time` = #{eleOrderStartTime}, </if>
  258. <if test="eleOrderSuccTime != null">`ele_order_succ_time` = #{eleOrderSuccTime}, </if>
  259. <if test="isEleOrderSend != null">`is_ele_order_send` = #{isEleOrderSend}, </if>
  260. <if test="waybillStartTime != null">`waybill_start_time` = #{waybillStartTime}, </if>
  261. <if test="waybillSuccTime != null">`waybill_succ_time` = #{waybillSuccTime}, </if>
  262. <if test="logisticsNo != null">`logistics_no` = #{logisticsNo}, </if>
  263. <if test="customsStartTime != null">`customs_start_time` = #{customsStartTime}, </if>
  264. <if test="customsSuccTime != null">`customs_succ_time` = #{customsSuccTime}, </if>
  265. <if test="invtNo != null">`invt_no` = #{invtNo}, </if>
  266. <if test="isCustomsSend != null">`is_customs_send` = #{isCustomsSend}, </if>
  267. <if test="shipmentStartTime != null">`shipment_start_time` = #{shipmentStartTime}, </if>
  268. <if test="shipmentSuccTime != null">`shipment_succ_time` = #{shipmentSuccTime}, </if>
  269. <if test="processContent != null">`process_content` = #{processContent}, </if>
  270. <if test="customsSendSmsStatus != null">`customs_send_sms_status` = #{customsSendSmsStatus}, </if>
  271. <if test="tstm != null">`tstm` = #{tstm}</if>
  272. </set>
  273. where id = #{id}
  274. </update>
  275. <delete id="delete">
  276. delete from mall_order_process_record where id = #{value}
  277. </delete>
  278. <delete id="deleteBatch">
  279. delete from mall_order_process_record where id in
  280. <foreach item="id" collection="array" open="(" separator="," close=")">
  281. #{id}
  282. </foreach>
  283. </delete>
  284. <select id="queryHkOrderTotal" parameterType="java.util.List" resultType="java.lang.Integer">
  285. select
  286. count(*)
  287. from mall_order_process_record
  288. where
  289. <if test="list != null">
  290. order_sn in
  291. <foreach collection="list" item="item" open="(" separator="," close=")">
  292. #{item.orderSn}
  293. </foreach>
  294. </if>
  295. </select>
  296. <update id="updateHkNoticeMsg" parameterType="java.util.List">
  297. update mall_order_process_record
  298. <trim prefix="set" suffixOverrides=",">
  299. <trim prefix="logistics_no =case" suffix="end,">
  300. <foreach collection="list" item="item" index="index">
  301. <if test="item.logisticsNo!=null">
  302. when order_sn=#{item.orderSn}
  303. then #{item.logisticsNo}
  304. </if>
  305. <if test="item.logisticsNo==null">
  306. when order_sn=#{item.orderSn}
  307. then mall_order_process_record.logistics_no
  308. </if>
  309. </foreach>
  310. </trim>
  311. <trim prefix="shipping_code =case" suffix="end,">
  312. <foreach collection="list" item="item" index="index">
  313. <if test="item.shippingCode!=null">
  314. when order_sn=#{item.orderSn}
  315. then #{item.shippingCode}
  316. </if>
  317. <if test="item.shippingCode==null">
  318. when order_sn=#{item.orderSn}
  319. then mall_order_process_record.shipping_code
  320. </if>
  321. </foreach>
  322. </trim>
  323. <trim prefix="shipping_name =case" suffix="end,">
  324. <foreach collection="list" item="item" index="index">
  325. <if test="item.shippingName!=null">
  326. when order_sn=#{item.orderSn}
  327. then #{item.shippingName}
  328. </if>
  329. <if test="item.shippingName==null">
  330. when order_sn=#{item.orderSn}
  331. then mall_order_process_record.shipping_name
  332. </if>
  333. </foreach>
  334. </trim>
  335. <trim prefix="waybill_succ_time =case" suffix="end,">
  336. <foreach collection="list" item="item" index="index">
  337. <if test="item.ewbStartTime!=null">
  338. when order_sn=#{item.orderSn}
  339. then #{item.ewbStartTime}
  340. </if>
  341. <if test="item.ewbStartTime==null">
  342. when order_sn=#{item.orderSn}
  343. then mall_order_process_record.waybill_succ_time
  344. </if>
  345. </foreach>
  346. </trim>
  347. <trim prefix="invt_no =case" suffix="end,">
  348. <foreach collection="list" item="item" index="index">
  349. <if test="item.clearNo!=null">
  350. when order_sn=#{item.orderSn}
  351. then #{item.clearNo}
  352. </if>
  353. <if test="item.clearNo==null">
  354. when order_sn=#{item.orderSn}
  355. then mall_order_process_record.invt_no
  356. </if>
  357. </foreach>
  358. </trim>
  359. <trim prefix="is_customs_send =case" suffix="end,">
  360. <foreach collection="list" item="item" index="index">
  361. <if test="item.clearType!=null">
  362. when order_sn=#{item.orderSn}
  363. then #{item.clearType}
  364. </if>
  365. <if test="item.clearType==null">
  366. when order_sn=#{item.orderSn}
  367. then mall_order_process_record.is_customs_send
  368. </if>
  369. </foreach>
  370. </trim>
  371. <trim prefix="customs_succ_time =case" suffix="end,">
  372. <foreach collection="list" item="item" index="index">
  373. <if test="item.customsSuccTime!=null">
  374. when order_sn=#{item.orderSn}
  375. then #{item.customsSuccTime}
  376. </if>
  377. <if test="item.customsSuccTime==null">
  378. when order_sn=#{item.orderSn}
  379. then mall_order_process_record.customs_succ_time
  380. </if>
  381. </foreach>
  382. </trim>
  383. <trim prefix="customs_msg =case" suffix="end,">
  384. <foreach collection="list" item="item" index="index">
  385. <if test="item.clearMsg!=null">
  386. when order_sn=#{item.orderSn}
  387. then #{item.clearMsg}
  388. </if>
  389. <if test="item.clearMsg==null">
  390. when order_sn=#{item.orderSn}
  391. then mall_order_process_record.customs_msg
  392. </if>
  393. </foreach>
  394. </trim>
  395. </trim>
  396. where order_sn in
  397. <foreach collection="list" item="item" index="index" separator="," open="(" close=")">
  398. #{item.orderSn}
  399. </foreach>
  400. </update>
  401. <!-- <update id="updateHkNoticeMsg" parameterType="java.util.List">-->
  402. <!-- <foreach collection="list" item="item" index="index" open="" close="" separator=";">-->
  403. <!-- update mall_order_process_record-->
  404. <!-- <set>-->
  405. <!-- <if test="item.ewbStartTime != null">`waybill_succ_time` = #{item.ewbStartTime}, </if>-->
  406. <!-- <if test="item.logisticsNo != null">`logistics_no` = #{item.logisticsNo}, </if>-->
  407. <!-- <if test="item.customsSuccTime != null">`customs_succ_time` = #{item.customsSuccTime}, </if>-->
  408. <!-- <if test="item.invtNo != null">`invt_no` = #{item.invtNo}, </if>-->
  409. <!-- <if test="item.clearType != null">`is_customs_send` = #{item.clearType}, </if>-->
  410. <!-- </set>-->
  411. <!-- where order_sn = ${item.orderSn}-->
  412. <!-- </foreach>-->
  413. <!-- </update>-->
  414. <update id="updateHkNoticeMsgMallOrder" parameterType="java.util.List">
  415. update mall_order
  416. <trim prefix="set" suffixOverrides=",">
  417. <trim prefix="shipping_no =case" suffix="end,">
  418. <foreach collection="list" item="item" index="index">
  419. <if test="item.logisticsNo!=null">
  420. when order_sn=#{item.orderSn}
  421. then #{item.logisticsNo}
  422. </if>
  423. <if test="item.logisticsNo==null">
  424. when order_sn=#{item.orderSn}
  425. then mall_order.shipping_no
  426. </if>
  427. </foreach>
  428. </trim>
  429. <trim prefix="order_status =case" suffix="end,">
  430. <foreach collection="list" item="item" index="index">
  431. <if test="item.logisticsNo!=null">
  432. when order_sn=#{item.orderSn}
  433. then '300'
  434. </if>
  435. <if test="item.logisticsNo==null">
  436. when order_sn=#{item.orderSn}
  437. then mall_order.order_status
  438. </if>
  439. </foreach>
  440. </trim>
  441. <trim prefix="shipping_code =case" suffix="end,">
  442. <foreach collection="list" item="item" index="index">
  443. <if test="item.shippingCode!=null">
  444. when order_sn=#{item.orderSn}
  445. then #{item.shippingCode}
  446. </if>
  447. <if test="item.shippingCode==null">
  448. when order_sn=#{item.orderSn}
  449. then mall_order.shipping_code
  450. </if>
  451. </foreach>
  452. </trim>
  453. <trim prefix="shipping_name =case" suffix="end,">
  454. <foreach collection="list" item="item" index="index">
  455. <if test="item.shippingName!=null">
  456. when order_sn=#{item.orderSn}
  457. then #{item.shippingName}
  458. </if>
  459. <if test="item.shippingName==null">
  460. when order_sn=#{item.orderSn}
  461. then mall_order.shipping_name
  462. </if>
  463. </foreach>
  464. </trim>
  465. </trim>
  466. where order_sn in
  467. <foreach collection="list" item="item" index="index" separator="," open="(" close=")">
  468. #{item.orderSn}
  469. </foreach>
  470. </update>
  471. <update id="updateMallOrderProcessRecord" parameterType="hashMap">
  472. update mall_order_process_record
  473. <set >
  474. <if test="paymentStartTime != null">
  475. payment_start_time = #{paymentStartTime},
  476. </if>
  477. <if test="paymentSuccTime != null">
  478. payment_succ_time = #{paymentSuccTime}, </if>
  479. <if test="isPaymentSend != null" >
  480. is_payment_send = #{isPaymentSend,jdbcType=VARCHAR},
  481. </if>
  482. <if test="eleOrderStartTime != null" >
  483. ele_order_start_time = #{eleOrderStartTime,jdbcType=VARCHAR},
  484. </if>
  485. <if test="eleOrderSuccTime != null" >
  486. ele_order_succ_time = #{eleOrderSuccTime,jdbcType=VARCHAR},
  487. </if>
  488. <if test="isEleOrderSend != null" >
  489. is_ele_order_send = #{isEleOrderSend,jdbcType=VARCHAR},
  490. </if>
  491. <if test="waybillStartTime != null" >
  492. waybill_start_time = #{waybillStartTime,jdbcType=VARCHAR},
  493. </if>
  494. <if test="waybillSuccTime != null" >
  495. waybill_succ_time = #{waybillSuccTime,jdbcType=VARCHAR},
  496. </if>
  497. <if test="customsStartTime != null" >
  498. customs_start_time = #{customsStartTime,jdbcType=VARCHAR},
  499. </if>
  500. <if test="customsSuccTime != null" >
  501. customs_succ_time = #{customsSuccTime,jdbcType=VARCHAR},
  502. </if>
  503. <if test="isCustomsSend != null" >
  504. is_customs_send = #{isCustomsSend,jdbcType=TIMESTAMP},
  505. </if>
  506. <if test="shipmentStartTime != null" >
  507. shipment_start_time = #{shipmentStartTime,jdbcType=VARCHAR},
  508. </if>
  509. <if test="shipmentSuccTime != null" >
  510. shipment_succ_time = #{shipmentSuccTime,jdbcType=VARCHAR},
  511. </if>
  512. <if test="logisticsNo != null">
  513. logistics_no = #{logisticsNo},
  514. </if>
  515. <if test="invtNo != null">
  516. invt_no = #{invtNo},
  517. </if>
  518. <if test="clearMsg != null">
  519. customs_msg = #{clearMsg},
  520. </if>
  521. </set>
  522. where order_sn = #{orderSn,jdbcType=VARCHAR}
  523. </update>
  524. </mapper>