From 70fe5c913f04360b226a8e7b9c282be66e1a1182 Mon Sep 17 00:00:00 2001 From: xiaoyong931011 <15274802129@163.com> Date: Fri, 16 Jul 2021 11:27:27 +0800 Subject: [PATCH] 202107016 --- gc-user/src/main/resources/mapper/user/AccountMapper.xml | 34 ++++++++++++++++++++++------------ 1 files changed, 22 insertions(+), 12 deletions(-) diff --git a/gc-user/src/main/resources/mapper/user/AccountMapper.xml b/gc-user/src/main/resources/mapper/user/AccountMapper.xml index 368208f..2984e4b 100644 --- a/gc-user/src/main/resources/mapper/user/AccountMapper.xml +++ b/gc-user/src/main/resources/mapper/user/AccountMapper.xml @@ -227,7 +227,19 @@ b.mobile_phone phone, a.CREATED_TIME createTime, (select IFNULL(count(1), 0) from xzx_user_head_details where user_id = a.user_id and head_user_id = #{id}) orderCnt, - (select IFNULL(sum(amount), 0) from xzx_user_head_details where user_id = a.user_id and head_user_id = #{id}) amount + (select IFNULL(sum(amount), 0) from xzx_user_head_details where user_id = a.user_id and head_user_id = #{id}) amount, + (select IFNULL(sum(score), 0) from xzx_user_head_details where user_id = a.user_id and head_user_id = #{id}) score, + (SELECT + IFNULL(SUM(score),0) as kg + FROM + xzx_jhy_order_items WHERE order_id in ( SELECT + id + FROM + xzx_jhy_order WHERE order_no in ( SELECT + order_no + FROM + xzx_user_head_details WHERE + user_id = a.user_id and head_user_id = #{id} ) )) orderScore FROM xzx_user_head_relate a LEFT JOIN xzx_user_info b on a.user_id = b.user_id @@ -240,13 +252,13 @@ a.order_no orderNo, a.score scoreReward, a.amount amountReward, - sum(c.score) score, - sum(c.score/40) amount + (select sum(score) from xzx_jhy_order_items where b.id = order_id) score, + (select sum(score/ 40) from xzx_jhy_order_items where b.id = order_id) amount FROM xzx_user_head_details a - LEFT JOIN xzx_jhy_order b on a.order_no = b.order_no - LEFT JOIN xzx_jhy_order_items c on b.id=c.order_id - where a.head_user_id = #{userId} + LEFT JOIN xzx_jhy_order b ON a.order_no = b.order_no + WHERE + a.head_user_id = #{userId} </select> @@ -277,11 +289,8 @@ <where> 1=1 and a.is_head = 1 - <if test="record.name != null and record.name != ''"> - and b.nick_name like concat('%',#{record.name},'%') - </if> - <if test="record.phone != null and record.phone != ''"> - and b.mobile_phone like concat('%',#{record.phone},'%') + <if test="record.queryCol != null and record.queryCol != ''"> + and (b.nick_name like concat('%',#{record.name},'%') or b.mobile_phone like concat('%',#{record.phone},'%')) </if> <if test="record.reserveTimeStart != null"> and b.regist_time >= #{record.reserveTimeStart} @@ -360,7 +369,8 @@ SELECT IFNULL(count(1), 0) cnt, SUM((select IFNULL(count(1), 0) from xzx_user_head_details where head_user_id = a.user_id) ) orderCnt, - SUM((select IFNULL(sum(amount), 0) from xzx_user_head_details where head_user_id = a.user_id) ) amount + SUM((select IFNULL(sum(amount), 0) from xzx_user_head_details where head_user_id = a.user_id) ) amount, + SUM((select IFNULL(sum(score), 0) from xzx_user_head_details where head_user_id = a.user_id) ) score FROM xzx_account_info a where -- Gitblit v1.9.1