From c2276c3bbb25675d3ff69530e08c7f770d6f0e1c Mon Sep 17 00:00:00 2001 From: Tankaikai Date: Wed, 2 Apr 2025 14:54:23 +0800 Subject: [PATCH] =?UTF-8?q?=E7=9F=AD=E5=89=A7=E6=96=B0=E9=9C=80=E6=B1=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/resources/mapper/ext/ExtSysDao.xml | 37 +++------------------ 1 file changed, 5 insertions(+), 32 deletions(-) diff --git a/src/main/resources/mapper/ext/ExtSysDao.xml b/src/main/resources/mapper/ext/ExtSysDao.xml index 0ecc1084..e0ce576a 100644 --- a/src/main/resources/mapper/ext/ExtSysDao.xml +++ b/src/main/resources/mapper/ext/ExtSysDao.xml @@ -14,7 +14,7 @@ left JOIN (select user_id,sum(money) as awardAmount,sum(case when title = '签到奖励' then 1 else 0 end) as signInNum from v_user_money_details where classify = 6 group by user_id) t2 on t1.user_id = t2.user_id - and (t1.user_name like concat('%',${keywords},'%') or t1.phone like concat('%',${keywords},'%')) + and (t1.user_name = ${keywords} or t1.phone = ${keywords}) ORDER BY t2.signInNum desc,t1.user_id asc @@ -71,43 +71,16 @@ t1.avatar, t1.user_name as userName, t1.phone, - ifnull( t2.unlocked, 0 ) AS unlocked, - ifnull( t2.todayUnlocked, 0 ) AS todayUnlocked, - ifnull( t3.totalDrawCount, 0 ) AS totalDrawCount, - ifnull( t3.residueDrawCount, 0 ) AS residueDrawCount, - ifnull( t3.todayDrawCount, 0 ) AS todayDrawCount + (select count(1) from v_orders where STATUS = 1 and pay_way = 9 and user_id = t1.user_id and pay_time >= DATE_FORMAT(CURDATE(), '%Y-%m-%d 00:00:00') and pay_time <= DATE_FORMAT(CURDATE(), '%Y-%m-%d 23:59:59') ) as todayUnlocked, + (select count(1) from v_disc_spinning_record where user_id = t1.user_id and DATE_FORMAT(create_time,'%Y-%m-%d') = CURDATE()) as todayDrawCount FROM v_tb_user t1 - LEFT JOIN ( - SELECT - user_id, - count( 1 ) AS unlocked, - sum(CASE WHEN pay_time >= DATE_FORMAT(CURDATE(), '%Y-%m-%d 00:00:00') and pay_time <= DATE_FORMAT(CURDATE(), '%Y-%m-%d 23:59:59') then 1 else 0 end) as todayUnlocked - FROM - v_orders - WHERE STATUS = 1 AND pay_way = 9 - GROUP BY user_id - ) t2 on t1.user_id = t2.user_id - LEFT JOIN ( - SELECT - x.user_id, - count(x.orders_id) as totalDrawCount, - sum(case when y.source_id is null then 1 else 0 end) as residueDrawCount, - sum(case when y.source_id is not null and DATE_FORMAT(y.create_time,'%Y-%m-%d') = CURDATE() then 1 else 0 end) as todayDrawCount - FROM v_orders x - LEFT JOIN v_disc_spinning_record y ON x.orders_id = y.source_id - AND y.source = 'order' - WHERE 1 = 1 - AND x.status = 1 - AND x.pay_way = 9 - group by x.user_id - ) t3 on t1.user_id = t3.user_id - and (t1.user_name like concat('%',${keywords},'%') or t1.phone like concat('%',${keywords},'%')) + and (t1.user_name = ${keywords} or t1.phone = ${keywords}) - order by t2.unlocked desc,t1.user_id asc + order by todayUnlocked desc,t1.user_id asc