dataCenterMapper.xml 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  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.datacentre.dao.DataCentreDao">
  4. <!--总用户数-->
  5. <select id="findAllCount" resultType="int">
  6. select count(*)
  7. from tb_user
  8. where status = 1
  9. </select>
  10. <!--今日新增用户数-->
  11. <select id="findDayAddUser" resultType="int">
  12. select count(*)
  13. from tb_user
  14. where status = 1
  15. and date_format(create_time, '%Y-%m-%d') = date_format(#{date}, '%Y-%m-%d')
  16. </select>
  17. <!--本月新增用户数-->
  18. <select id="findMonthAddUser" resultType="int">
  19. select count(*)
  20. from tb_user
  21. where status = 1
  22. and date_format(create_time, '%Y-%m') = date_format(#{date}, '%Y-%m')
  23. </select>
  24. <!--本年新增用户数-->
  25. <select id="findYearAddUser" resultType="int">
  26. select count(*)
  27. from tb_user
  28. where status = 1
  29. and date_format(create_time, '%Y') = date_format(#{date}, '%Y')
  30. </select>
  31. <!--今日收入-->
  32. <select id="findDayIncome" resultType="java.math.BigDecimal">
  33. select ifnull(sum(pay_money), 0)
  34. from tb_order
  35. where status in (3, 4)
  36. and date_format(pay_time, '%Y-%m-%d') = date_format(#{date}, '%Y-%m-%d')
  37. </select>
  38. <!--本月收入-->
  39. <select id="findMonthIncome" resultType="java.math.BigDecimal">
  40. select ifnull(sum(pay_money), 0)
  41. from tb_order
  42. where status in (3, 4)
  43. and date_format(pay_time, '%Y-%m') = date_format(#{date}, '%Y-%m')
  44. </select>
  45. <!--本年收入-->
  46. <select id="findYearIncome" resultType="java.math.BigDecimal">
  47. select ifnull(sum(pay_money), 0)
  48. from tb_order
  49. where status in (3, 4)
  50. and date_format(pay_time, '%Y') = date_format(#{date}, '%Y')
  51. </select>
  52. <!--今日发单数量-->
  53. <select id="findIndentCount" resultType="int">
  54. select count(*)
  55. from tb_order
  56. where status in (3, 4)
  57. and date_format(pay_time, '%Y-%m-%d') = date_format(#{date}, '%Y-%m-%d')
  58. </select>
  59. <select id="selectPayOrderAnalyze" resultType="com.sqx.modules.order.entity.TbOrder">
  60. select tor.*, gs.shop_name as shopName from tb_order tor left join goods_shop gs on tor.shop_id = gs.shop_id
  61. where tor.is_pay = 1
  62. <if test="query.dateType=='day'">
  63. and date_format(tor.pay_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
  64. </if>
  65. <if test="query.dateType=='month'">
  66. and date_format(tor.pay_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
  67. </if>
  68. <if test="query.dateType=='year'">
  69. and date_format(tor.pay_time,'%Y')=date_format(#{query.date},'%Y')
  70. </if>
  71. <if test="query.startTime!=null and query.startTime!=''">
  72. and tor.pay_time>=#{query.startTime}
  73. </if>
  74. <if test="query.endTime!=null and query.endTime!=''">
  75. and tor.pay_time <![CDATA[<=]]> #{query.endTime}
  76. </if>
  77. order by tor.pay_time desc
  78. </select>
  79. <select id="sumOrderMonth" resultType="int">
  80. select count(*)
  81. from tb_order
  82. where user_id = #{userId}
  83. and status in (3, 4)
  84. and date_format(pay_time, '%Y-%m') = date_format(#{date}, '%Y-%m')
  85. </select>
  86. <select id="sumJoinOrderMonth" resultType="int">
  87. select count(*)
  88. from tb_indent
  89. where rider_user_id = #{userId}
  90. and indent_state in (2, 3, 4, 6, 11)
  91. and date_format(create_time, '%Y-%m') = date_format(#{date}, '%Y-%m')
  92. </select>
  93. <select id="sumRiderMoney" resultType="java.math.BigDecimal">
  94. select ifnull(sum(rider_money), 0)
  95. from tb_indent
  96. where rider_user_id = #{userId}
  97. and indent_state = 6
  98. </select>
  99. <select id="sumCashMoney" resultType="java.math.BigDecimal">
  100. select ifnull(sum(money), 0)
  101. from cash_out
  102. where user_id = #{userId}
  103. and state = 1
  104. and date_format(out_at, '%Y-%m') = date_format(#{date}, '%Y-%m')
  105. </select>
  106. <select id="sumTopUpMonth" resultType="java.math.BigDecimal">
  107. select ifnull(sum(money), 0)
  108. from pay_details
  109. where user_id = #{userId}
  110. and classify = 2
  111. and date_format(pay_time, '%Y-%m') = date_format(#{date}, '%Y-%m')
  112. </select>
  113. <select id="selectTopUpStatistics" resultType="java.math.BigDecimal">
  114. select ifnull(sum(money), 0) from pay_details where classify = 2
  115. <if test="dateType=='day'">
  116. and date_format(pay_time,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
  117. </if>
  118. <if test="dateType=='month'">
  119. and date_format(pay_time,'%Y-%m')=date_format(#{date},'%Y-%m')
  120. </if>
  121. <if test="dateType=='year'">
  122. and date_format(pay_time,'%Y')=date_format(#{date},'%Y')
  123. </if>
  124. </select>
  125. <select id="findAllCertification" resultType="com.sqx.modules.app.entity.UserEntity">
  126. select tu.*,rs.station_name AS stationName from tb_user tu
  127. left join rider_station rs on tu.rider_station_id=rs.id
  128. where 1 = 1
  129. <if test="phone!=null and phone!=''">
  130. and tu.phone=#{phone}
  131. </if>
  132. <if test="userName!=null and userName!=''">
  133. and tu.user_name = #{userName}
  134. </if>
  135. <if test="checkCertification!=null and checkCertification!='' and checkCertification!='-1' ">
  136. and tu.check_certification = #{checkCertification}
  137. </if>
  138. <if test="checkCertification!=null or checkCertification=='-1'">
  139. and tu.check_certification in (0,1,2)
  140. </if>
  141. <if test="riderStationId!=null and riderStationId!=''">
  142. and tu.rider_station_id = #{riderStationId}
  143. </if>
  144. order by tu.audit_time desc
  145. </select>
  146. <update id="checkCertification">
  147. update tb_user
  148. set check_certification = #{checkCertification},
  149. check_certification_message = #{checkCertificationMessage}
  150. where user_id = #{userId}
  151. </update>
  152. <select id="findCertification" resultType="com.sqx.modules.app.entity.UserEntity">
  153. select *
  154. from tb_user
  155. where user_id = #{userId}
  156. and status = 1
  157. </select>
  158. <select id="rankingList" resultType="com.sqx.modules.errand.entity.TbIndent">
  159. SELECT
  160. *,
  161. @rank_num := @rank_num + 1 AS rankNum
  162. FROM
  163. ( SELECT @rank_num := 0 ) r,
  164. ( SELECT ifnull( sum( rider_money ), 0 ) AS moneyOrder, i.rider_user_id, u.nick_name as nickName, u.avatar as
  165. avatar,
  166. i.user_province as userProvince, i.user_city as userCity, i.user_district as userDistrict,rs.station_name as stationName
  167. FROM tb_indent i left join tb_user u on i.rider_user_id = u.user_id
  168. left join rider_station rs on u.rider_station_id=rs.id
  169. WHERE i.rider_user_id IS NOT NULL and i.indent_state = 6
  170. <if test="address!=null and address!=''">
  171. and (i.user_province like concat('%',#{address},'%') or i.user_city like concat('%',#{address},'%') or
  172. i.user_district like concat('%',#{address},'%'))
  173. </if>
  174. <if test="dateType=='day'">
  175. and date_format(i.create_time,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
  176. </if>
  177. <if test="dateType=='month'">
  178. and date_format(i.create_time,'%Y-%m')=date_format(#{date},'%Y-%m')
  179. </if>
  180. <if test="dateType=='year'">
  181. and date_format(i.create_time,'%Y')=date_format(#{date},'%Y')
  182. </if>
  183. <if test="riderStationId != null and riderStationId != ''">
  184. and u.rider_station_id=#{riderStationId}
  185. </if>
  186. GROUP BY i.rider_user_id ) a
  187. ORDER BY moneyOrder DESC
  188. </select>
  189. <select id="excelRankList" resultType="com.sqx.modules.errand.entity.TbIndent">
  190. SELECT
  191. *,
  192. @rank_num := @rank_num + 1 AS rankNum
  193. FROM
  194. ( SELECT @rank_num := 0 ) r,
  195. ( SELECT ifnull( sum( rider_money ), 0 ) AS moneyOrder, i.rider_user_id, u.nick_name as nickName, u.avatar as
  196. avatar,
  197. i.user_province as userProvince, i.user_city as userCity, i.user_district as userDistrict,rs.station_name as stationName
  198. FROM tb_indent i left join tb_user u on i.rider_user_id = u.user_id
  199. left join rider_station rs on u.rider_station_id=rs.id
  200. WHERE i.rider_user_id IS NOT NULL
  201. <if test="query.address!=null and query.address!=''">
  202. and (i.user_province like concat('%',#{query.address},'%') or i.user_city like concat('%',#{query.address},'%') or
  203. i.user_district like concat('%',#{query.address},'%'))
  204. </if>
  205. <if test="query.dateType=='day'">
  206. and date_format(i.create_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
  207. </if>
  208. <if test="query.dateType=='month'">
  209. and date_format(i.create_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
  210. </if>
  211. <if test="query.dateType=='year'">
  212. and date_format(i.create_time,'%Y')=date_format(#{query.date},'%Y')
  213. </if>
  214. <if test="query.riderStationId != null and query.riderStationId !=''">
  215. and u.rider_station_id=#{query.riderStationId}
  216. </if>
  217. GROUP BY i.rider_user_id ) a
  218. ORDER BY moneyOrder DESC
  219. </select>
  220. <select id="selectNewShopCount" resultType="int">
  221. select count(*) from goods_shop where 1 = 1
  222. <if test="query.dateType=='day'">
  223. and date_format(create_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
  224. </if>
  225. <if test="query.dateType=='month'">
  226. and date_format(create_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
  227. </if>
  228. <if test="query.dateType=='year'">
  229. and date_format(create_time,'%Y')=date_format(#{query.date},'%Y')
  230. </if>
  231. <if test="query.endTime != null and query.endTime != ''">
  232. and create_time <![CDATA[<=]]> #{query.endTime}
  233. </if>
  234. <if test="query.startTime != null and query.startTime != ''">
  235. and create_time >= #{query.startTime}
  236. </if>
  237. </select>
  238. <select id="selectRankingList" resultType="com.sqx.modules.order.entity.TbOrder">
  239. SELECT
  240. *,
  241. @rank_num := @rank_num + 1 AS rankNum
  242. FROM
  243. ( SELECT @rank_num := 0 ) r,
  244. ( SELECT ifnull( sum( pay_money ), 0 ) AS shopMoney, tor.shop_id , u.shop_name,gp.id as
  245. shopType,gp.shop_type_name as shopTypeName
  246. FROM tb_order tor left join goods_shop u on tor.shop_id = u.shop_id
  247. left join shop_type gp on gp.id=u.shop_type_id
  248. WHERE tor.shop_id IS NOT NULL and tor.status = 4
  249. <if test="query.startTime != null and query.startTime !=''">
  250. and tor.pay_time >= #{query.startTime}
  251. </if>
  252. <if test="query.endTime != null and query.endTime != ''">
  253. and tor.pay_time <![CDATA[<=]]> #{query.endTime}
  254. </if>
  255. <if test="query.shopType != null and query.shopType != '' ">
  256. and gp.id = #{query.shopType}
  257. </if>
  258. <if test="query.dateType=='day'">
  259. and date_format(tor.pay_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
  260. </if>
  261. <if test="query.dateType=='month'">
  262. and date_format(tor.pay_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
  263. </if>
  264. <if test="query.dateType=='year'">
  265. and date_format(tor.pay_time,'%Y')=date_format(#{query.date},'%Y')
  266. </if>
  267. GROUP BY tor.shop_id ) a
  268. ORDER BY shopMoney DESC
  269. </select>
  270. <select id="excelShopCenter" resultType="com.sqx.modules.order.entity.TbOrder">
  271. SELECT
  272. *,
  273. @rank_num := @rank_num + 1 AS Rank
  274. FROM
  275. ( SELECT @rank_num := 0 ) r,
  276. ( SELECT ifnull( sum( pay_money ), 0 ) AS shopMoney, tor.shop_id , u.shop_name,gp.id as
  277. shopType,gp.shop_type_name as shopTypeName
  278. FROM tb_order tor left join goods_shop u on tor.shop_id = u.shop_id
  279. left join shop_type gp on gp.id=u.shop_type_id
  280. WHERE tor.shop_id IS NOT NULL and tor.status = 4
  281. <if test="query.startTime != null and query.startTime !=''">
  282. and tor.pay_time >= #{query.startTime}
  283. </if>
  284. <if test="query.endTime != null and query.endTime != ''">
  285. and tor.pay_time <![CDATA[<=]]> #{query.endTime}
  286. </if>
  287. <if test="query.shopType != null and query.shopType != '' ">
  288. and gp.id = #{query.shopType}
  289. </if>
  290. GROUP BY tor.shop_id ) a
  291. ORDER BY shopMoney DESC
  292. </select>
  293. <select id="allUserCount" resultType="int">
  294. select count(*) from tb_user where status = 1
  295. <if test="query.dateType=='day'">
  296. and date_format(create_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
  297. </if>
  298. <if test="query.dateType=='month'">
  299. and date_format(create_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
  300. </if>
  301. <if test="query.dateType=='year'">
  302. and date_format(create_time,'%Y')=date_format(#{query.date},'%Y')
  303. </if>
  304. <if test="query.startTime!=null and query.startTime!=''">
  305. and create_time>=#{query.startTime}
  306. </if>
  307. <if test="query.endTime!=null and query.endTime!=''">
  308. and create_time <![CDATA[<=]]> #{query.endTime}
  309. </if>
  310. </select>
  311. <select id="phoneUserCount" resultType="int">
  312. select count(*) from tb_user where status = 1 and phone is not null
  313. <if test="query.dateType=='day'">
  314. and date_format(create_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
  315. </if>
  316. <if test="query.dateType=='month'">
  317. and date_format(create_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
  318. </if>
  319. <if test="query.dateType=='year'">
  320. and date_format(create_time,'%Y')=date_format(#{query.date},'%Y')
  321. </if>
  322. <if test="query.startTime!=null and query.startTime!=''">
  323. and create_time>=#{query.startTime}
  324. </if>
  325. <if test="query.endTime!=null and query.endTime!=''">
  326. and create_time <![CDATA[<=]]> #{query.endTime}
  327. </if>
  328. </select>
  329. <select id="selectUserFeedback" resultType="com.sqx.modules.errand.entity.Feedback">
  330. select * from sys_feedback where 1 = 1
  331. <if test="userEmail!=null and userEmail!=''">
  332. and user_email = #{userEmail}
  333. </if>
  334. order by feedback_time desc
  335. </select>
  336. <select id="findUserAddIndent" resultType="com.sqx.modules.errand.entity.TbIndent">
  337. select i.*,
  338. tu.nick_name as riderNickName,
  339. tu.phone as riderPhone
  340. from tb_indent i
  341. left join tb_indent ti on ti.order_id = i.order_id
  342. left join tb_user tu on ti.rider_user_id = tu.user_id
  343. where i.user_id = #{userId}
  344. and i.indent_state in (2, 3, 4, 5, 6, 8, 9, 10)
  345. order by i.create_time desc
  346. </select>
  347. <select id="findUserReceivingIndent" resultType="com.sqx.modules.errand.entity.TbIndent">
  348. select *
  349. from tb_indent
  350. where rider_user_id = #{userId}
  351. and indent_state in (3, 4, 5, 6)
  352. order by create_time desc
  353. </select>
  354. <select id="findTopUpMoney" resultType="com.sqx.modules.pay.entity.PayDetails">
  355. select pd.*, tu.nick_name as nickName from pay_details pd left join tb_user tu on pd.user_id = tu.user_id where
  356. 1 = 1
  357. <if test="userId!=null">
  358. and pd.user_id = #{userId}
  359. </if>
  360. <if test="startTime!=null and startTime!=''and endTime!=null and endTime!='' ">
  361. and str_to_date(pd.create_time, '%Y-%m-%d') between str_to_date(#{startTime}, '%Y-%m-%d') AND
  362. str_to_date(#{endTime}, '%Y-%m-%d')
  363. </if>
  364. order by pd.create_time desc
  365. </select>
  366. <select id="billMoney" resultType="java.math.BigDecimal">
  367. select ifnull(sum(indent_money),0) from tb_indent where indent_state in (2, 3, 4, 6)
  368. <if test="dateType=='day'">
  369. and date_format(create_time,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
  370. </if>
  371. <if test="dateType=='month'">
  372. and date_format(create_time,'%Y-%m')=date_format(#{date},'%Y-%m')
  373. </if>
  374. <if test="dateType=='year'">
  375. and date_format(create_time,'%Y')=date_format(#{date},'%Y')
  376. </if>
  377. </select>
  378. <select id="riderMoney" resultType="java.math.BigDecimal">
  379. select ifnull(sum(rider_money),0) from tb_indent where indent_state = "6"
  380. <if test="dateType=='day'">
  381. and date_format(create_time,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
  382. </if>
  383. <if test="dateType=='month'">
  384. and date_format(create_time,'%Y-%m')=date_format(#{date},'%Y-%m')
  385. </if>
  386. <if test="dateType=='year'">
  387. and date_format(create_time,'%Y')=date_format(#{date},'%Y')
  388. </if>
  389. </select>
  390. <select id="platformMoney" resultType="java.math.BigDecimal">
  391. select ifnull(sum(platform_money),0) from tb_indent where indent_state = "6"
  392. <if test="dateType=='day'">
  393. and date_format(create_time,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
  394. </if>
  395. <if test="dateType=='month'">
  396. and date_format(create_time,'%Y-%m')=date_format(#{date},'%Y-%m')
  397. </if>
  398. <if test="dateType=='year'">
  399. and date_format(create_time,'%Y')=date_format(#{date},'%Y')
  400. </if>
  401. </select>
  402. <select id="selectCashDeposit" resultType="com.sqx.modules.app.entity.UserMoneyDetails">
  403. select umd.*, tu.phone as phone, tu.nick_name as nickName from user_money_details umd left join tb_user tu on
  404. umd.user_id = tu.user_id where 1 = 1
  405. <if test="phone!=null and phone!=''">
  406. and tu.phone = #{phone}
  407. </if>
  408. <if test="type!=null">
  409. and umd.type = #{type}
  410. </if>
  411. <if test="userId!=null">
  412. and umd.user_id = #{userId}
  413. </if>
  414. and classify = 1
  415. order by umd.create_time desc
  416. </select>
  417. <select id="tcwmplatformMoney" resultType="java.math.BigDecimal">
  418. select ifnull(sum(pay_money), 0) from tb_order where status = 4
  419. <if test="dateType=='day'">
  420. and date_format(pay_time,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
  421. </if>
  422. <if test="dateType=='month'">
  423. and date_format(pay_time,'%Y-%m')=date_format(#{date},'%Y-%m')
  424. </if>
  425. <if test="dateType=='year'">
  426. and date_format(pay_time,'%Y')=date_format(#{date},'%Y')
  427. </if>
  428. </select>
  429. <select id="tcwmShopMoney" resultType="java.math.BigDecimal">
  430. select ifnull(sum(shop_income_money), 0) from tb_order where status = 4
  431. <if test="dateType=='day'">
  432. and date_format(pay_time,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
  433. </if>
  434. <if test="dateType=='month'">
  435. and date_format(pay_time,'%Y-%m')=date_format(#{date},'%Y-%m')
  436. </if>
  437. <if test="dateType=='year'">
  438. and date_format(pay_time,'%Y')=date_format(#{date},'%Y')
  439. </if>
  440. </select>
  441. <select id="selectFeedbackList" resultType="com.sqx.modules.errand.entity.Feedback">
  442. select * from sys_feedback where 1 = 1
  443. <if test="type!=null">
  444. and feedback_type = #{type}
  445. </if>
  446. order by feedback_time desc
  447. </select>
  448. <select id="selectTakeCount" resultType="int">
  449. select count(*) from tb_order
  450. where order_type = #{orderType}
  451. and is_pay=1 and status in (0,3,4,7,6)
  452. <if test="query.shopId!=null">
  453. and shop_id = #{query.shopId}
  454. </if>
  455. <if test="query.dateType=='day'">
  456. and date_format(pay_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
  457. </if>
  458. <if test="query.dateType=='month'">
  459. and date_format(pay_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
  460. </if>
  461. <if test="query.dateType=='year'">
  462. and date_format(pay_time,'%Y')=date_format(#{query.date},'%Y')
  463. </if>
  464. <if test="query.startTime!=null and query.startTime!=''">
  465. and pay_time>=#{query.startTime}
  466. </if>
  467. <if test="query.endTime!=null and query.endTime!=''">
  468. and pay_time <![CDATA[<=]]> #{query.endTime}
  469. </if>
  470. </select>
  471. <select id="selectTakeMoney" resultType="java.math.BigDecimal">
  472. select ifnull(sum(pay_money), 0) from tb_order
  473. where order_type = #{orderType}
  474. and is_pay=1 and status in (0,3,4,7,6)
  475. <if test="query.shopId!=null">
  476. and shop_id = #{query.shopId}
  477. </if>
  478. <if test="query.dateType=='day'">
  479. and date_format(pay_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
  480. </if>
  481. <if test="query.dateType=='month'">
  482. and date_format(pay_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
  483. </if>
  484. <if test="query.dateType=='year'">
  485. and date_format(pay_time,'%Y')=date_format(#{query.date},'%Y')
  486. </if>
  487. <if test="query.startTime!=null and query.startTime!=''">
  488. and pay_time>=#{query.startTime}
  489. </if>
  490. <if test="query.endTime!=null and query.endTime!=''">
  491. and pay_time <![CDATA[<=]]> #{query.endTime}
  492. </if>
  493. </select>
  494. <select id="cancelOrderCount" resultType="int">
  495. select count(*) from tb_order where status = 5
  496. <if test="query.shopId!=null">
  497. and shop_id = #{query.shopId}
  498. </if>
  499. <if test="query.dateType=='day'">
  500. and date_format(create_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
  501. </if>
  502. <if test="query.dateType=='month'">
  503. and date_format(create_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
  504. </if>
  505. <if test="query.dateType=='year'">
  506. and date_format(create_time,'%Y')=date_format(#{query.date},'%Y')
  507. </if>
  508. <if test="query.startTime!=null and query.startTime!=''">
  509. and create_time>=#{query.startTime}
  510. </if>
  511. <if test="query.endTime!=null and query.endTime!=''">
  512. and create_time <![CDATA[<=]]> #{query.endTime}
  513. </if>
  514. </select>
  515. <select id="cancelOrderMoney" resultType="java.math.BigDecimal">
  516. select ifnull(sum(pay_money), 0) from tb_order where status = 5
  517. <if test="query.shopId!=null">
  518. and shop_id = #{query.shopId}
  519. </if>
  520. <if test="query.dateType=='day'">
  521. and date_format(create_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
  522. </if>
  523. <if test="query.dateType=='month'">
  524. and date_format(create_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
  525. </if>
  526. <if test="query.dateType=='year'">
  527. and date_format(create_time,'%Y')=date_format(#{query.date},'%Y')
  528. </if>
  529. <if test="query.startTime!=null and query.startTime!=''">
  530. and create_time>=#{query.startTime}
  531. </if>
  532. <if test="query.endTime!=null and query.endTime!=''">
  533. and create_time <![CDATA[<=]]> #{query.endTime}
  534. </if>
  535. </select>
  536. </mapper>