From ef04ce57881e6a338b10d596c5eb76b2220598bf Mon Sep 17 00:00:00 2001
From: puzhibing <393733352@qq.com>
Date: 星期四, 31 八月 2023 11:16:49 +0800
Subject: [PATCH] 更新版本

---
 management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/RechargeRecordMapper.xml |   31 +++++++++++++++++++++++++++++++
 1 files changed, 31 insertions(+), 0 deletions(-)

diff --git a/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/RechargeRecordMapper.xml b/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/RechargeRecordMapper.xml
index c53a45f..283008d 100644
--- a/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/RechargeRecordMapper.xml
+++ b/management/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/RechargeRecordMapper.xml
@@ -17,4 +17,35 @@
         <result column="agentId" property="agentId" />
         <result column="surplusDividedAmount" property="surplusDividedAmount"/>
     </resultMap>
+
+
+
+    <select id="querSumSurplusDividedAmount" resultType="double">
+        select ifnull(sum(surplusDividedAmount), 0) from t_recharge_record where payStatus = 2
+        <if test="null != type">
+            and `type` = #{type}
+        </if>
+    </select>
+
+
+    <select id="queryAgentBalance" resultType="double">
+        select
+        sum(aa.income) - sum(aa.disburse) as balance
+        from (
+        select sum(amount) as income, 0 as disburse from t_revenue where userType = 3 and userId = #{companyId}
+        union all
+        select 0 as ncome, sum(amount) as disburse from t_settlement_record where type = 2 and objectId = #{companyId}
+        ) as aa
+    </select>
+    <select id="queryCompanyBalance" resultType="double">
+        select
+        sum(aa.income) - sum(aa.disburse) + sum(aa.recharge) as balance
+        from (
+        select sum(amount) as income, 0 as disburse, 0 as recharge from t_revenue where userType = 4
+        union all
+        select 0 as ncome, sum(amount) as disburse, 0 as recharge from t_settlement_record where type = 1
+        union all
+        select 0 as ncome, 0 as disburse, sum(surplusDividedAmount) as recharge from t_recharge_record where type = 4 and payStatus = 2
+        ) as aa
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.7.1