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

---
 DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/DriverActivityHistoryMapper.xml |   39 ++++++++++++++++++++++++++++++++-------
 1 files changed, 32 insertions(+), 7 deletions(-)

diff --git a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/DriverActivityHistoryMapper.xml b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/DriverActivityHistoryMapper.xml
index d7f2ee7..d1f80e0 100644
--- a/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/DriverActivityHistoryMapper.xml
+++ b/DriverIGOTravel/guns-admin/src/main/java/com/stylefeng/guns/modular/system/dao/mapping/DriverActivityHistoryMapper.xml
@@ -19,14 +19,15 @@
 
     <select id="query" resultType="map">
         select
-        aa.*,
-        (CASE WHEN (select count(id) from t_driver_activity_history where driverId = #{driverId} and carryOut = 1 and `day` = aa.time) = 0 THEN 2 ELSE 1 END) carryOut
+        a.*,
+        CASE WHEN b.num = 0 THEN 2 ELSE 1 END as carryOut
         from (
-            select
-            DATE_FORMAT(`day`, '%Y-%m-%d') as time,
-            DATE_FORMAT(`day`, '%Y-%m-%d') as paramTime
-            from t_driver_activity_history where driverId = #{driverId} group by `day`
-        ) as aa order by aa.time desc limit #{pageNum}, #{size}
+        select
+        DATE_FORMAT(`day`, '%Y-%m-%d') as time,
+        DATE_FORMAT(`day`, '%Y-%m-%d') as paramTime
+        from t_driver_activity_history where driverId = #{driverId} group by `day`
+        ) as a
+        left join (select `day`, count(id) as num from t_driver_activity_history where driverId = #{driverId} and carryOut = 1 group by `day`) b on (a.time = b.`day`) order by a.time desc limit #{pageNum}, #{size}
     </select>
 
     <select id="queryList" resultType="DriverActivityHistory">
@@ -50,4 +51,28 @@
             and driverId = #{driverId}
         </if>
     </select>
+    
+    
+    
+    <select id="queryHistoryList" resultType="DriverActivityHistory">
+        select
+        id as id,
+        `day` as `day`,
+        driverId as driverId,
+        `type` as `type`,
+        activityId as activityId,
+        carryOut as carryOut,
+        money as money,
+        insertTime as insertTime
+        from t_driver_activity_history where `day` between #{start} and #{end}
+        <if test="null != type">
+            and `type` = #{type}
+        </if>
+        <if test="null != carryOut">
+            and carryOut = #{carryOut}
+        </if>
+        <if test="null != driverId">
+            and driverId = #{driverId}
+        </if>
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.7.1