OrderDao.xml 24 KB

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