From 8b09fbc19a96b57bf1d0e4d7c79b51a76aeca554 Mon Sep 17 00:00:00 2001
From: Pu Zhibing <393733352@qq.com>
Date: 星期五, 28 三月 2025 19:57:56 +0800
Subject: [PATCH] 修改bug

---
 ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TCompanyMapper.xml |  110 ++++++++++++++++++++++++++++++++----------------------
 1 files changed, 65 insertions(+), 45 deletions(-)

diff --git a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TCompanyMapper.xml b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TCompanyMapper.xml
index 2ba69fb..933185d 100644
--- a/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TCompanyMapper.xml
+++ b/ManagementIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/TCompanyMapper.xml
@@ -64,7 +64,7 @@
     <!--根据条件查询分公司列表-->
     <select id="getCompanyList" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page">
         SELECT * FROM (SELECT ui.account,IFNULL(ci.num,0) as franchiseeNum,IFNULL(ca.num,0) as carNumber,IFNULL(di.num,0) as driverNumber,
-        CONCAT(case when cc.isSpe = 1 then '专车,' else '' end,
+        case when cc.isSpe = 1 then '专车,' else '' end,
         case when cc.isSameLogistics = 1 then '市内小件物流,' else '' end,
         cc.* FROM t_company as cc
         LEFT JOIN (SELECT * FROM sys_user where roleType = 2) as ui on ui.objectId = cc.id
@@ -115,7 +115,7 @@
     <!--根据条件查询加盟商列表-->
     <select id="getFranchiseeList" resultType="map" parameterType="com.baomidou.mybatisplus.plugins.Page">
         SELECT * FROM (SELECT ui.account,ci.`name` as companyName,IFNULL(ca.num,0) as carNumber,IFNULL(di.num,0) as driverNumber,
-        CONCAT(case when cc.isSpe = 1 then '专车,' else '' end,
+        case when cc.isSpe = 1 then '专车,' else '' end,
         case when cc.isSameLogistics = 1 then '市内小件物流,' else '' end,
         cc.* FROM t_company as cc
         LEFT JOIN (SELECT * FROM sys_user where roleType = 3) as ui on ui.objectId = cc.id
@@ -171,7 +171,7 @@
             sum(aa.cancelNum) as cancelNum,
             sum(aa.onlinePay) as onlinePay,
             sum(aa.offlinePay) as offlinePay,
-            sum(aa.money) as money,
+            ROUND(sum(aa.money), 2) as money,
             sum(aa.complaint) as complaint
             from (
             select DATE_FORMAT(insertTime, '%Y-%m-%d') as time, count(id) as register, 0 as `online`, 0 as orderNum, 0 as cancelNum, 0 as onlinePay, 0 as offlinePay, 0 as money, 0 as complaint
@@ -197,7 +197,7 @@
             </if>
             group by DATE_FORMAT(a.startTime, '%Y-%m-%d')
             union all
-            <if test="1 == type">
+            <if test="null == type or 1 == type">
                 select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, count(id), 0, 0, 0, 0, 0 from t_order_private_car where isDelete = 1
                 <if test="null != companyId">
                     and companyId = #{companyId}
@@ -208,7 +208,7 @@
                 group by DATE_FORMAT(travelTime, '%Y-%m-%d')
                 union all
             </if>
-            <if test="2 == type">
+            <if test="null == type or 2 == type">
                 select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, count(id), 0, 0, 0, 0, 0 from t_order_taxi where isDelete = 1
                 <if test="null != companyId">
                     and companyId = #{companyId}
@@ -219,7 +219,7 @@
                 group by DATE_FORMAT(travelTime, '%Y-%m-%d')
                 union all
             </if>
-            <if test="3 == type">
+            <if test="null == type or 3 == type">
                 select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, count(id), 0, 0, 0, 0, 0 from t_order_cross_city where isDelete = 1
                 <if test="null != companyId">
                     and companyId = #{companyId}
@@ -230,7 +230,7 @@
                 group by DATE_FORMAT(travelTime, '%Y-%m-%d')
                 union all
             </if>
-            <if test="4 == type">
+            <if test="null == type or 4 == type">
                 select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, count(id), 0, 0, 0, 0, 0 from t_order_logistics where isDelete = 1
                 <if test="null != companyId">
                     and companyId = #{companyId}
@@ -241,7 +241,7 @@
                 group by DATE_FORMAT(travelTime, '%Y-%m-%d')
                 union all
             </if>
-            <if test="type == 1">
+            <if test="null == type or type == 1">
                 select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, count(id), 0, 0, 0, 0 from t_order_private_car where isDelete = 1 and state in (10, 12)
                 <if test="null != companyId">
                     and companyId = #{companyId}
@@ -252,7 +252,7 @@
                 group by DATE_FORMAT(travelTime, '%Y-%m-%d')
                 union all
             </if>
-            <if test="type == 2">
+            <if test="null == type or type == 2">
                 select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, count(id), 0, 0, 0, 0 from t_order_taxi where isDelete = 1 and state in (10, 12)
                 <if test="null != companyId">
                     and companyId = #{companyId}
@@ -263,7 +263,7 @@
                 group by DATE_FORMAT(travelTime, '%Y-%m-%d')
                 union all
             </if>
-            <if test="type == 3">
+            <if test="null == type or type == 3">
                 select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, count(id), 0, 0, 0, 0 from t_order_cross_city where isDelete = 1 and state in (10, 12)
                 <if test="null != companyId">
                     and companyId = #{companyId}
@@ -274,7 +274,7 @@
                 group by DATE_FORMAT(travelTime, '%Y-%m-%d')
                 union all
             </if>
-            <if test="type == 4">
+            <if test="null == type or type == 4">
                 select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, count(id), 0, 0, 0, 0 from t_order_logistics where isDelete = 1 and state in (10, 12)
                 <if test="null != companyId">
                     and companyId = #{companyId}
@@ -285,8 +285,30 @@
                 group by DATE_FORMAT(travelTime, '%Y-%m-%d')
                 union all
             </if>
-            <if test="type == 1">
-                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, count(id), 0, sum(payMoney), 0 from t_order_private_car where isDelete = 1 and payManner = 1
+            <if test="null == type or type == 1">
+                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, count(id), 0, sum(payMoney), 0 from t_order_private_car where isDelete = 1 and payType in (1, 2, 3)
+                <if test="null != companyId">
+                    and companyId = #{companyId}
+                </if>
+                <if test="null != start and '' != start and null != end and '' != end">
+                    and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
+                </if>
+                group by DATE_FORMAT(travelTime, '%Y-%m-%d')
+                union all
+    
+                select DATE_FORMAT(insertTime, '%Y-%m-%d'), 0, 0, 0, 0, count(id), 0, sum(money), 0 from t_income where orderType = 1 and userType = 1 and type = 3
+                <if test="null != companyId">
+                    and incomeId = #{companyId}
+                </if>
+                <if test="null != start and '' != start and null != end and '' != end">
+                    and DATE_FORMAT(insertTime, '%Y-%m-%d') between #{start} and #{end}
+                </if>
+                group by DATE_FORMAT(insertTime, '%Y-%m-%d')
+                union all
+                
+            </if>
+            <if test="null == type or type == 2">
+                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, count(id), 0, sum(payMoney), 0 from t_order_taxi where isDelete = 1 and payType in (1, 2, 3)
                 <if test="null != companyId">
                     and companyId = #{companyId}
                 </if>
@@ -296,8 +318,8 @@
                 group by DATE_FORMAT(travelTime, '%Y-%m-%d')
                 union all
             </if>
-            <if test="type == 2">
-                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, count(id), 0, sum(payMoney), 0 from t_order_taxi where isDelete = 1 and payManner = 1
+            <if test="null == type or type == 3">
+                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, count(id), 0, sum(payMoney), 0 from t_order_cross_city where isDelete = 1 and payType in (1, 2, 3)
                 <if test="null != companyId">
                     and companyId = #{companyId}
                 </if>
@@ -307,8 +329,28 @@
                 group by DATE_FORMAT(travelTime, '%Y-%m-%d')
                 union all
             </if>
-            <if test="type == 3">
-                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, count(id), 0, sum(payMoney), 0 from t_order_cross_city where isDelete = 1 and payManner = 1
+            <if test="null == type or type == 4">
+                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, count(id), 0, sum(payMoney), 0 from t_order_logistics where isDelete = 1 and payType in (1, 2, 3)
+                <if test="null != companyId">
+                    and companyId = #{companyId}
+                </if>
+                <if test="null != start and '' != start and null != end and '' != end">
+                    and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
+                </if>
+                group by DATE_FORMAT(travelTime, '%Y-%m-%d')
+                union all
+                select DATE_FORMAT(insertTime, '%Y-%m-%d'), 0, 0, 0, 0, count(id), 0, sum(money), 0 from t_income where orderType = 4 and userType = 1 and type = 3
+                <if test="null != companyId">
+                    and objectId = #{companyId}
+                </if>
+                <if test="null != start and '' != start and null != end and '' != end">
+                    and DATE_FORMAT(insertTime, '%Y-%m-%d') between #{start} and #{end}
+                </if>
+                group by DATE_FORMAT(insertTime, '%Y-%m-%d')
+                union all
+            </if>
+            <if test="null == type or type == 1">
+                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, 0, count(id), sum(payMoney), 0 from t_order_private_car where isDelete = 1 and payType in (4)
                 <if test="null != companyId">
                     and companyId = #{companyId}
                 </if>
@@ -318,8 +360,8 @@
                 group by DATE_FORMAT(travelTime, '%Y-%m-%d')
                 union all
             </if>
-            <if test="type == 4">
-                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, count(id), 0, sum(payMoney), 0 from t_order_logistics where isDelete = 1 and payManner = 1
+            <if test="null == type or type == 2">
+                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, 0, count(id), sum(payMoney), 0 from t_order_taxi where isDelete = 1 and payType in (4)
                 <if test="null != companyId">
                     and companyId = #{companyId}
                 </if>
@@ -329,8 +371,8 @@
                 group by DATE_FORMAT(travelTime, '%Y-%m-%d')
                 union all
             </if>
-            <if test="type == 1">
-                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, 0, count(id), 0, 0 from t_order_private_car where isDelete = 1 and payManner = 2
+            <if test="null == type or type == 3">
+                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, 0, count(id), sum(payMoney), 0 from t_order_cross_city where isDelete = 1 and payType in (4)
                 <if test="null != companyId">
                     and companyId = #{companyId}
                 </if>
@@ -340,30 +382,8 @@
                 group by DATE_FORMAT(travelTime, '%Y-%m-%d')
                 union all
             </if>
-            <if test="type == 2">
-                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, 0, count(id), 0, 0 from t_order_taxi where isDelete = 1 and payManner = 2
-                <if test="null != companyId">
-                    and companyId = #{companyId}
-                </if>
-                <if test="null != start and '' != start and null != end and '' != end">
-                    and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
-                </if>
-                group by DATE_FORMAT(travelTime, '%Y-%m-%d')
-                union all
-            </if>
-            <if test="type == 3">
-                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, 0, count(id), 0, 0 from t_order_cross_city where isDelete = 1 and payManner = 2
-                <if test="null != companyId">
-                    and companyId = #{companyId}
-                </if>
-                <if test="null != start and '' != start and null != end and '' != end">
-                    and DATE_FORMAT(travelTime, '%Y-%m-%d') between #{start} and #{end}
-                </if>
-                group by DATE_FORMAT(travelTime, '%Y-%m-%d')
-                union all
-            </if>
-            <if test="type == 4">
-                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, 0, count(id), 0, 0 from t_order_logistics where isDelete = 1 and payManner = 2
+            <if test="null == type or type == 4">
+                select DATE_FORMAT(travelTime, '%Y-%m-%d'), 0, 0, 0, 0, 0, count(id), sum(payMoney), 0 from t_order_logistics where isDelete = 1 and payType in (4)
                 <if test="null != companyId">
                     and companyId = #{companyId}
                 </if>

--
Gitblit v1.7.1