|  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <resultMap type="ArdAppTask" id="ArdAppTaskResult"> | 
|---|
|  |  |  | <result property="id" column="id"/> | 
|---|
|  |  |  | <result property="type" column="type"/> | 
|---|
|  |  |  | <result property="name" column="name"/> | 
|---|
|  |  |  | <result property="text" column="text"/> | 
|---|
|  |  |  | <result property="voice" column="voice"/> | 
|---|
|  |  |  | 
|---|
|  |  |  | <result property="updateBy" column="update_by"/> | 
|---|
|  |  |  | <result property="updateTime" column="update_time"/> | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <resultMap id="ArdAppTaskSubResult" type="ArdAppTask" extends="ArdAppTaskResult"> | 
|---|
|  |  |  | <collection property="ardAppTaskDetailList" column="{id=id,detailUserId=detail_user_id}" | 
|---|
|  |  |  | select="selectArdAppTaskDetailListByIdAndUserId"/> | 
|---|
|  |  |  | <collection property="ardAppTaskPicList" column="id" | 
|---|
|  |  |  | select="selectArdAppTaskPicListById"/> | 
|---|
|  |  |  | <!--        <collection property="ardAppTaskPicList" notNullColumn="sub2_id" javaType="java.util.List"--> | 
|---|
|  |  |  | <!--                    resultMap="ArdAppTaskPicResult"/>--> | 
|---|
|  |  |  | <!--        <collection property="ardAppTaskDetailList" notNullColumn="sub1_id" javaType="java.util.List"--> | 
|---|
|  |  |  | <!--                    resultMap="ArdAppTaskDetailResult"/>--> | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  | <resultMap id="ArdAppTaskSub1Result" type="ArdAppTask" extends="ArdAppTaskResult"> | 
|---|
|  |  |  | <collection property="ardAppTaskPicList" notNullColumn="sub2_id" javaType="java.util.List" | 
|---|
|  |  |  | resultMap="ArdAppTaskPicResult"/> | 
|---|
|  |  |  | <collection property="ardAppTaskDetailList" notNullColumn="sub1_id" javaType="java.util.List" | 
|---|
|  |  |  | 
|---|
|  |  |  | <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"/> | 
|---|
|  |  |  | <result property="taskId" column="sub2_task_id"/> | 
|---|
|  |  |  | <result property="picUrl" column="sub2_pic_url"/> | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  | <resultMap id="ArdAppTaskArdAppTaskPicResult" type="ArdAppTask" extends="ArdAppTaskResult"> | 
|---|
|  |  |  | <collection property="ardAppTaskPicList" notNullColumn="sub_id" javaType="java.util.List" | 
|---|
|  |  |  | resultMap="ArdAppTaskPicResult"/> | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  | <resultMap id="ArdAppTaskArdAppTaskDetailResult" type="ArdAppTask" extends="ArdAppTaskResult"> | 
|---|
|  |  |  | <collection property="ardAppTaskDetailList" notNullColumn="sub_id" javaType="java.util.List" | 
|---|
|  |  |  | resultMap="ArdAppTaskDetailResult"/> | 
|---|
|  |  |  | </resultMap> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <sql id="selectArdAppTaskVo"> | 
|---|
|  |  |  | select c.id, | 
|---|
|  |  |  | c.type, | 
|---|
|  |  |  | c.name, | 
|---|
|  |  |  | c.text, | 
|---|
|  |  |  | c.voice, | 
|---|
|  |  |  | 
|---|
|  |  |  | 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.type, | 
|---|
|  |  |  | 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, | 
|---|
|  |  |  | c.task_id          as sub1_task_id | 
|---|
|  |  |  | 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> | 
|---|
|  |  |  | <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="type != null  and type != ''">and c.type = #{type}</if> | 
|---|
|  |  |  | <if test="name != null  and name != ''">and c.name like '%'||#{name}||'%'</if> | 
|---|
|  |  |  | <if test="text != null  and text != ''">and c.text = #{text}</if> | 
|---|
|  |  |  | <if test="voice != null  and voice != ''">and c.voice = #{voice}</if> | 
|---|
|  |  |  | <if test="params.beginTime != null and params.beginTime != ''"><!-- 开始时间检索 --> | 
|---|
|  |  |  | and create_time >= to_timestamp(#{params.beginTime},'yyyy-MM-DD HH24:MI:ss') | 
|---|
|  |  |  | and c.create_time >= to_timestamp(#{params.beginTime},'yyyy-MM-DD HH24:MI:ss') | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="params.endTime != null and params.endTime != ''"><!-- 结束时间检索 --> | 
|---|
|  |  |  | and create_time <= to_timestamp(#{params.endTime},'yyyy-MM-DD HH24:MI:ss') | 
|---|
|  |  |  | and c.create_time <= to_timestamp(#{params.endTime},'yyyy-MM-DD HH24:MI:ss') | 
|---|
|  |  |  | </if> | 
|---|
|  |  |  | <if test="userId != null  and userId != ''">and user_id = #{userId}</if> | 
|---|
|  |  |  | <!-- 数据范围过滤 --> | 
|---|
|  |  |  | ${params.dataScope} | 
|---|
|  |  |  | <if test="userId != null  and userId != ''">and c.user_id = #{userId}</if> | 
|---|
|  |  |  | </where> | 
|---|
|  |  |  | order by c.create_time desc | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <select id="selectArdAppTaskListWithDetail" parameterType="ArdAppTask" resultMap="ArdAppTaskSubResult"> | 
|---|
|  |  |  | select DISTINCT(a.id)as idd,c.user_id as detail_user_id,a.* from ard_app_task a | 
|---|
|  |  |  | LEFT JOIN ard_app_task_detail c on c.task_id=a.id | 
|---|
|  |  |  | <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> | 
|---|
|  |  |  | order by a.create_time desc | 
|---|
|  |  |  | </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="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> | 
|---|
|  |  |  | <select id="selectArdAppTaskDetailListByTaskId" resultType="ArdAppTaskDetail"> | 
|---|
|  |  |  | select * from ard_app_task_detail where task_id=#{taskId} | 
|---|
|  |  |  | </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 | 
|---|
|  |  |  | <select id="selectArdAppTaskById" parameterType="String" resultMap="ArdAppTaskSub1Result"> | 
|---|
|  |  |  | <include refid="selectArdAppTaskDto"/> | 
|---|
|  |  |  | 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 id="selectArdAppTaskDetailListByIdAndUserId" resultType="ArdAppTaskDetail"> | 
|---|
|  |  |  | select * | 
|---|
|  |  |  | from ard_app_task_detail d | 
|---|
|  |  |  | where d.task_id = #{id} | 
|---|
|  |  |  | and d.user_id = #{detailUserId} | 
|---|
|  |  |  | </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 | 
|---|
|  |  |  | where a.id = #{id} | 
|---|
|  |  |  | <select id="selectArdAppTaskPicListById" resultType="ArdAppTaskPic"> | 
|---|
|  |  |  | select * | 
|---|
|  |  |  | from ard_app_task_pic d | 
|---|
|  |  |  | where d.task_id = #{id} | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  | <select id="selectArdAppTaskDetailUserIdsByTaskId" parameterType="String" resultType="java.lang.String"> | 
|---|
|  |  |  | select DISTINCT(user_id) | 
|---|
|  |  |  | from ard_app_task_detail | 
|---|
|  |  |  | where task_id = #{taskId} | 
|---|
|  |  |  | </select> | 
|---|
|  |  |  |  | 
|---|
|  |  |  |  | 
|---|
|  |  |  | <insert id="insertArdAppTask" parameterType="ArdAppTask"> | 
|---|
|  |  |  | insert into ard_app_task | 
|---|
|  |  |  | <trim prefix="(" suffix=")" suffixOverrides=","> | 
|---|
|  |  |  | <if test="id != null">id,</if> | 
|---|
|  |  |  | <if test="type != null">type,</if> | 
|---|
|  |  |  | <if test="name != null">name,</if> | 
|---|
|  |  |  | <if test="text != null">text,</if> | 
|---|
|  |  |  | <if test="voice != null">voice,</if> | 
|---|
|  |  |  | 
|---|
|  |  |  | </trim> | 
|---|
|  |  |  | <trim prefix="values (" suffix=")" suffixOverrides=","> | 
|---|
|  |  |  | <if test="id != null">#{id},</if> | 
|---|
|  |  |  | <if test="type != null">#{type},</if> | 
|---|
|  |  |  | <if test="name != null">#{name},</if> | 
|---|
|  |  |  | <if test="text != null">#{text},</if> | 
|---|
|  |  |  | <if test="voice != null">#{voice},</if> | 
|---|
|  |  |  | 
|---|
|  |  |  | <update id="updateArdAppTask" parameterType="ArdAppTask"> | 
|---|
|  |  |  | update ard_app_task | 
|---|
|  |  |  | <trim prefix="SET" suffixOverrides=","> | 
|---|
|  |  |  | <if test="type != null">type = #{type},</if> | 
|---|
|  |  |  | <if test="name != null">name = #{name},</if> | 
|---|
|  |  |  | <if test="text != null">text = #{text},</if> | 
|---|
|  |  |  | <if test="voice != null">voice = #{voice},</if> | 
|---|
|  |  |  | 
|---|
|  |  |  | </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}) | 
|---|
|  |  |  | 
|---|
|  |  |  | <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 | 
|---|
|  |  |  | 
|---|
|  |  |  | from ard_app_task_detail_pic | 
|---|
|  |  |  | where task_detail_id = #{taskDetailId} | 
|---|
|  |  |  | </delete> | 
|---|
|  |  |  | <select id="selectArdAppTaskDetailById" parameterType="String" resultType="ArdAppTaskDetail"> | 
|---|
|  |  |  | select c.id, | 
|---|
|  |  |  | c.name, | 
|---|
|  |  |  | c.longitude, | 
|---|
|  |  |  | c.latitude, | 
|---|
|  |  |  | c.altitude, | 
|---|
|  |  |  | c.user_id, | 
|---|
|  |  |  | c.text, | 
|---|
|  |  |  | c.voice, | 
|---|
|  |  |  | c.status, | 
|---|
|  |  |  | 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="ArdAppTaskSub1Result"> | 
|---|
|  |  |  | <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(DISTINCT 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> | 
|---|