OrderMapper.xml 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537
  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.sqx.modules.order.dao.AppOrderDao">
  4. <select id="selectOrderList" resultType="com.sqx.modules.order.entity.TbOrder">
  5. select tor.*, gs.shop_name as shopName, gs.detailed_address as detailedAddress, gs.shop_lng as shopLng,
  6. gs.shop_lat as shopLat, gs.phone as shopPhone,
  7. gs.errand_money as errandMoney, gs.exempt_min_money as exemptMinMoney, gs.minimum_delivery as minimumDelivery,
  8. gs.distribution_distance as distributionDistance
  9. from tb_order tor left join goods_shop gs on tor.shop_id = gs.shop_id
  10. where tor.user_id = #{userId}
  11. <if test="orderType!=null">
  12. and tor.order_type = #{orderType}
  13. </if>
  14. <if test="shopId!=null">
  15. and tor.shop_id = #{shopId}
  16. </if>
  17. <if test="status!=null">
  18. <if test="status == 0">
  19. and tor.status = 0
  20. </if>
  21. <if test="status == 1">
  22. and tor.status = 1
  23. </if>
  24. <if test="status == 2">
  25. and tor.status = 2
  26. </if>
  27. <if test="status == 3">
  28. and tor.status in (7, 6, 3, 4, 5, 8)
  29. </if>
  30. </if>
  31. </select>
  32. <insert id="insertOrder" parameterType="com.sqx.modules.order.entity.TbOrder" useGeneratedKeys="true"
  33. keyProperty="orderId">
  34. insert into tb_order (coupon_id, user_id, user_name, phone, address, order_number, is_pay, pay_time,
  35. order_code, order_type, pack_money, errand_money, status, delete_flag, parent_user_id,
  36. shop_id, parent_id, create_time)
  37. values (#{couponId}, #{userId}, #{userName}, #{phone}, #{address}, #{orderNumber}, #{isPay}, #{payTime},
  38. #{orderCode}, #{orderType}, #{packMoney}, #{errandMoney}, #{status}, #{deleteFlag}, #{parentUserId},
  39. #{shopId}, #{parentId}, #{createTime})
  40. </insert>
  41. <select id="selectOrder" resultType="com.sqx.modules.order.entity.TbOrder">
  42. select tor.*, tu.avatar as avatar, gs.shop_name as shopName, gs.detailed_address as detailedAddress, gs.phone as
  43. shopPhone,
  44. ti.rider_user_id as riderUserId, tcu.money as couponMoney
  45. from tb_order tor
  46. left join tb_user tu on tor.user_id = tu.user_id
  47. left join goods_shop gs on tor.shop_id = gs.shop_id
  48. left join tb_indent ti on tor.order_id = ti.order_id
  49. left join tb_coupon_user tcu on tor.coupon_id = tcu.id
  50. where 1 = 1 and tor.is_pay = 1
  51. <if test="shopName!=null and shopName!=''">
  52. and gs.shop_name like concat('%',#{shopName},'%')
  53. </if>
  54. <if test="userName!=null and userName!=''">
  55. and tor.user_name like concat('%',#{userName},'%')
  56. </if>
  57. <if test="phone!=null and phone!=''">
  58. and tor.phone like concat('%',#{phone},'%')
  59. </if>
  60. <if test="orderNumber!=null and orderNumber!=''">
  61. and tor.order_number = #{orderNumber}
  62. </if>
  63. <if test="status!=null and status!=5">
  64. and tor.status = #{status}
  65. </if>
  66. <if test="status!=null and status==5">
  67. and tor.status in (5, 8)
  68. </if>
  69. <if test="status==null">
  70. and tor.status in (7, 6, 3, 4, 5, 8)
  71. </if>
  72. <if test="shopId!=null">
  73. and tor.shop_id = #{shopId}
  74. </if>
  75. <if test="orderType!=null">
  76. and tor.order_type = #{orderType}
  77. </if>
  78. order by tor.pay_time desc, tor.create_time desc
  79. </select>
  80. <select id="selectAllOrderAdmin" resultType="com.sqx.modules.order.entity.TbOrder">
  81. select tor.*, tu.avatar as avatar, gs.shop_name as shopName, gs.detailed_address as detailedAddress, gs.phone as
  82. shopPhone,
  83. tiu.user_name as riderNickName,tiu.phone as riderPhone,ti.indent_id as indentId,ti.is_rider as isRider,
  84. ti.rider_user_id as riderUserId, tcu.money as couponMoney,
  85. apr.discount_amount as activityDiscountAmount, ai.title activityTitle
  86. from tb_order tor
  87. left join tb_user tu on tor.user_id = tu.user_id
  88. left join goods_shop gs on tor.shop_id = gs.shop_id
  89. left join tb_indent ti on tor.order_id = ti.order_id
  90. left join tb_user tiu on tiu.user_id = ti.rider_user_id
  91. left join tb_coupon_user tcu on tor.coupon_id = tcu.id
  92. left join activity_part_record apr on apr.order_id = tor.order_id
  93. left join activity ai on ai.id = apr.activity_id
  94. where 1 = 1
  95. <if test="riderPhone!=null and riderPhone!=''">
  96. and tiu.phone =#{riderPhone}
  97. </if>
  98. <if test="shopName!=null and shopName!=''">
  99. and gs.shop_name like concat('%',#{shopName},'%')
  100. </if>
  101. <if test="userName!=null and userName!=''">
  102. and tor.user_name like concat('%',#{userName},'%')
  103. </if>
  104. <if test="phone!=null and phone!=''">
  105. and tor.phone like concat('%',#{phone},'%')
  106. </if>
  107. <if test="orderNumber!=null and orderNumber!=''">
  108. and tor.order_number = #{orderNumber}
  109. </if>
  110. <if test="status!=null and status!=-1 and status!=1">
  111. and tor.status = #{status}
  112. </if>
  113. <if test="status!=null and status==1">
  114. and tor.status in (1,2)
  115. </if>
  116. <if test="shopId!=null">
  117. and tor.shop_id = #{shopId}
  118. </if>
  119. <if test="orderType!=null">
  120. and tor.order_type_extra = #{orderType}
  121. </if>
  122. <if test="indentStatus != null and indentStatus != ''">
  123. and ti.indent_state = #{indentStatus}
  124. </if>
  125. <if test="reservationFlag != null and reservationFlag !=''">
  126. and tor.reservation_flag = #{reservationFlag}
  127. </if>
  128. <if test="startTime!=null and startTime!=''">
  129. and date_format(tor.create_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')
  130. </if>
  131. <if test="endTime!=null and endTime!='' ">
  132. and date_format(tor.create_time,'%Y-%m-%d') &lt;= date_format(#{endTime},'%Y-%m-%d')
  133. </if>
  134. <if test="payStartTime != null and payStartTime != ''">
  135. and date_format(tor.pay_time,'%Y-%m-%d') >= date_format(#{payStartTime},'%Y-%m-%d')
  136. </if>
  137. <if test="payEndTime != null and payEndTime != '' ">
  138. and date_format(tor.pay_time,'%Y-%m-%d') &lt;= date_format(#{payEndTime},'%Y-%m-%d')
  139. </if>
  140. order by tor.pay_time desc, tor.create_time desc
  141. </select>
  142. <select id="excelAllOrderAdmin" resultType="com.sqx.modules.order.entity.TbOrder">
  143. select tor.*, tu.avatar as avatar, gs.shop_name as shopName, gs.detailed_address as detailedAddress, gs.phone as
  144. shopPhone,
  145. tiu.nick_name as riderNickName,tiu.phone as riderPhone,ti.indent_id as indentId,ti.is_rider as isRider,
  146. ti.rider_user_id as riderUserId, tcu.money as couponMoney,
  147. apr.discount_amount as activityDiscountAmount, ai.title activityTitle,ogg.detail,ogg.sumPrice
  148. from tb_order tor
  149. left join tb_user tu on tor.user_id = tu.user_id
  150. left join goods_shop gs on tor.shop_id = gs.shop_id
  151. left join tb_indent ti on tor.order_id = ti.order_id
  152. left join tb_user tiu on tiu.user_id = ti.rider_user_id
  153. left join tb_coupon_user tcu on tor.coupon_id = tcu.id
  154. left join activity_part_record apr on apr.order_id = tor.order_id
  155. left join activity ai on ai.id = apr.activity_id
  156. left join ( select @a:=0,order_id ,group_concat(@a:=@a+1,".商品名:",goods_name,",数量:",goods_num,",规格:",sku_message) detail,sum(goods_num*goods_price) sumPrice from order_goods og group by order_id
  157. ) ogg on ogg.order_id =tor.order_id
  158. where 1 = 1
  159. <if test="riderPhone!=null and riderPhone!=''">
  160. and tiu.phone =#{riderPhone}
  161. </if>
  162. <if test="shopName!=null and shopName!=''">
  163. and gs.shop_name like concat('%',#{shopName},'%')
  164. </if>
  165. <if test="userName!=null and userName!=''">
  166. and tor.user_name like concat('%',#{userName},'%')
  167. </if>
  168. <if test="phone!=null and phone!=''">
  169. and tor.phone like concat('%',#{phone},'%')
  170. </if>
  171. <if test="orderNumber!=null and orderNumber!=''">
  172. and tor.order_number = #{orderNumber}
  173. </if>
  174. <if test="status!=null and status!=-1 and status!=1">
  175. and tor.status = #{status}
  176. </if>
  177. <if test="status!=null and status==1">
  178. and tor.status in (1,2)
  179. </if>
  180. <if test="shopId!=null">
  181. and tor.shop_id = #{shopId}
  182. </if>
  183. <if test="orderType!=null">
  184. and tor.order_type_extra = #{orderType}
  185. </if>
  186. <if test="startTime!=null and startTime!=''">
  187. and date_format(tor.create_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')
  188. </if>
  189. <if test="endTime!=null and endTime!='' ">
  190. and date_format(tor.create_time,'%Y-%m-%d') &lt;= date_format(#{endTime},'%Y-%m-%d')
  191. </if>
  192. <if test="payStartTime != null and payStartTime != ''">
  193. and date_format(tor.pay_time,'%Y-%m-%d') >= date_format(#{payStartTime},'%Y-%m-%d')
  194. </if>
  195. <if test="payEndTime != null and payEndTime != '' ">
  196. and date_format(tor.pay_time,'%Y-%m-%d') &lt;= date_format(#{payEndTime},'%Y-%m-%d')
  197. </if>
  198. order by tor.pay_time desc, tor.create_time desc
  199. </select>
  200. <select id="excelAllOrderAdminCount" resultType="java.lang.Integer">
  201. select count(1) from tb_order tor
  202. left join tb_user tu on tor.user_id = tu.user_id
  203. left join goods_shop gs on tor.shop_id = gs.shop_id
  204. left join tb_indent ti on tor.order_id = ti.order_id
  205. left join tb_user tiu on tiu.user_id = ti.rider_user_id
  206. where 1 = 1
  207. <if test="riderPhone!=null and riderPhone!=''">
  208. and tiu.phone =#{riderPhone}
  209. </if>
  210. <if test="shopName!=null and shopName!=''">
  211. and gs.shop_name like concat('%',#{shopName},'%')
  212. </if>
  213. <if test="userName!=null and userName!=''">
  214. and tor.user_name like concat('%',#{userName},'%')
  215. </if>
  216. <if test="phone!=null and phone!=''">
  217. and tor.phone like concat('%',#{phone},'%')
  218. </if>
  219. <if test="orderNumber!=null and orderNumber!=''">
  220. and tor.order_number = #{orderNumber}
  221. </if>
  222. <if test="status!=null and status!=-1 and status!=1">
  223. and tor.status = #{status}
  224. </if>
  225. <if test="status!=null and status==1">
  226. and tor.status in (1,2)
  227. </if>
  228. <if test="shopId!=null">
  229. and tor.shop_id = #{shopId}
  230. </if>
  231. <if test="orderType!=null">
  232. and tor.order_type_extra = #{orderType}
  233. </if>
  234. <if test="startTime!=null and startTime!=''">
  235. and date_format(tor.create_time,'%Y-%m-%d') >= date_format(#{startTime},'%Y-%m-%d')
  236. </if>
  237. <if test="endTime!=null and endTime!='' ">
  238. and date_format(tor.create_time,'%Y-%m-%d') &lt;= date_format(#{endTime},'%Y-%m-%d')
  239. </if>
  240. <if test="payStartTime != null and payStartTime != ''">
  241. and date_format(tor.pay_time,'%Y-%m-%d') >= date_format(#{payStartTime},'%Y-%m-%d')
  242. </if>
  243. <if test="payEndTime != null and payEndTime != '' ">
  244. and date_format(tor.pay_time,'%Y-%m-%d') &lt;= date_format(#{payEndTime},'%Y-%m-%d')
  245. </if>
  246. order by tor.pay_time desc, tor.create_time desc
  247. </select>
  248. <select id="selectOrderByAdmin" resultType="com.sqx.modules.order.entity.TbOrder">
  249. select tor.*, tu.avatar as avatar, gs.shop_name as shopName from sys_user_shop sus
  250. left join tb_order tor on sus.shop_id = tor.shop_id
  251. left join tb_user tu on tor.user_id = tu.user_id
  252. left join goods_shop gs on tor.shop_id = gs.shop_id
  253. where 1 = 1 and sus.user_id = #{userId}
  254. and tor.is_pay = 1
  255. <if test="userName!=null and userName!=''">
  256. and tor.user_name like concat('%',#{userName},'%')
  257. </if>
  258. <if test="phone!=null and phone!=''">
  259. and tor.phone like concat('%',#{phone},'%')
  260. </if>
  261. <if test="orderNumber!=null and orderNumber!=''">
  262. and tor.order_number = #{orderNumber}
  263. </if>
  264. <if test="status!=null">
  265. and tor.status = #{status}
  266. </if>
  267. <if test="shopId!=null">
  268. and tor.shop_id = #{shopId}
  269. </if>
  270. <if test="orderType!=null">
  271. and tor.order_type = #{orderType}
  272. </if>
  273. order by tor.pay_time desc, tor.create_time desc
  274. </select>
  275. <select id="selectCountOrderByUserId" resultType="int">
  276. select count(*) from tb_order where user_id = #{userId}
  277. <if test="dateType=='day'">
  278. and date_format(pay_time,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
  279. </if>
  280. <if test="dateType=='month'">
  281. and date_format(pay_time,'%Y-%m')=date_format(#{date},'%Y-%m')
  282. </if>
  283. <if test="dateType=='year'">
  284. and date_format(pay_time,'%Y')=date_format(#{date},'%Y')
  285. </if>
  286. </select>
  287. <select id="selectSunMoneyByUserId" resultType="java.math.BigDecimal">
  288. select ifnull(sum(pay_money), 0) from tb_order where user_id = #{userId}
  289. <if test="dateType=='day'">
  290. and date_format(pay_time,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
  291. </if>
  292. <if test="dateType=='month'">
  293. and date_format(pay_time,'%Y-%m')=date_format(#{date},'%Y-%m')
  294. </if>
  295. <if test="dateType=='year'">
  296. and date_format(pay_time,'%Y')=date_format(#{date},'%Y')
  297. </if>
  298. </select>
  299. <select id="selectOrderDetails" resultType="com.sqx.modules.order.entity.TbOrder">
  300. select tor.*,
  301. gs.shop_name as shopName,
  302. gs.detailed_address as detailedAddress,
  303. gs.phone as shopPhone,
  304. tu.nick_name as riderNickName,
  305. tu.phone as riderPhone
  306. from tb_order tor
  307. left join goods_shop gs on tor.shop_id = gs.shop_id
  308. left join tb_indent ti on tor.order_id = ti.order_id
  309. left join tb_user tu on ti.rider_user_id = tu.user_id
  310. where tor.user_id = #{userId}
  311. and tor.status in (7, 6, 3, 4, 5, 8)
  312. order by pay_time desc
  313. </select>
  314. <select id="waitTakeFood" resultType="com.sqx.modules.order.entity.TbOrder">
  315. select tor.*, tu.avatar as avatar, ti.rider_user_id as riderUserId, gs.shop_name as shopName, gs.shop_cover as
  316. shopCover, gs.detailed_address as detailedAddress,tu1.phone as riderPhone,gs.phone as shopPhone,ti.indent_state as indentState,
  317. (select count(*) from tb_order where order_type = 1 and status in (6, 3) and pay_time &lt; tor.pay_time
  318. and shop_id = tor.shop_id) as countOrder
  319. from tb_order tor
  320. left join tb_user tu on tor.user_id = tu.user_id
  321. left join tb_indent ti on tor.order_id = ti.order_id
  322. left join goods_shop gs on tor.shop_id = gs.shop_id
  323. left join tb_user tu1 on ti.rider_user_id = tu1.user_id
  324. where tor.user_id = #{userId}
  325. and order_type = #{orderType}
  326. <if test="status!=null and status!=5">
  327. and tor.status = #{status}
  328. </if>
  329. <if test="status!=null and status==5">
  330. and tor.status in (5, 8)
  331. </if>
  332. <if test="status==null">
  333. and tor.status in (7, 6, 3, 4, 5, 8)
  334. </if>
  335. order by pay_time desc
  336. </select>
  337. <select id="selectCountOrderByTime" resultType="int">
  338. select count(*)
  339. from tb_order
  340. where order_type = 1
  341. and status = 3
  342. and pay_time &lt; #{payTime}
  343. and shop_id = #{shopId}
  344. </select>
  345. <update id="deleteCouponByOrderId">
  346. update tb_order
  347. set coupon_id = null
  348. where order_id = #{orderId}
  349. </update>
  350. <select id="selectSumMoney" resultType="java.math.BigDecimal">
  351. select ifnull(sum(pay_money), 0) from tb_order where is_pay=1 and status in (0,3,4,7,6)
  352. <if test="shopId!=null">
  353. and shop_id=#{shopId}
  354. </if>
  355. <if test="dateType=='day'">
  356. and date_format(pay_time,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
  357. </if>
  358. <if test="dateType=='month'">
  359. and date_format(pay_time,'%Y-%m')=date_format(#{date},'%Y-%m')
  360. </if>
  361. <if test="dateType=='year'">
  362. and date_format(pay_time,'%Y')=date_format(#{date},'%Y')
  363. </if>
  364. </select>
  365. <select id="selectCountOrder" resultType="int">
  366. select count(*) from tb_order where is_pay=1 and status in (0,3,4,7,6)
  367. <if test="shopId!=null">
  368. and shop_id=#{shopId}
  369. </if>
  370. <if test="dateType=='day'">
  371. and date_format(pay_time,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
  372. </if>
  373. <if test="dateType=='month'">
  374. and date_format(pay_time,'%Y-%m')=date_format(#{date},'%Y-%m')
  375. </if>
  376. <if test="dateType=='year'">
  377. and date_format(pay_time,'%Y')=date_format(#{date},'%Y')
  378. </if>
  379. </select>
  380. <update id="updateorderStatus">
  381. update tb_order
  382. set status = 4
  383. where update_time &lt; #{date}
  384. and status = 3
  385. </update>
  386. <select id="selectOrderByTimeList" resultType="com.sqx.modules.order.entity.TbOrder">
  387. select *
  388. from tb_order
  389. where update_time &lt; #{date}
  390. and status = 3
  391. </select>
  392. <select id="selectShoppingTrolley" resultType="com.sqx.modules.order.entity.TbOrder">
  393. select t.*, gs.shop_name as shopName
  394. from tb_order t
  395. left join goods_shop gs on t.shop_id = gs.shop_id
  396. where t.status = 1
  397. and t.user_id = #{userId}
  398. order by t.add_goods_time desc
  399. </select>
  400. <select id="selectShoppingTrolleyByShopId" resultType="com.sqx.modules.order.entity.TbOrder">
  401. select t.*, gs.shop_name as shopName
  402. from tb_order t
  403. left join goods_shop gs on t.shop_id = gs.shop_id
  404. where t.status = 1
  405. and t.user_id = #{userId}
  406. and t.shop_id = #{shopId}
  407. order by t.add_goods_time desc
  408. </select>
  409. <select id="selectByOrderId" resultType="com.sqx.modules.order.entity.TbOrder">
  410. select tor.*,
  411. ti.indent_id as indentId,
  412. ti.indent_number as indentNumber,
  413. ti.rider_user_id as riderUserId,
  414. ti.indent_state as indentState,
  415. tu.nick_name as riderNickName,
  416. tu.avatar as riderAvatar,
  417. tu.phone as riderPhone,
  418. e.evaluate_message as evaluateMessage,
  419. e.shop_reply_message as shopReplyMessage,
  420. e.score as score,
  421. e.create_time as eCreateTime,
  422. tus.avatar as avatar,
  423. tus.nick_name as userNickName
  424. from tb_order tor
  425. left join tb_indent ti on tor.order_id = ti.order_id
  426. left join tb_user tu on ti.rider_user_id = tu.user_id
  427. left join tb_user tus on ti.user_id = tus.user_id
  428. left join evaluate e on tor.order_number = e.order_number
  429. where tor.order_id = #{orderId}
  430. </select>
  431. <select id="selectBuyGoods" resultType="com.sqx.modules.order.entity.TbOrder">
  432. select tor.*,
  433. gs.shop_name as shopName,
  434. gs.detailed_address as detailedAddress,
  435. gs.shop_lng as shopLng,
  436. gs.shop_lat as shopLat,
  437. gs.phone as shopPhone,
  438. gs.errand_money as errandMoney,
  439. gs.exempt_min_money as exemptMinMoney,
  440. gs.minimum_delivery as minimumDelivery,
  441. gs.distribution_distance as distributionDistance
  442. from tb_order tor
  443. left join goods_shop gs on tor.shop_id = gs.shop_id
  444. where tor.order_id = #{orderId}
  445. and tor.user_id = #{userId}
  446. </select>
  447. <select id="selectOverTimeOrder" resultType="com.sqx.modules.order.entity.TbOrder">
  448. select *
  449. from tb_order
  450. where status = 7
  451. and pay_time &lt; #{overTime}
  452. </select>
  453. <select id="selectMakeOrdersList" resultType="com.sqx.modules.order.entity.TbOrder">
  454. select * from tb_order where status=6 and shop_receiving_time <![CDATA[ <= #{minusMinutes}]]></select>
  455. <select id="selectCurrentOrderSequenceByShopId" resultType="java.lang.Long">
  456. select
  457. order_id
  458. from
  459. tb_order
  460. where
  461. is_pay = 1
  462. and shop_id = #{shopId}
  463. and date(pay_time) = date(#{payTime})
  464. order by pay_time asc
  465. </select>
  466. <select id="countByShopIdAndActivityIdAndUserIdAndCurDate" resultType="java.lang.Integer">
  467. select
  468. count(1)
  469. from
  470. tb_order o
  471. left join activity_part_record apr on apr.order_id = o.order_id
  472. where
  473. o.shop_id = #{shopId}
  474. and o.user_id = #{userId}
  475. and date(o.create_time) = curdate()
  476. and apr.activity_id = #{activityId}
  477. and o.is_pay = 1
  478. <if test="orderId != null">
  479. and o.order_id != #{orderId}
  480. </if>
  481. </select>
  482. <select id="selectCurWaitReceivingOrderIds" resultType="java.lang.Long">
  483. select
  484. order_id
  485. from
  486. tb_order
  487. where
  488. reservation_flag = '1'
  489. and `status` = '7'
  490. and expect_delivery_time <![CDATA[ <= ]]> adddate(now(),interval 30 minute)
  491. </select>
  492. <select id="countUnFinishByShopId" resultType="java.lang.Integer">
  493. select count(order_id)
  494. from tb_order
  495. where shop_id = #{shopId} and status in (6, 3)
  496. </select>
  497. <select id="countCurDayPayByShopId" resultType="java.lang.Integer">
  498. select
  499. count(order_id)
  500. from
  501. tb_order
  502. where
  503. is_pay = 1
  504. and shop_id = #{shopId}
  505. and date(pay_time) = date(#{payTime})
  506. </select>
  507. </mapper>