OrderDao.xml 26 KB

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