Kaynağa Gözat

Merge remote-tracking branch 'origin/dev2' into dev2

chendayu 2 yıl önce
ebeveyn
işleme
cb39965a53
1 değiştirilmiş dosya ile 156 ekleme ve 0 silme
  1. 156 0
      RMS/src/main/resources/mapper/FollowUpMapper.xml

+ 156 - 0
RMS/src/main/resources/mapper/FollowUpMapper.xml

@@ -0,0 +1,156 @@
+<?xml version="1.0" encoding="UTF-8" ?>
+<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
+
+<mapper namespace="cn.cslg.report.mapper.FollowUpMapper">
+    <!--插入数据-->
+    <!--int add(FollowUp followUp);-->
+    <insert id="add" useGeneratedKeys="true" keyProperty="id">
+        insert into follow_up(report_id, parent_id, follow_up_name, remark, time_limit,
+                              agent, assist_person, finish_time, status, conclusion, create_person_id,
+                              create_person_name)
+        values
+            (#{reportId}, #{parentId}, #{followUpName}, #{remark},
+             #{timeLimit}, #{agent}, #{assistPerson}, #{finishTime}, #{status},
+             #{conclusion}, #{createPersonId}, #{createPersonName})
+    </insert>
+    <!--根据id修改数据-->
+    <!--int update(FollowUp followUp);-->
+    <update id="update">
+        update follow_up
+        <set>
+            <if test="followUpName != null">
+                follow_up_name = #{followUpName},
+            </if>
+            <if test="remark != null">
+                remark = #{remark},
+            </if>
+            <if test="timeLimit != null">
+                time_limit = #{timeLimit},
+            </if>
+            <if test="agent != null">
+                agent = #{agent},
+            </if>
+            <if test="assistPerson != null">
+                assist_person = #{assistPerson},
+            </if>
+            <if test="finishTime != null">
+                finish_time = #{finishTime},
+            </if>
+            <if test="status != null">
+                status = #{status},
+            </if>
+            <if test="conclusion != null">
+                conclusion = #{conclusion},
+            </if>
+        </set>
+        where id = #{id}
+    </update>
+
+    <!--根据报告id查询后续事项-->
+    <!--List<FollowUpVO> query(Integer reportId);-->
+    <resultMap id="queryMap" type="cn.cslg.report.common.model.vo.FollowUpVO">
+        <id column="id" property="id"/>
+        <result column="report_id" property="reportId"/>
+        <result column="parent_id" property="parentId"/>
+        <result column="follow_up_name" property="followUpName"/>
+        <result column="remark" property="remark"/>
+        <result column="time_limit" property="timeLimit"/>
+        <result column="agent" property="agent"/>
+        <result column="assist_person" property="assistPerson"/>
+        <result column="finish_time" property="finishTime"/>
+        <result column="status" property="status"/>
+        <result column="conclusion" property="conclusion"/>
+        <result column="create_person_id" property="createPersonId"/>
+        <result column="create_person_name" property="createPersonName"/>
+        <result column="create_time" property="createTime"/>
+        <collection property="filesVOs" resultMap="FilesVOsResultMap"/>
+    </resultMap>
+    <resultMap id="FilesVOsResultMap" type="cn.cslg.report.common.model.vo.FilesVO">
+        <result column="file_id" property="fileId"/>
+        <result column="name" property="name"/>
+        <result column="address" property="url"/>
+        <result column="ZID" property="zId"/>
+        <result column="FILEREMARK" property="remark"/>
+        <result column="update_time" property="updateTime"/>
+        <result column="UID" property="uId"/>
+        <result column="type" property="type"/>
+        <result column="suffix" property="suffix"/>
+        <result column="file_name" property="fileName"/>
+    </resultMap>
+
+    <!--    <select id="query" resultMap="queryMap">-->
+    <!--        select id,-->
+    <!--               report_id,-->
+    <!--               parent_id,-->
+    <!--               follow_up_name,-->
+    <!--               remark,-->
+    <!--               time_limit,-->
+    <!--               agent,-->
+    <!--               assist_person,-->
+    <!--               finish_time,-->
+    <!--               status,-->
+    <!--               conclusion,-->
+    <!--               create_person_id,-->
+    <!--               create_person_name,-->
+    <!--               create_time-->
+    <!--        from follow_up-->
+    <!--        where report_id = #{reportId}-->
+    <!--    </select>-->
+
+    <select id="query" resultMap="queryMap">
+        select a.id, a.report_id, a.parent_id, a.follow_up_name,a.remark,a.time_limit,a.agent,a.assist_person,a.finish_time,a.status, a.conclusion,
+               a.create_person_id, a.create_person_name, a.create_time, d.FILE_ID, d.NAME, d.ADDRESS, d.ZID,d.FILEREMARK, d.UPDATE_TIME, d.UID,d.TYPE, d.SIZE, d.SUFFIX, d.FILE_NAME
+        from follow_up a left JOIN (SELECT b.follow_up_id, b.FILE_ID, c.ID, c.NAME, c.ADDRESS, c.ZID, c.REMARK AS FILEREMARK, c.UPDATE_TIME, c.UID, c.TYPE, c.SIZE, c.SUFFIX, c.FILE_NAME
+                                    FROM asso_follow_up_file b LEFT JOIN report_file c ON b.FILE_ID = c.ID) d
+                                   ON a.ID = d.FOLLOW_UP_ID
+        WHERE a.report_id = #{reportId} ORDER BY create_time DESC
+    </select>
+
+    <!--根据报告id统计后续事项数量-->
+    <!--int countByReportId();-->
+    <select id="countByReportId" resultType="int">
+        select count(*)
+        from follow_up
+        where report_id = #{reportId}
+    </select>
+
+    <!--根据ids删除数据-->
+    <!--int delete(List<Integer> ids);-->
+    <delete id="delete" parameterType="java.util.List">
+        delete
+        from follow_up
+        where id in
+        <foreach collection="ids" item="id" index="index" open="(" close=")" separator=",">
+            #{id}
+        </foreach>
+    </delete>
+
+    <!--根据后续事项id和文件id删除数据-->
+    <!--int deleteAssoId(Integer followUpId, Integer fileId);-->
+    <delete id="deleteAssoId">
+        delete
+        from asso_follow_up_file
+        where follow_up_id = #{followUpId}
+        and FILE_ID in
+        <foreach collection="fileIds" item="fileId" index="index" open="(" close=")" separator=",">
+            #{fileId}
+        </foreach>
+    </delete>
+
+
+    <!--根据报告id统计后续事项数量-->
+    <!--List<Integer> queryFileIdByFollowUpId(Integer followUpId);-->
+    <select id="queryFileIdByFollowUpId" resultType="Integer">
+        SELECT FILE_ID FROM asso_follow_up_file WHERE FOLLOW_UP_ID = #{followUpId};
+    </select>
+
+
+    <!--插入数据-->
+    <!--int addAssoIds(AssoFollowUpFile assoFollowUpFile);-->
+    <insert id="addAssoIds" useGeneratedKeys="true" keyProperty="id">
+        insert into asso_follow_up_file(follow_up_id, file_id, file_type)
+        values
+            (#{followUpId}, #{fileId}, #{fileType})
+    </insert>
+
+</mapper>