| | |
| | | |
| | | <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" |
| | | resultMap="ArdAppTaskDetailResult"/> |
| | | <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 type="ArdAppTaskDetail" id="ArdAppTaskDetailResult"> |
| | | <result property="id" column="sub1_id"/> |
| | |
| | | |
| | | <sql id="selectArdAppTaskVo"> |
| | | select c.id, |
| | | c.type, |
| | | c.name, |
| | | c.text, |
| | | c.voice, |
| | |
| | | </sql> |
| | | <sql id="selectArdAppTaskDto"> |
| | | select a.id, |
| | | a.type, |
| | | a.name, |
| | | a.text, |
| | | a.voice, |
| | |
| | | <select id="selectArdAppTaskList" parameterType="ArdAppTask" resultMap="ArdAppTaskResult"> |
| | | <include refid="selectArdAppTaskVo"/> |
| | | <where> |
| | | <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> |
| | | <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> |
| | | order by a.create_time desc |
| | | </select> |
| | | |
| | | <select id="selectArdAppTaskListWithDetailById" parameterType="ArdAppTask" resultMap="ArdAppTaskSubResult"> |
| | | <include refid="selectArdAppTaskDto"/> |
| | | <where> |
| | |
| | | </if> |
| | | </where> |
| | | </select> |
| | | |
| | | <select id="selectArdAppTaskDetailListByTaskId" resultType="ArdAppTaskDetail"> |
| | | select * |
| | | from ard_app_task_detail |
| | | where task_id = #{taskId} |
| | | </select> |
| | | <select id="selectArdAppTaskById" parameterType="String" resultMap="ArdAppTaskSub1Result"> |
| | | <include refid="selectArdAppTaskDto"/> |
| | | where a.id = #{id} |
| | | </select> |
| | | |
| | | <select id="selectArdAppTaskDetailListByIdAndUserId" resultType="ArdAppTaskDetail"> |
| | | select * from ard_app_task_detail d |
| | | where d.task_id = #{id} and d.user_id = #{detailUserId} |
| | | select * |
| | | from ard_app_task_detail d |
| | | where d.task_id = #{id} |
| | | and d.user_id = #{detailUserId} |
| | | </select> |
| | | <select id="selectArdAppTaskPicListById" resultType="ArdAppTaskPic"> |
| | | select * from ard_app_task_pic d where d.task_id = #{id} |
| | | 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 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> |
| | |
| | | <if test="updateTime != null">#{updateTime},</if> |
| | | </trim> |
| | | </insert> |
| | | |
| | | <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> |
| | |
| | | </trim> |
| | | where id = #{id} |
| | | </update> |
| | | |
| | | <delete id="deleteArdAppTaskById" parameterType="String"> |
| | | delete |
| | | from ard_app_task |
| | | where id = #{id} |
| | | </delete> |
| | | |
| | | <delete id="deleteArdAppTaskByIds" parameterType="String"> |
| | | delete from ard_app_task where id in |
| | | <foreach item="id" collection="array" open="(" separator="," close=")"> |
| | | #{id} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <delete id="deleteArdAppTaskPicByTaskIds" parameterType="String"> |
| | | delete from ard_app_task_pic where task_id in |
| | | <foreach item="taskId" collection="array" open="(" separator="," close=")"> |
| | | #{taskId} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <delete id="deleteArdAppTaskPicByTaskId" parameterType="String"> |
| | | delete |
| | | from ard_app_task_pic |
| | | where task_id = #{taskId} |
| | | </delete> |
| | | |
| | | <insert id="batchArdAppTaskPic"> |
| | | insert into ard_app_task_pic( id, task_id, pic_url) values |
| | | <foreach item="item" index="index" collection="list" separator=","> |
| | | ( #{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=")"> |
| | | #{taskId} |
| | | </foreach> |
| | | </delete> |
| | | |
| | | <delete id="deleteArdAppTaskDetailByTaskId" parameterType="String"> |
| | | delete |
| | | from ard_app_task_detail |
| | | where task_id = #{taskId} |
| | | </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 |
| | |
| | | #{item.text}, #{item.voice}, #{item.taskId}, #{item.status}, #{item.clockInPicUrl}) |
| | | </foreach> |
| | | </insert> |
| | | |
| | | <update id="updateArdAppTaskDetail" parameterType="ArdAppTaskDetail"> |
| | | update ard_app_task_detail |
| | | <trim prefix="SET" suffixOverrides=","> |
| | |
| | | from ard_app_task_detail c |
| | | where c.id = #{id} |
| | | </select> |
| | | <select id="selectNewArdAppTaskByUserId" parameterType="String" resultMap="ArdAppTaskSubResult"> |
| | | <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(A.ID) |
| | | 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 |