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 | 217 +++++++++++++++++++++++++++--------------------------
1 files changed, 111 insertions(+), 106 deletions(-)
diff --git a/ard-work/src/main/resources/mapper/app/ArdAppTaskMapper.xml b/ard-work/src/main/resources/mapper/app/ArdAppTaskMapper.xml
index b12a14b..36de4bf 100644
--- a/ard-work/src/main/resources/mapper/app/ArdAppTaskMapper.xml
+++ b/ard-work/src/main/resources/mapper/app/ArdAppTaskMapper.xml
@@ -34,6 +34,10 @@
<result property="taskId" column="sub1_task_id"/>
<result property="status" column="sub1_status"/>
<result property="clockInPicUrl" column="sub1_clock_in_pic_url"/>
+ <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"/>
@@ -59,12 +63,45 @@
c.create_by,
c.create_time,
c.update_by,
- c.update_time
+ c.update_time,
+ c.view_time,
+ c.view_position
from ard_app_task c
left join sys_dept d on d.dept_id = c.dept_id
left join sys_user u on u.user_id = c.user_id
</sql>
-
+ <sql id="selectArdAppTaskDto">
+ 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_latitude,
+ c.altitude as sub1_altitude,
+ c.user_id as sub1_user_id,
+ c.text as sub1_text,
+ c.voice as sub1_voice,
+ 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.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
+ </sql>
<select id="selectArdAppTaskList" parameterType="ArdAppTask" resultMap="ArdAppTaskResult">
<include refid="selectArdAppTaskVo"/>
<where>
@@ -83,108 +120,41 @@
</where>
</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,
- c.status as sub1_status,
- c.clock_in_pic_url as sub1_clock_in_pic_url
- 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}
- <if test="params.beginTime != null and params.beginTime != ''"><!-- 寮�濮嬫椂闂存绱� -->
- and a.create_time >= to_timestamp(#{params.beginTime},'yyyy-MM-DD HH24:MI:ss')
- </if>
- <if test="params.endTime != null and params.endTime != ''"><!-- 缁撴潫鏃堕棿妫�绱� -->
- and a.create_time <= to_timestamp(#{params.endTime},'yyyy-MM-DD HH24:MI:ss')
- </if>
+ <include refid="selectArdAppTaskDto"/>
+ <where>
+ <if test="userId != null and userId != ''">
+ and c.user_id = #{userId}
+ </if>
+ <if test="params.beginTime != null and params.beginTime != ''"><!-- 寮�濮嬫椂闂存绱� -->
+ and a.create_time >= to_timestamp(#{params.beginTime},'yyyy-MM-DD HH24:MI:ss')
+ </if>
+ <if test="params.endTime != null and params.endTime != ''"><!-- 缁撴潫鏃堕棿妫�绱� -->
+ and a.create_time <= to_timestamp(#{params.endTime},'yyyy-MM-DD HH24:MI:ss')
+ </if>
+ <!-- 鏁版嵁鑼冨洿杩囨护 -->
+ ${params.dataScope}
+ </where>
</select>
+ <select id="selectArdAppTaskListWithDetailById" parameterType="ArdAppTask" resultMap="ArdAppTaskSubResult">
+ <include refid="selectArdAppTaskDto"/>
+ <where>
+ <if test="id != null and id != ''">
+ and a.id = #{id}
+ </if>
+ <if test="userId != null and userId != ''">
+ and c.user_id = #{userId}
+ </if>
+ <if test="params.beginTime != null and params.beginTime != ''"><!-- 寮�濮嬫椂闂存绱� -->
+ and a.create_time >= to_timestamp(#{params.beginTime},'yyyy-MM-DD HH24:MI:ss')
+ </if>
+ <if test="params.endTime != null and params.endTime != ''"><!-- 缁撴潫鏃堕棿妫�绱� -->
+ and a.create_time <= to_timestamp(#{params.endTime},'yyyy-MM-DD HH24:MI:ss')
+ </if>
+ </where>
+ </select>
+
<select id="selectArdAppTaskById" parameterType="String" 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 a.id = #{id}
- </select>
- <select id="selectArdAppTaskByIdWithPic" parameterType="String" resultMap="ArdAppTaskArdAppTaskPicResult">
- 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 sub_id,
- b.task_id as sub_task_id,
- b.pic_url as sub_pic_url
- from ard_app_task a
- left join ard_app_task_pic b on b.task_id = a.id
- where a.id = #{id}
- </select>
- <select id="selectArdAppTaskByIdWithDetail" parameterType="String" resultMap="ArdAppTaskArdAppTaskDetailResult">
- 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,
- c.id as sub_id,
- c.name as sub_name,
- c.longitude as sub_longitude,
- c.latitude as sub_latitde,
- c.altitude as sub_altitude,
- c.user_id as sub_user_id,
- c.text as sub_text,
- c.voice as sub_voice,
- c.status as sub_status,
- c.clock_in_pic_url as sub_clock_in_pic_url
- from ard_app_task a
- left join ard_app_task_detail c on c.task_id = a.id
+ <include refid="selectArdAppTaskDto"/>
where a.id = #{id}
</select>
@@ -279,7 +249,8 @@
</delete>
<insert id="batchArdAppTaskDetail">
- insert into ard_app_task_detail( id, name, longitude, latitude, altitude, user_id, text, voice, task_id,status,clock_in_pic_url) values
+ insert into ard_app_task_detail( id, name, longitude, latitude, altitude, user_id, text, voice,
+ task_id,status,clock_in_pic_url) values
<foreach item="item" index="index" collection="list" separator=",">
( #{item.id}, #{item.name}, #{item.longitude}, #{item.latitude}, #{item.altitude}, #{item.userId},
#{item.text}, #{item.voice}, #{item.taskId}, #{item.status}, #{item.clockInPicUrl})
@@ -293,8 +264,27 @@
<if test="clockInPicUrl != null">clock_in_pic_url = #{clockInPicUrl},</if>
<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
+ set view_time=#{viewTime},
+ view_position=#{viewPosition}
+ where task_id = #{taskId}
+ and user_id = #{userId}
</update>
<insert id="batchArdAppTaskDetailPic">
insert into ard_app_task_detail_pic( id, task_detail_id, pic_url) values
@@ -308,8 +298,7 @@
where task_detail_id = #{taskDetailId}
</delete>
<select id="selectArdAppTaskDetailById" parameterType="String" resultType="ArdAppTaskDetail">
- select
- c.id,
+ select c.id,
c.name,
c.longitude,
c.latitude,
@@ -318,8 +307,24 @@
c.text,
c.voice,
c.status,
- c.clock_in_pic_url
+ c.clock_in_pic_url,
+ c.view_time,
+ c.view_position
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