Эх сурвалжийг харах

fix(user-info): 修正用户余额计算逻辑和消费总计条件

- 修改余额计算只包含主余额字段,不再累计兑换余额
- 更新消费总计统计,调整change_type过滤条件从2改为1
- 确保LEFT JOIN子查询中的条件正确反映业务需求
SheepHy 2 өдөр өмнө
parent
commit
76c0fce8d5

+ 2 - 2
src/main/resources/mapper/business/UserInfoMapper.xml

@@ -10,7 +10,7 @@
         fi.name AS firmName,
         ui.phone,
         ui.openid,
-        IFNULL(ua.balance, 0) + IFNULL(ua.redeem_balance, 0) AS balance,
+        IFNULL(ua.balance, 0) AS balance,
         IFNULL(log.total_consumption, 0) AS totalConsumption,
         ui.create_time
         FROM
@@ -21,7 +21,7 @@
         LEFT JOIN (
             SELECT user_id, SUM(IFNULL(change_balance, 0)) AS total_consumption
             FROM c_user_account_log
-            WHERE is_deleted = 0 AND change_type = 2 AND account_type = 1
+            WHERE is_deleted = 0 AND change_type = 1
             GROUP BY user_id
         ) log ON ui.id = log.user_id
         <where>