From 2f07c0e336517efc48f0386eb04bee28804af5a7 Mon Sep 17 00:00:00 2001
From: ‘liusuyi’ <1951119284@qq.com>
Date: 星期二, 25 七月 2023 10:44:41 +0800
Subject: [PATCH] 增加app任务打卡 增加app按用户查询任务列表

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

diff --git a/ard-work/src/main/resources/mapper/app/ArdAppTaskMapper.xml b/ard-work/src/main/resources/mapper/app/ArdAppTaskMapper.xml
index b3c7423..297f886 100644
--- a/ard-work/src/main/resources/mapper/app/ArdAppTaskMapper.xml
+++ b/ard-work/src/main/resources/mapper/app/ArdAppTaskMapper.xml
@@ -52,8 +52,8 @@
                c.name,
                c.text,
                c.voice,
-               c.dept_id,
-               c.user_id,
+               d.dept_id,
+               u.user_id,
                c.create_by,
                c.create_time,
                c.update_by,
@@ -69,16 +69,37 @@
             <if test="name != null  and name != ''">and name like '%'||#{name}||'%'</if>
             <if test="text != null  and text != ''">and text = #{text}</if>
             <if test="voice != null  and voice != ''">and voice = #{voice}</if>
-            <if test="deptId != null and deptId != 0 ">
-            and (c.dept_id = #{deptId} OR c.dept_id IN ( SELECT t.dept_id FROM sys_dept t
-                WHERE cast(#{deptId} as varchar) = any(string_to_array(ancestors,',')) ))
-            </if>
-            <if test="userId != null  and userId != ''">and user_id = #{userId}</if>
+            <!-- 鏁版嵁鑼冨洿杩囨护 -->
+            ${params.dataScope}
         </where>
-        <!-- 鏁版嵁鑼冨洿杩囨护 -->
-        ${params.dataScope}
     </select>
-
+    <select id="selectArdAppTaskListWithDetail" parameterType="ArdAppTask" resultMap="ArdAppTaskSubResult">
+        select a.id,
+        a.name,
+        a.text,
+        a.voice,
+        a.dept_id,
+        a.user_id,
+        a.create_by,
+        a.create_time,
+        a.update_by,
+        a.update_time,
+        b.id      as sub2_id,
+        b.task_id as sub2_task_id,
+        b.pic_url as sub2_pic_url,
+        c.id   as sub1_id,
+        c.name as sub1_name,
+        c.longitude as sub1_longitude,
+        c.latitude as sub1_latitde,
+        c.altitude as sub1_altitude,
+        c.user_id as sub1_user_id,
+        c.text as sub1_text,
+        c.voice as sub1_voice
+        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
+        where c.user_id = #{userId}
+    </select>
     <select id="selectArdAppTaskById" parameterType="String" resultMap="ArdAppTaskSubResult">
         select a.id,
                a.name,
@@ -224,6 +245,7 @@
             ( #{item.id}, #{item.taskId}, #{item.picUrl})
         </foreach>
     </insert>
+
     <delete id="deleteArdAppTaskDetailByTaskIds" parameterType="String">
         delete from ard_app_task_detail where task_id in
         <foreach item="taskId" collection="array" open="(" separator="," close=")">
@@ -244,4 +266,24 @@
             #{item.text}, #{item.voice}, #{item.taskId})
         </foreach>
     </insert>
+
+    <update id="updateArdAppTaskDetail" parameterType="ArdAppTaskDetail">
+        update ard_app_task_detail
+        <trim prefix="SET" suffixOverrides=",">
+            <if test="text != null">text = #{text},</if>
+            <if test="voice != null">voice = #{voice},</if>
+        </trim>
+        where id = #{id}
+    </update>
+    <insert id="batchArdAppTaskDetailPic">
+        insert into ard_app_task_detail_pic( id, task_detail_id, pic_url) values
+        <foreach item="item" index="index" collection="list" separator=",">
+            ( #{item.id}, #{item.taskDetailId}, #{item.picUrl})
+        </foreach>
+    </insert>
+    <delete id="deleteArdAppTaskDetailPicByTaskDetailId" parameterType="String">
+        delete
+        from ard_app_task_detail_pic
+        where task_detail_id = #{taskDetailId}
+    </delete>
 </mapper>
\ No newline at end of file

--
Gitblit v1.9.3