OrderDao.xml 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663
  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.OrderDao">
  4. <!-- 可根据自己的需求,是否要使用 -->
  5. <resultMap type="com.kmall.admin.entity.OrderEntity" id="orderMap">
  6. <result property="id" column="id"/>
  7. <result property="merchOrderSn" column="merch_order_sn"/>
  8. <result property="orderSn" column="order_sn"/>
  9. <result property="userId" column="user_id"/>
  10. <result property="orderStatus" column="order_status"/>
  11. <result property="shippingStatus" column="shipping_status"/>
  12. <result property="payStatus" column="pay_status"/>
  13. <result property="consignee" column="consignee"/>
  14. <result property="country" column="country"/>
  15. <result property="province" column="province"/>
  16. <result property="city" column="city"/>
  17. <result property="district" column="district"/>
  18. <result property="address" column="address"/>
  19. <result property="mobile" column="mobile"/>
  20. <result property="postscript" column="postscript"/>
  21. <result property="shippingId" column="shipping_id"/>
  22. <result property="shippingName" column="shipping_name"/>
  23. <result property="shippingCode" column="shipping_code"/>
  24. <result property="shippingNo" column="shipping_no"/>
  25. <result property="payId" column="pay_id"/>
  26. <result property="payName" column="pay_name"/>
  27. <result property="shippingFee" column="shipping_fee"/>
  28. <result property="actualPrice" column="actual_price"/>
  29. <result property="integral" column="integral"/>
  30. <result property="integralMoney" column="integral_money"/>
  31. <result property="orderPrice" column="order_price"/>
  32. <result property="goodsPrice" column="goods_price"/>
  33. <result property="addTime" column="add_time"/>
  34. <result property="confirmTime" column="confirm_time"/>
  35. <result property="payTime" column="pay_time"/>
  36. <result property="freightPrice" column="freight_price"/>
  37. <result property="couponId" column="coupon_id"/>
  38. <result property="couponPrice" column="coupon_price"/>
  39. <result property="callbackStatus" column="callback_status"/>
  40. <result property="orderType" column="order_type"/>
  41. <result property="storeId" column="store_id"/>
  42. <result property="userName" column="username"/>
  43. <result property="orderType" column="order_type"/>
  44. <result property="activityId" column="activity_id"/>
  45. <result property="deliveryDate" column="delivery_date"/>
  46. <result property="deliveryRemark" column="delivery_remark"/>
  47. <result property="predictTime" column="predict_time"/>
  48. <result property="orderBizType" column="order_biz_type"/>
  49. <result property="isPaymentSend" column="is_payment_send"/>
  50. <result property="isEleOrderSend" column="is_ele_order_send"/>
  51. <result property="isCustomsSend" column="is_customs_send"/>
  52. <result property="payFlag" column="pay_flag"/>
  53. <result column="buyer_pay_check" property="buyerPayCheck"/>
  54. <result property="merchSn" column="merch_sn"/>
  55. <result property="sku" column="sku"/>
  56. <result property="createTime" column="create_time"/>
  57. <result property="modTime" column="mod_time"/>
  58. <result property="isOnfflineOrder" column="is_onffline_order"/>
  59. <result property="orderSnWx" column="order_sn_wx"/>
  60. <result property="isMergePay" column="is_merge_pay"/>
  61. <result property="payTransactionId" column="pay_transaction_id"/>
  62. <result property="storeName" column="store_name"/>
  63. <result property="moderSn" column="moder_sn"/>
  64. <result property="unitCode" column="unit_code"/>
  65. <result property="ciqProdModel" column="ciq_prod_model"/>
  66. <result property="oriCntCode" column="ori_cnt_code"/>
  67. <result property="brand" column="brand"/>
  68. <result column="gross_weight" property="grossWeight" />
  69. <result column="net_weight" property="netWeight" />
  70. </resultMap>
  71. <select id="queryObject" resultType="com.kmall.admin.entity.OrderEntity">
  72. select o.*,u.username as username
  73. from mall_order o
  74. left join mall_user u on o.user_id = u.id
  75. where o.id = #{value}
  76. </select>
  77. <select id="queryObjectBySysUser" resultType="com.kmall.admin.entity.OrderEntity">
  78. select o.*,u.username as username
  79. from mall_order o
  80. left join sys_user u on o.user_id = u.user_id
  81. where o.id = #{value}
  82. </select>
  83. <select id="queryObjectByActivityId" resultType="com.kmall.admin.entity.OrderEntity">
  84. select o.*,u.username as username
  85. from mall_order o
  86. left join mall_user u on o.user_id = u.id
  87. where o.activity_id = #{activityId} and o.order_type = #{orderType}
  88. </select>
  89. <select id="getTotalActualPrice" resultType="java.lang.Double">
  90. select sum(a.actual_price) 'totalActualPrice' from mall_order a where merch_order_sn = #{merchOrderSn}
  91. </select>
  92. <select id="queryObjectByMerchOrderSn" resultType="com.kmall.admin.entity.OrderEntity">
  93. select * from mall_order a where merch_order_sn = #{merchOrderSn}
  94. </select>
  95. <select id="queryObjectByOrderSn" resultType="com.kmall.admin.entity.OrderEntity">
  96. select * from mall_order a where order_sn = #{orderSn}
  97. </select>
  98. <select id="queryList" resultType="com.kmall.admin.entity.OrderEntity">
  99. SELECT
  100. o.order_sn,
  101. o.merch_order_sn,
  102. o.order_status,
  103. o.actual_price,
  104. o.order_biz_type,
  105. o.shipping_no,
  106. o.shipping_name,
  107. o.shipping_code,
  108. o.consignee,
  109. o.mobile,
  110. o.province,
  111. o.city,
  112. o.district,
  113. o.address,
  114. o.add_time,
  115. o.pay_id,
  116. o.pay_status,
  117. o.shipping_status,
  118. o.is_merge_pay,
  119. o.buyer_pay_check,
  120. o.order_price,
  121. o.moder_sn,
  122. o.id,
  123. u.username AS username,
  124. p.is_payment_send,
  125. p.is_ele_order_send,
  126. p.is_customs_send,
  127. s.store_name
  128. FROM
  129. mall_order o
  130. LEFT JOIN mall_user u ON o.user_id = u.id
  131. LEFT JOIN mall_order_process_record p ON o.order_sn = p.order_sn
  132. left join mall_store s on o.store_id = s.id
  133. WHERE 1=1
  134. <if test="startTime != null and startTime != ''">
  135. AND o.add_time <![CDATA[ > ]]> #{startTime}
  136. </if>
  137. <if test="endTime != null and endTime != ''">
  138. AND o.add_time <![CDATA[ < ]]> #{endTime}
  139. </if>
  140. <if test="storeId != null and storeId != ''">
  141. AND o.store_id = #{storeId}
  142. </if>
  143. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  144. AND s.third_party_merch_code = #{thirdPartyMerchCode}
  145. </if>
  146. <if test="orderBizType != null and orderBizType != ''">
  147. AND o.order_biz_type = #{orderBizType}
  148. </if>
  149. <if test="merchOrderSn != null and merchOrderSn.trim() != ''">
  150. AND o.merch_order_sn = #{merchOrderSn}
  151. </if>
  152. <if test="merchSn != null and merchSn.trim() != ''">
  153. AND o.merch_sn = #{merchSn}
  154. </if>
  155. <if test="orderSn != null and orderSn.trim() != ''">
  156. AND o.order_sn LIKE concat('%',#{orderSn},'%')
  157. </if>
  158. <if test="shippingStatus != null and shippingStatus.trim() != ''">
  159. AND o.shipping_status = #{shippingStatus}
  160. </if>
  161. <if test="payStatus != null and payStatus.trim() != ''">
  162. AND o.pay_status = #{payStatus}
  163. </if>
  164. <if test="orderStatus != null and orderStatus.trim() != ''">
  165. AND o.order_status = #{orderStatus}
  166. </if>
  167. <if test="shippingId != null and shippingId != 0">
  168. AND o.shipping_id = #{shippingId}
  169. </if>
  170. <if test="orderType != null and orderType.trim() != ''">
  171. AND o.order_type = #{orderType}
  172. </if>
  173. <if test="isOnfiilineOrder != null">
  174. AND o.is_onffline_order = #{isOnfiilineOrder}
  175. </if>
  176. <if test="ids != null and ids.trim() != ''">
  177. AND o.id in (${ids})
  178. </if>
  179. <choose>
  180. <when test="sidx != null and sidx.trim() != ''">
  181. order by ${sidx} ${order}
  182. </when>
  183. <otherwise>
  184. order by o.id desc
  185. </otherwise>
  186. </choose>
  187. <if test="offset != null and limit != null">
  188. limit #{offset}, #{limit}
  189. </if>
  190. </select>
  191. <select id="queryExportList" resultType="com.kmall.admin.entity.OrderEntity">
  192. SELECT
  193. o.order_sn,
  194. o.merch_order_sn,
  195. o.order_status,
  196. o.actual_price,
  197. o.order_biz_type,
  198. o.shipping_no,
  199. o.shipping_name,
  200. o.shipping_code,
  201. o.consignee,
  202. o.mobile,
  203. o.province,
  204. o.city,
  205. o.district,
  206. o.address,
  207. o.add_time,
  208. o.pay_id,
  209. o.pay_transaction_id,
  210. u.id_no 'idNo',
  211. u.username AS username,
  212. p.is_payment_send,
  213. p.is_ele_order_send,
  214. p.is_customs_send,
  215. g.sku,
  216. g.goods_name,
  217. g.number,
  218. g.retail_price,
  219. s.store_name,
  220. nc.NAME ori_cnt_code,
  221. good.ciq_prod_model,
  222. good.brand,
  223. uc.NAME unit_code,
  224. good.gross_weight * g.number gross_weight,
  225. good.net_weight * g.number net_weight
  226. FROM
  227. mall_order o
  228. LEFT JOIN mall_user u ON o.user_id = u.id
  229. LEFT JOIN mall_order_process_record p ON o.order_sn = p.order_sn
  230. LEFT JOIN mall_order_goods g ON o.id = g.order_id
  231. LEFT JOIN mall_store s ON o.store_id = s.id
  232. LEFT JOIN mall_goods good ON good.id = g.goods_id
  233. LEFT JOIN sys_cus_nation_code nc ON nc.CODE = good.ori_cnt_code
  234. LEFT JOIN sys_cus_unit_code uc ON uc.CODE = good.unit_code
  235. WHERE
  236. 1 =1
  237. <if test="startTime != null and startTime != ''">
  238. AND o.add_time <![CDATA[ > ]]> #{startTime}
  239. </if>
  240. <if test="endTime != null and endTime != ''">
  241. AND o.add_time <![CDATA[ < ]]> #{endTime}
  242. </if>
  243. <if test="storeId != null and storeId != ''">
  244. AND o.store_id = #{storeId}
  245. </if>
  246. <if test="orderBizType != null and orderBizType != ''">
  247. AND o.order_biz_type = #{orderBizType}
  248. </if>
  249. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  250. AND s.third_party_merch_code = #{thirdPartyMerchCode}
  251. </if>
  252. <if test="merchOrderSn != null and merchOrderSn.trim() != ''">
  253. AND o.merch_order_sn = #{merchOrderSn}
  254. </if>
  255. <if test="merchSn != null and merchSn.trim() != ''">
  256. AND o.merch_sn = #{merchSn}
  257. </if>
  258. <if test="orderSn != null and orderSn.trim() != ''">
  259. AND o.order_sn LIKE concat('%',#{orderSn},'%')
  260. </if>
  261. <if test="shippingStatus != null and shippingStatus.trim() != ''">
  262. AND o.shipping_status = #{shippingStatus}
  263. </if>
  264. <if test="payStatus != null and payStatus.trim() != ''">
  265. AND o.pay_status = #{payStatus}
  266. </if>
  267. <if test="orderStatus != null and orderStatus.trim() != ''">
  268. AND o.order_status = #{orderStatus}
  269. </if>
  270. <if test="shippingId != null and shippingId != 0">
  271. AND o.shipping_id = #{shippingId}
  272. </if>
  273. <if test="orderType != null and orderType.trim() != ''">
  274. AND o.order_type = #{orderType}
  275. </if>
  276. <if test="isOnfiilineOrder != null">
  277. AND o.is_onffline_order = #{isOnfiilineOrder}
  278. </if>
  279. <if test="ids != null and ids.trim() != ''">
  280. AND o.id in (${ids})
  281. </if>
  282. <choose>
  283. <when test="sidx != null and sidx.trim() != ''">
  284. order by ${sidx} ${order}
  285. </when>
  286. <otherwise>
  287. order by o.id desc
  288. </otherwise>
  289. </choose>
  290. <if test="offset != null and limit != null">
  291. limit #{offset}, #{limit}
  292. </if>
  293. </select>
  294. <select id="queryTotal" resultType="int">
  295. select count(*) from mall_order o
  296. left join mall_store s on o.store_id = s.id WHERE 1=1
  297. <if test="startTime != null and startTime != ''">
  298. AND o.add_time <![CDATA[ > ]]> #{startTime}
  299. </if>
  300. <if test="endTime != null and endTime != ''">
  301. AND o.add_time <![CDATA[ < ]]> #{endTime}
  302. </if>
  303. <if test="storeId != null and storeId != ''">
  304. AND o.store_id = #{storeId}
  305. </if>
  306. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  307. AND s.third_party_merch_code = #{thirdPartyMerchCode}
  308. </if>
  309. <if test="orderBizType != null and orderBizType != ''">
  310. AND o.order_biz_type = #{orderBizType}
  311. </if>
  312. <if test="merchOrderSn != null and merchOrderSn.trim() != ''">
  313. AND o.merch_order_sn = #{merchOrderSn}
  314. </if>
  315. <if test="merchSn != null and merchSn.trim() != ''">
  316. AND o.merch_sn = #{merchSn}
  317. </if>
  318. <if test="orderSn != null and orderSn.trim() != ''">
  319. AND o.order_sn LIKE concat('%',#{orderSn},'%')
  320. </if>
  321. <if test="shippingStatus != null and shippingStatus.trim() != ''">
  322. AND o.shipping_status = #{shippingStatus}
  323. </if>
  324. <if test="payStatus != null and payStatus.trim() != ''">
  325. AND o.pay_status = #{payStatus}
  326. </if>
  327. <if test="orderStatus != null and orderStatus.trim() != ''">
  328. AND o.order_status = #{orderStatus}
  329. </if>
  330. <if test="shippingId != null and shippingId != 0">
  331. AND o.shipping_id = #{shippingId}
  332. </if>
  333. <if test="orderType != null and orderType.trim() != ''">
  334. AND o.order_type = #{orderType}
  335. </if>
  336. <if test="isOnfiilineOrder != null">
  337. AND o.is_onffline_order = #{isOnfiilineOrder}
  338. </if>
  339. <if test="ids != null and ids.trim() != ''">
  340. AND o.id in (${ids})
  341. </if>
  342. </select>
  343. <select id="queryOffilineOrderList" resultType="com.kmall.admin.entity.OrderEntity">
  344. SELECT
  345. o.*,
  346. u.username AS username,
  347. p.is_payment_send,
  348. p.is_ele_order_send,
  349. p.is_customs_send
  350. FROM
  351. mall_order o
  352. LEFT JOIN sys_user u ON o.user_id = u.user_id
  353. LEFT JOIN mall_order_process_record p ON o.order_sn = p.order_sn
  354. left join mall_store s on o.store_id = s.id
  355. WHERE 1=1
  356. <if test="storeId != null and storeId != ''">
  357. AND o.store_id = #{storeId}
  358. </if>
  359. <if test="merchSn != null and merchSn.trim() != ''">
  360. AND o.merch_sn = #{merchSn}
  361. </if>
  362. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  363. AND s.third_party_merch_code = #{thirdPartyMerchCode}
  364. </if>
  365. <if test="orderSn != null and orderSn.trim() != ''">
  366. AND o.order_sn LIKE concat('%',#{orderSn},'%')
  367. </if>
  368. <if test="shippingStatus != null and shippingStatus.trim() != ''">
  369. AND o.shipping_status = #{shippingStatus}
  370. </if>
  371. <if test="payStatus != null and payStatus.trim() != ''">
  372. AND o.pay_status = #{payStatus}
  373. </if>
  374. <if test="orderStatus != null and orderStatus.trim() != ''">
  375. AND o.order_status = #{orderStatus}
  376. </if>
  377. <if test="shippingId != null and shippingId != 0">
  378. AND o.shipping_id = #{shippingId}
  379. </if>
  380. <if test="orderType != null and orderType.trim() != ''">
  381. AND o.order_type = #{orderType}
  382. </if>
  383. <if test="isOnfiilineOrder != null">
  384. AND o.is_onffline_order = #{isOnfiilineOrder}
  385. </if>
  386. <if test="ids != null and ids.trim() != ''">
  387. AND o.id in (${ids})
  388. </if>
  389. <choose>
  390. <when test="sidx != null and sidx.trim() != ''">
  391. order by ${sidx} ${order}
  392. </when>
  393. <otherwise>
  394. order by id desc
  395. </otherwise>
  396. </choose>
  397. <if test="offset != null and limit != null">
  398. limit #{offset}, #{limit}
  399. </if>
  400. </select>
  401. <insert id="save" parameterType="com.kmall.admin.entity.OrderEntity" useGeneratedKeys="true" keyProperty="id">
  402. insert into mall_order
  403. (
  404. `order_sn`,
  405. `user_id`,
  406. `order_status`,
  407. `shipping_status`,
  408. `pay_status`,
  409. `consignee`,
  410. `country`,
  411. `province`,
  412. `city`,
  413. `district`,
  414. `address`,
  415. `mobile`,
  416. `postscript`,
  417. `shipping_id`,
  418. `shipping_name`,
  419. `shipping_code`,
  420. `shipping_no`,
  421. `pay_id`,
  422. `pay_name`,
  423. `shipping_fee`,
  424. `actual_price`,
  425. `integral`,
  426. `integral_money`,
  427. `order_price`,
  428. `goods_price`,
  429. `add_time`,
  430. `confirm_time`,
  431. `pay_time`,
  432. `freight_price`,
  433. `coupon_id`,
  434. `coupon_price`,
  435. `callback_status`,
  436. `order_type`,
  437. `store_id`,
  438. `order_biz_type`,
  439. `is_onffline_order`,
  440. `order_sn_wx`,
  441. `pay_flag`,
  442. `merch_sn`,
  443. `create_time`,
  444. `mod_time`
  445. )
  446. values
  447. (
  448. #{orderSn},
  449. #{userId},
  450. #{orderStatus},
  451. #{shippingStatus},
  452. #{payStatus},
  453. #{consignee},
  454. #{country},
  455. #{province},
  456. #{city},
  457. #{district},
  458. #{address},
  459. #{mobile},
  460. #{postscript},
  461. #{shippingId},
  462. #{shippingName},
  463. #{shippingCode},
  464. #{shippingNo},
  465. #{payId},
  466. #{payName},
  467. #{shippingFee},
  468. #{actualPrice},
  469. #{integral},
  470. #{integralMoney},
  471. #{orderPrice},
  472. #{goodsPrice},
  473. #{addTime},
  474. #{confirmTime},
  475. #{payTime},
  476. #{freightPrice},
  477. #{couponId},
  478. #{couponPrice},
  479. #{callbackStatus},
  480. #{orderType},
  481. #{storeId},
  482. #{orderBizType},
  483. #{isOnfflineOrder},
  484. #{orderSnWx},
  485. #{payFlag},
  486. #{merchSn},
  487. #{createTime},
  488. #{modTime}
  489. )
  490. </insert>
  491. <update id="update" parameterType="com.kmall.admin.entity.OrderEntity">
  492. update mall_order
  493. <set>
  494. <if test="orderSn != null">`order_sn` = #{orderSn},</if>
  495. <if test="userId != null">`user_id` = #{userId},</if>
  496. <if test="orderStatus != null">`order_status` = #{orderStatus},</if>
  497. <if test="shippingStatus != null">`shipping_status` = #{shippingStatus},</if>
  498. <if test="payStatus != null">`pay_status` = #{payStatus},</if>
  499. <if test="consignee != null">`consignee` = #{consignee},</if>
  500. <if test="country != null">`country` = #{country},</if>
  501. <if test="province != null">`province` = #{province},</if>
  502. <if test="city != null">`city` = #{city},</if>
  503. <if test="district != null">`district` = #{district},</if>
  504. <if test="address != null">`address` = #{address},</if>
  505. <if test="mobile != null">`mobile` = #{mobile},</if>
  506. <if test="postscript != null">`postscript` = #{postscript},</if>
  507. <if test="shippingId != null">`shipping_id` = #{shippingId},</if>
  508. <if test="shippingName != null">`shipping_name` = #{shippingName},</if>
  509. <if test="shippingCode != null">`shipping_code` = #{shippingCode},</if>
  510. <if test="shippingNo != null">`shipping_no` = #{shippingNo},</if>
  511. <if test="payId != null">`pay_id` = #{payId},</if>
  512. <if test="payName != null">`pay_name` = #{payName},</if>
  513. <if test="shippingFee != null">`shipping_fee` = #{shippingFee},</if>
  514. <if test="actualPrice != null">`actual_price` = #{actualPrice},</if>
  515. <if test="integral != null">`integral` = #{integral},</if>
  516. <if test="integralMoney != null">`integral_money` = #{integralMoney},</if>
  517. <if test="orderPrice != null">`order_price` = #{orderPrice},</if>
  518. <if test="goodsPrice != null">`goods_price` = #{goodsPrice},</if>
  519. <if test="addTime != null">`add_time` = #{addTime},</if>
  520. <if test="confirmTime != null">`confirm_time` = #{confirmTime},</if>
  521. <if test="payTime != null">`pay_time` = #{payTime},</if>
  522. <if test="freightPrice != null">`freight_price` = #{freightPrice},</if>
  523. <if test="couponId != null">`coupon_id` = #{couponId},</if>
  524. <if test="couponPrice != null">`coupon_price` = #{couponPrice},</if>
  525. <if test="callbackStatus != null">`callback_status` = #{callbackStatus},</if>
  526. <if test="orderType != null">`order_type` = #{orderType},</if>
  527. <if test="storeId != null">`store_id` = #{storeId},</if>
  528. <if test="payFlag != null">`pay_flag` = #{payFlag},</if>
  529. <if test="orderSnWx != null">`order_sn_wx` = #{orderSnWx},</if>
  530. <if test="orderBizType != null">`order_biz_type` = #{orderBizType},</if>
  531. <if test="merchSn != null">`merch_sn` = #{merchSn},</if>
  532. <if test="createTime != null">`create_time` = #{createTime},</if>
  533. <if test="modTime != null">`mod_time` = #{modTime},</if>
  534. <if test="createrSn != null">`creater_sn` = #{createrSn},</if>
  535. <if test="moderSn != null">`moder_sn` = #{moderSn},</if>
  536. </set>
  537. where id = #{id}
  538. </update>
  539. <delete id="delete">
  540. delete from mall_order where id = #{value}
  541. </delete>
  542. <delete id="deleteBatch">
  543. delete from mall_order where id in
  544. <foreach item="id" collection="array" open="(" separator="," close=")">
  545. #{id}
  546. </foreach>
  547. </delete>
  548. <update id="riderOrderUpdate" parameterType="com.kmall.admin.entity.OrderEntity">
  549. update mall_order
  550. <set>
  551. `order_status` = #{orderStatus},
  552. `shipping_status` = #{shippingStatus},
  553. `shipping_id` = #{shippingId},
  554. `shipping_name` = #{shippingName},
  555. `shipping_fee` = #{shippingFee},
  556. `shipping_no` = #{shippingNo},
  557. `shipping_mobile` = #{shippingMobile}
  558. </set>
  559. where id = #{id}
  560. </update>
  561. <select id="getYfkOrderUserSum" resultType="int">
  562. select count(1) from (select o.user_id,count(o.user_id) as counts from mall_order o
  563. inner join mall_merch_user mu on o.user_id=mu.user_id and o.merch_sn=mu.merch_sn and o.store_id=mu.store_id
  564. left join mall_store s on o.store_id = s.id
  565. where pay_status = 2
  566. <if test="storeId != null and storeId != ''">
  567. AND o.store_id = #{storeId}
  568. </if>
  569. <if test="merchSn != null and merchSn.trim() != ''">
  570. AND o.merch_sn = #{merchSn}
  571. </if>
  572. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  573. AND s.third_party_merch_code = #{thirdPartyMerchCode}
  574. </if>
  575. group by o.user_id) u
  576. </select>
  577. <select id="getOderUserSum" resultType="int">
  578. select count(1) from (select o.user_id,count(o.user_id) as counts from mall_order o
  579. inner join mall_merch_user mu on o.user_id=mu.user_id and o.merch_sn=mu.merch_sn and o.store_id=mu.store_id
  580. left join mall_store s on o.store_id = s.id
  581. where 1=1
  582. <if test="storeId != null and storeId != ''">
  583. AND o.store_id = #{storeId}
  584. </if>
  585. <if test="merchSn != null and merchSn.trim() != ''">
  586. AND o.merch_sn = #{merchSn}
  587. </if>
  588. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  589. AND s.third_party_merch_code = #{thirdPartyMerchCode}
  590. </if>
  591. group by o.user_id) u
  592. </select>
  593. <select id="getTodayUserOrder" resultType="int">
  594. select count(1) from mall_order o
  595. left join mall_store s on o.store_id = s.id
  596. where pay_status = 2 and pay_time > date_format(sysdate(), '%Y-%m-%d')
  597. <if test="storeId != null and storeId != ''">
  598. AND o.store_id = #{storeId}
  599. </if>
  600. <if test="merchSn != null and merchSn.trim() != ''">
  601. AND o.merch_sn = #{merchSn}
  602. </if>
  603. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  604. AND s.third_party_merch_code = #{thirdPartyMerchCode}
  605. </if>
  606. </select>
  607. <select id="getTodayUserSales" resultType="int">
  608. select ifnull(sum(o.actual_price),0) from mall_order o
  609. left join mall_store s on o.store_id = s.id where o.pay_status = 2 and o.pay_time > date_format(sysdate(), '%Y-%m-%d')
  610. <if test="storeId != null and storeId != ''">
  611. AND o.store_id = #{storeId}
  612. </if>
  613. <if test="merchSn != null and merchSn.trim() != ''">
  614. AND o.merch_sn = #{merchSn}
  615. </if>
  616. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  617. AND s.third_party_merch_code = #{thirdPartyMerchCode}
  618. </if>
  619. </select>
  620. <select id="getIncomeSum" resultType="int">
  621. select ifnull(sum(actual_price),0) from mall_order o
  622. left join mall_store s on o.store_id = s.id where o.pay_status = 2
  623. <if test="storeId != null and storeId != ''">
  624. AND o.store_id = #{storeId}
  625. </if>
  626. <if test="merchSn != null and merchSn.trim() != ''">
  627. AND o.merch_sn = #{merchSn}
  628. </if>
  629. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  630. AND s.third_party_merch_code = #{thirdPartyMerchCode}
  631. </if>
  632. </select>
  633. <select id="getPayedOrderCount" resultType="int">
  634. select count(1) from mall_order o
  635. left join mall_store s on o.store_id = s.id where o.pay_status = 2 and o.is_onffline_order = 0
  636. <if test="storeId != null and storeId != ''">
  637. AND o.store_id = #{storeId}
  638. </if>
  639. <if test="merchSn != null and merchSn.trim() != ''">
  640. AND o.merch_sn = #{merchSn}
  641. </if>
  642. <if test="thirdPartyMerchCode != null and thirdPartyMerchCode.trim() != ''">
  643. AND s.third_party_merch_code = #{thirdPartyMerchCode}
  644. </if>
  645. </select>
  646. </mapper>