From cf8e5b5cc0f781a44d66d0c8d361fec049fd4008 Mon Sep 17 00:00:00 2001
From: xiaoyong931011 <15274802129@163.com>
Date: Fri, 16 Jul 2021 10:31:23 +0800
Subject: [PATCH] Merge branch 'score-shop' of http://120.27.238.55:7000/r/xzx into score-shop
---
gc-user/src/main/resources/mapper/user/AccountMapper.xml | 24 ++++++++++++++++++------
1 files changed, 18 insertions(+), 6 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..eb04b45 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>
--
Gitblit v1.9.1