dataCenterMapper.xml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604
  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="selectRankingListAmount" resultType="com.sqx.modules.order.entity.TbOrder">
  271. SELECT ifnull( sum( pay_money ), 0 ) AS shopMoney
  272. FROM tb_order tor left join goods_shop u on tor.shop_id = u.shop_id
  273. left join shop_type gp on gp.id=u.shop_type_id
  274. WHERE tor.shop_id IS NOT NULL and tor.status = 4
  275. <if test="query.startTime != null and query.startTime !=''">
  276. and tor.pay_time >= #{query.startTime}
  277. </if>
  278. <if test="query.endTime != null and query.endTime != ''">
  279. and tor.pay_time <![CDATA[<=]]> #{query.endTime}
  280. </if>
  281. <if test="query.shopType != null and query.shopType != '' ">
  282. and gp.id = #{query.shopType}
  283. </if>
  284. <if test="query.dateType=='day'">
  285. and date_format(tor.pay_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
  286. </if>
  287. <if test="query.dateType=='month'">
  288. and date_format(tor.pay_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
  289. </if>
  290. <if test="query.dateType=='year'">
  291. and date_format(tor.pay_time,'%Y')=date_format(#{query.date},'%Y')
  292. </if>
  293. </select>
  294. <select id="excelShopCenter" resultType="com.sqx.modules.order.entity.TbOrder">
  295. SELECT
  296. *,
  297. @rank_num := @rank_num + 1 AS Rank
  298. FROM
  299. ( SELECT @rank_num := 0 ) r,
  300. ( SELECT ifnull( sum( pay_money ), 0 ) AS shopMoney, tor.shop_id , u.shop_name,gp.id as
  301. shopType,gp.shop_type_name as shopTypeName
  302. FROM tb_order tor left join goods_shop u on tor.shop_id = u.shop_id
  303. left join shop_type gp on gp.id=u.shop_type_id
  304. WHERE tor.shop_id IS NOT NULL and tor.status = 4
  305. <if test="query.startTime != null and query.startTime !=''">
  306. and tor.pay_time >= #{query.startTime}
  307. </if>
  308. <if test="query.endTime != null and query.endTime != ''">
  309. and tor.pay_time <![CDATA[<=]]> #{query.endTime}
  310. </if>
  311. <if test="query.shopType != null and query.shopType != '' ">
  312. and gp.id = #{query.shopType}
  313. </if>
  314. <if test="query.dateType=='day'">
  315. and date_format(tor.pay_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
  316. </if>
  317. <if test="query.dateType=='month'">
  318. and date_format(tor.pay_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
  319. </if>
  320. <if test="query.dateType=='year'">
  321. and date_format(tor.pay_time,'%Y')=date_format(#{query.date},'%Y')
  322. </if>
  323. GROUP BY tor.shop_id ) a
  324. ORDER BY shopMoney DESC
  325. </select>
  326. <select id="allUserCount" resultType="int">
  327. select count(*) from tb_user where status = 1
  328. <if test="query.dateType=='day'">
  329. and date_format(create_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
  330. </if>
  331. <if test="query.dateType=='month'">
  332. and date_format(create_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
  333. </if>
  334. <if test="query.dateType=='year'">
  335. and date_format(create_time,'%Y')=date_format(#{query.date},'%Y')
  336. </if>
  337. <if test="query.startTime!=null and query.startTime!=''">
  338. and create_time>=#{query.startTime}
  339. </if>
  340. <if test="query.endTime!=null and query.endTime!=''">
  341. and create_time <![CDATA[<=]]> #{query.endTime}
  342. </if>
  343. </select>
  344. <select id="phoneUserCount" resultType="int">
  345. select count(*) from tb_user where status = 1 and phone is not null
  346. <if test="query.dateType=='day'">
  347. and date_format(create_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
  348. </if>
  349. <if test="query.dateType=='month'">
  350. and date_format(create_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
  351. </if>
  352. <if test="query.dateType=='year'">
  353. and date_format(create_time,'%Y')=date_format(#{query.date},'%Y')
  354. </if>
  355. <if test="query.startTime!=null and query.startTime!=''">
  356. and create_time>=#{query.startTime}
  357. </if>
  358. <if test="query.endTime!=null and query.endTime!=''">
  359. and create_time <![CDATA[<=]]> #{query.endTime}
  360. </if>
  361. </select>
  362. <select id="selectUserFeedback" resultType="com.sqx.modules.errand.entity.Feedback">
  363. select * from sys_feedback where 1 = 1
  364. <if test="userEmail!=null and userEmail!=''">
  365. and user_email = #{userEmail}
  366. </if>
  367. order by feedback_time desc
  368. </select>
  369. <select id="findUserAddIndent" resultType="com.sqx.modules.errand.entity.TbIndent">
  370. select i.*,
  371. tu.nick_name as riderNickName,
  372. tu.phone as riderPhone
  373. from tb_indent i
  374. left join tb_indent ti on ti.order_id = i.order_id
  375. left join tb_user tu on ti.rider_user_id = tu.user_id
  376. where i.user_id = #{userId}
  377. and i.indent_state in (2, 3, 4, 5, 6, 8, 9, 10)
  378. order by i.create_time desc
  379. </select>
  380. <select id="findUserReceivingIndent" resultType="com.sqx.modules.errand.entity.TbIndent">
  381. select *
  382. from tb_indent
  383. where rider_user_id = #{userId}
  384. and indent_state in (3, 4, 5, 6)
  385. order by create_time desc
  386. </select>
  387. <select id="findTopUpMoney" resultType="com.sqx.modules.pay.entity.PayDetails">
  388. select pd.*, tu.nick_name as nickName from pay_details pd left join tb_user tu on pd.user_id = tu.user_id where
  389. 1 = 1
  390. <if test="userId!=null">
  391. and pd.user_id = #{userId}
  392. </if>
  393. <if test="startTime!=null and startTime!=''and endTime!=null and endTime!='' ">
  394. and str_to_date(pd.create_time, '%Y-%m-%d') between str_to_date(#{startTime}, '%Y-%m-%d') AND
  395. str_to_date(#{endTime}, '%Y-%m-%d')
  396. </if>
  397. order by pd.create_time desc
  398. </select>
  399. <select id="billMoney" resultType="java.math.BigDecimal">
  400. select ifnull(sum(indent_money),0) from tb_indent where indent_state in (2, 3, 4, 6)
  401. <if test="dateType=='day'">
  402. and date_format(create_time,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
  403. </if>
  404. <if test="dateType=='month'">
  405. and date_format(create_time,'%Y-%m')=date_format(#{date},'%Y-%m')
  406. </if>
  407. <if test="dateType=='year'">
  408. and date_format(create_time,'%Y')=date_format(#{date},'%Y')
  409. </if>
  410. </select>
  411. <select id="riderMoney" resultType="java.math.BigDecimal">
  412. select ifnull(sum(rider_money),0) from tb_indent where indent_state = "6"
  413. <if test="dateType=='day'">
  414. and date_format(create_time,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
  415. </if>
  416. <if test="dateType=='month'">
  417. and date_format(create_time,'%Y-%m')=date_format(#{date},'%Y-%m')
  418. </if>
  419. <if test="dateType=='year'">
  420. and date_format(create_time,'%Y')=date_format(#{date},'%Y')
  421. </if>
  422. </select>
  423. <select id="platformMoney" resultType="java.math.BigDecimal">
  424. select ifnull(sum(platform_money),0) from tb_indent where indent_state = "6"
  425. <if test="dateType=='day'">
  426. and date_format(create_time,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
  427. </if>
  428. <if test="dateType=='month'">
  429. and date_format(create_time,'%Y-%m')=date_format(#{date},'%Y-%m')
  430. </if>
  431. <if test="dateType=='year'">
  432. and date_format(create_time,'%Y')=date_format(#{date},'%Y')
  433. </if>
  434. </select>
  435. <select id="selectCashDeposit" resultType="com.sqx.modules.app.entity.UserMoneyDetails">
  436. select umd.*, tu.phone as phone, tu.nick_name as nickName from user_money_details umd left join tb_user tu on
  437. umd.user_id = tu.user_id where 1 = 1
  438. <if test="phone!=null and phone!=''">
  439. and tu.phone = #{phone}
  440. </if>
  441. <if test="type!=null">
  442. and umd.type = #{type}
  443. </if>
  444. <if test="userId!=null">
  445. and umd.user_id = #{userId}
  446. </if>
  447. and classify = 1
  448. order by umd.create_time desc
  449. </select>
  450. <select id="tcwmplatformMoney" resultType="java.math.BigDecimal">
  451. select ifnull(sum(pay_money), 0) from tb_order where status = 4
  452. <if test="dateType=='day'">
  453. and date_format(pay_time,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
  454. </if>
  455. <if test="dateType=='month'">
  456. and date_format(pay_time,'%Y-%m')=date_format(#{date},'%Y-%m')
  457. </if>
  458. <if test="dateType=='year'">
  459. and date_format(pay_time,'%Y')=date_format(#{date},'%Y')
  460. </if>
  461. </select>
  462. <select id="tcwmShopMoney" resultType="java.math.BigDecimal">
  463. select ifnull(sum(shop_income_money), 0) from tb_order where status = 4
  464. <if test="dateType=='day'">
  465. and date_format(pay_time,'%Y-%m-%d')=date_format(#{date},'%Y-%m-%d')
  466. </if>
  467. <if test="dateType=='month'">
  468. and date_format(pay_time,'%Y-%m')=date_format(#{date},'%Y-%m')
  469. </if>
  470. <if test="dateType=='year'">
  471. and date_format(pay_time,'%Y')=date_format(#{date},'%Y')
  472. </if>
  473. </select>
  474. <select id="selectFeedbackList" resultType="com.sqx.modules.errand.entity.Feedback">
  475. select * from sys_feedback where 1 = 1
  476. <if test="type!=null">
  477. and feedback_type = #{type}
  478. </if>
  479. order by feedback_time desc
  480. </select>
  481. <select id="selectTakeCount" resultType="int">
  482. select count(*) from tb_order
  483. where order_type = #{orderType}
  484. and is_pay=1 and status in (0,3,4,7,6)
  485. <if test="query.shopId!=null">
  486. and shop_id = #{query.shopId}
  487. </if>
  488. <if test="query.dateType=='day'">
  489. and date_format(pay_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
  490. </if>
  491. <if test="query.dateType=='month'">
  492. and date_format(pay_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
  493. </if>
  494. <if test="query.dateType=='year'">
  495. and date_format(pay_time,'%Y')=date_format(#{query.date},'%Y')
  496. </if>
  497. <if test="query.startTime!=null and query.startTime!=''">
  498. and pay_time>=#{query.startTime}
  499. </if>
  500. <if test="query.endTime!=null and query.endTime!=''">
  501. and pay_time <![CDATA[<=]]> #{query.endTime}
  502. </if>
  503. </select>
  504. <select id="selectTakeMoney" resultType="java.math.BigDecimal">
  505. select ifnull(sum(pay_money), 0) from tb_order
  506. where order_type = #{orderType}
  507. and is_pay=1 and status in (0,3,4,7,6)
  508. <if test="query.shopId!=null">
  509. and shop_id = #{query.shopId}
  510. </if>
  511. <if test="query.dateType=='day'">
  512. and date_format(pay_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
  513. </if>
  514. <if test="query.dateType=='month'">
  515. and date_format(pay_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
  516. </if>
  517. <if test="query.dateType=='year'">
  518. and date_format(pay_time,'%Y')=date_format(#{query.date},'%Y')
  519. </if>
  520. <if test="query.startTime!=null and query.startTime!=''">
  521. and pay_time>=#{query.startTime}
  522. </if>
  523. <if test="query.endTime!=null and query.endTime!=''">
  524. and pay_time <![CDATA[<=]]> #{query.endTime}
  525. </if>
  526. </select>
  527. <select id="cancelOrderCount" resultType="int">
  528. select count(*) from tb_order where status = 5
  529. <if test="query.shopId!=null">
  530. and shop_id = #{query.shopId}
  531. </if>
  532. <if test="query.dateType=='day'">
  533. and date_format(create_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
  534. </if>
  535. <if test="query.dateType=='month'">
  536. and date_format(create_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
  537. </if>
  538. <if test="query.dateType=='year'">
  539. and date_format(create_time,'%Y')=date_format(#{query.date},'%Y')
  540. </if>
  541. <if test="query.startTime!=null and query.startTime!=''">
  542. and create_time>=#{query.startTime}
  543. </if>
  544. <if test="query.endTime!=null and query.endTime!=''">
  545. and create_time <![CDATA[<=]]> #{query.endTime}
  546. </if>
  547. </select>
  548. <select id="cancelOrderMoney" resultType="java.math.BigDecimal">
  549. select ifnull(sum(pay_money), 0) from tb_order where status = 5
  550. <if test="query.shopId!=null">
  551. and shop_id = #{query.shopId}
  552. </if>
  553. <if test="query.dateType=='day'">
  554. and date_format(create_time,'%Y-%m-%d')=date_format(#{query.date},'%Y-%m-%d')
  555. </if>
  556. <if test="query.dateType=='month'">
  557. and date_format(create_time,'%Y-%m')=date_format(#{query.date},'%Y-%m')
  558. </if>
  559. <if test="query.dateType=='year'">
  560. and date_format(create_time,'%Y')=date_format(#{query.date},'%Y')
  561. </if>
  562. <if test="query.startTime!=null and query.startTime!=''">
  563. and create_time>=#{query.startTime}
  564. </if>
  565. <if test="query.endTime!=null and query.endTime!=''">
  566. and create_time <![CDATA[<=]]> #{query.endTime}
  567. </if>
  568. </select>
  569. </mapper>