From e7ebe2512258e91e6003467b2f613f8188db6f5d Mon Sep 17 00:00:00 2001
From: ‘liusuyi’ <1951119284@qq.com>
Date: 星期一, 31 七月 2023 10:28:45 +0800
Subject: [PATCH] 修复单兵端 - 下发给我的任务列表分页问题

---
 ard-work/src/main/resources/mapper/app/ArdAppTaskMapper.xml |   30 +++++++++++++++++++++++++++++-
 1 files changed, 29 insertions(+), 1 deletions(-)

diff --git a/ard-work/src/main/resources/mapper/app/ArdAppTaskMapper.xml b/ard-work/src/main/resources/mapper/app/ArdAppTaskMapper.xml
index de83c72..36de4bf 100644
--- a/ard-work/src/main/resources/mapper/app/ArdAppTaskMapper.xml
+++ b/ard-work/src/main/resources/mapper/app/ArdAppTaskMapper.xml
@@ -37,6 +37,7 @@
         <result property="viewTime" column="sub1_view_time"/>
         <result property="viewPosition" column="sub1_view_position"/>
         <result property="clockInTime" column="sub1_clock_in_time"/>
+        <result property="viewFlag" column="sub1_view_flag"/>
     </resultMap>
     <resultMap type="ArdAppTaskPic" id="ArdAppTaskPicResult">
         <result property="id" column="sub2_id"/>
@@ -94,7 +95,9 @@
                c.status           as sub1_status,
                c.clock_in_pic_url as sub1_clock_in_pic_url,
                c.view_time        as sub1_view_time,
-               c.view_position    as sub1_view_position
+               c.view_position    as sub1_view_position,
+               c.clock_in_time    as sub1_clock_in_time,
+               c.view_flag        as sub1_view_flag
         from ard_app_task a
                  left join ard_app_task_pic b on b.task_id = a.id
                  left join ard_app_task_detail c on c.task_id = a.id
@@ -128,6 +131,8 @@
             <if test="params.endTime != null and params.endTime != ''"><!-- 缁撴潫鏃堕棿妫�绱� -->
                 and a.create_time &lt;= to_timestamp(#{params.endTime},'yyyy-MM-DD HH24:MI:ss')
             </if>
+            <!-- 鏁版嵁鑼冨洿杩囨护 -->
+            ${params.dataScope}
         </where>
     </select>
     <select id="selectArdAppTaskListWithDetailById" parameterType="ArdAppTask" resultMap="ArdAppTaskSubResult">
@@ -260,10 +265,19 @@
             <if test="text != null">text = #{text},</if>
             <if test="voice != null">voice = #{voice},</if>
             <if test="viewTime != null">view_time = #{viewTime},</if>
+            <if test="viewFlag != null">view_flag = #{viewFlag},</if>
             <if test="viewPosition != null">view_position = #{viewPosition},</if>
             <if test="clockInTime != null">clock_in_time = #{clockInTime},</if>
+            <if test="taskId != null">task_id = #{taskId},</if>
         </trim>
         where id = #{id}
+    </update>
+    <update id="updateArdAppTaskDetailByTaskId" parameterType="ArdAppTaskDetail">
+        update ard_app_task_detail
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="viewFlag != null">view_flag = #{viewFlag},</if>
+        </trim>
+        where task_id = #{taskId}
     </update>
     <update id="updateArdAppTaskDetailView" parameterType="ArdAppTaskDetail">
         update ard_app_task_detail
@@ -299,4 +313,18 @@
         from ard_app_task_detail c
         where c.id = #{id}
     </select>
+    <select id="selectNewArdAppTaskByUserId" parameterType="String" resultMap="ArdAppTaskSubResult">
+        <include refid="selectArdAppTaskDto"/>
+        where c.user_id = #{userId} AND c.view_flag is null
+        order by create_time desc limit 1
+    </select>
+    <select id="selectUnreadArdAppTaskCount" resultType="Integer">
+        SELECT COUNT( A.ID )
+        FROM ard_app_task
+        A LEFT JOIN ard_app_task_detail C ON C.task_id = A.ID
+        WHERE
+            C.view_time IS NULL
+          AND  C.view_flag = '1'
+          AND C.user_id = #{userId}
+    </select>
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.3