FollowUpMapper.xml 6.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd" >
  3. <mapper namespace="cn.cslg.report.mapper.FollowUpMapper">
  4. <!--插入数据-->
  5. <!--int add(FollowUp followUp);-->
  6. <insert id="add" useGeneratedKeys="true" keyProperty="id">
  7. insert into follow_up(report_id, parent_id, follow_up_name, remark, time_limit,
  8. agent, assist_person, finish_time, status, conclusion, create_person_id,
  9. create_person_name)
  10. values
  11. (#{reportId}, #{parentId}, #{followUpName}, #{remark},
  12. #{timeLimit}, #{agent}, #{assistPerson}, #{finishTime}, #{status},
  13. #{conclusion}, #{createPersonId}, #{createPersonName})
  14. </insert>
  15. <!--根据id修改数据-->
  16. <!--int update(FollowUp followUp);-->
  17. <update id="update">
  18. update follow_up
  19. <set>
  20. <if test="followUpName != null">
  21. follow_up_name = #{followUpName},
  22. </if>
  23. <if test="remark != null">
  24. remark = #{remark},
  25. </if>
  26. <if test="timeLimit != null">
  27. time_limit = #{timeLimit},
  28. </if>
  29. <if test="agent != null">
  30. agent = #{agent},
  31. </if>
  32. <if test="assistPerson != null">
  33. assist_person = #{assistPerson},
  34. </if>
  35. <if test="finishTime != null">
  36. finish_time = #{finishTime},
  37. </if>
  38. <if test="status != null">
  39. status = #{status},
  40. </if>
  41. <if test="conclusion != null">
  42. conclusion = #{conclusion},
  43. </if>
  44. </set>
  45. where id = #{id}
  46. </update>
  47. <!--根据报告id查询后续事项-->
  48. <!--List<FollowUpVO> query(Integer reportId);-->
  49. <resultMap id="queryMap" type="cn.cslg.report.common.model.vo.FollowUpVO">
  50. <id column="id" property="id"/>
  51. <result column="report_id" property="reportId"/>
  52. <result column="parent_id" property="parentId"/>
  53. <result column="follow_up_name" property="followUpName"/>
  54. <result column="remark" property="remark"/>
  55. <result column="time_limit" property="timeLimit"/>
  56. <result column="agent" property="agent"/>
  57. <result column="assist_person" property="assistPerson"/>
  58. <result column="finish_time" property="finishTime"/>
  59. <result column="status" property="status"/>
  60. <result column="conclusion" property="conclusion"/>
  61. <result column="create_person_id" property="createPersonId"/>
  62. <result column="create_person_name" property="createPersonName"/>
  63. <result column="create_time" property="createTime"/>
  64. <collection property="filesVOs" resultMap="FilesVOsResultMap"/>
  65. </resultMap>
  66. <resultMap id="FilesVOsResultMap" type="cn.cslg.report.common.model.vo.FilesVO">
  67. <result column="file_id" property="fileId"/>
  68. <result column="name" property="name"/>
  69. <result column="address" property="url"/>
  70. <result column="ZID" property="zId"/>
  71. <result column="FILEREMARK" property="remark"/>
  72. <result column="update_time" property="updateTime"/>
  73. <result column="UID" property="uId"/>
  74. <result column="type" property="type"/>
  75. <result column="suffix" property="suffix"/>
  76. <result column="file_name" property="fileName"/>
  77. </resultMap>
  78. <!-- <select id="query" resultMap="queryMap">-->
  79. <!-- select id,-->
  80. <!-- report_id,-->
  81. <!-- parent_id,-->
  82. <!-- follow_up_name,-->
  83. <!-- remark,-->
  84. <!-- time_limit,-->
  85. <!-- agent,-->
  86. <!-- assist_person,-->
  87. <!-- finish_time,-->
  88. <!-- status,-->
  89. <!-- conclusion,-->
  90. <!-- create_person_id,-->
  91. <!-- create_person_name,-->
  92. <!-- create_time-->
  93. <!-- from follow_up-->
  94. <!-- where report_id = #{reportId}-->
  95. <!-- </select>-->
  96. <select id="query" resultMap="queryMap">
  97. 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,
  98. 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
  99. 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
  100. FROM asso_follow_up_file b LEFT JOIN report_file c ON b.FILE_ID = c.ID) d
  101. ON a.ID = d.FOLLOW_UP_ID
  102. WHERE a.report_id = #{reportId} ORDER BY create_time DESC
  103. </select>
  104. <!--根据报告id统计后续事项数量-->
  105. <!--int countByReportId();-->
  106. <select id="countByReportId" resultType="int">
  107. select count(*)
  108. from follow_up
  109. where report_id = #{reportId}
  110. </select>
  111. <!--根据ids删除数据-->
  112. <!--int delete(List<Integer> ids);-->
  113. <delete id="delete" parameterType="java.util.List">
  114. delete
  115. from follow_up
  116. where id in
  117. <foreach collection="ids" item="id" index="index" open="(" close=")" separator=",">
  118. #{id}
  119. </foreach>
  120. </delete>
  121. <!--根据后续事项id和文件id删除数据-->
  122. <!--int deleteAssoId(Integer followUpId, List<Integer> fileIds);-->
  123. <delete id="deleteAssoId">
  124. delete
  125. from asso_follow_up_file
  126. where follow_up_id = #{followUpId}
  127. and FILE_ID in
  128. <foreach collection="fileIds" item="fileId" index="index" open="(" close=")" separator=",">
  129. #{fileId}
  130. </foreach>
  131. </delete>
  132. <!--根据报告id统计后续事项数量-->
  133. <!--List<Integer> queryFileIdByFollowUpId(Integer followUpId);-->
  134. <select id="queryFileIdByFollowUpId" resultType="Integer">
  135. SELECT FILE_ID FROM asso_follow_up_file WHERE FOLLOW_UP_ID = #{followUpId};
  136. </select>
  137. <!--插入数据-->
  138. <!--int addAssoIds(AssoFollowUpFile assoFollowUpFile);-->
  139. <insert id="addAssoIds" useGeneratedKeys="true" keyProperty="id">
  140. insert into asso_follow_up_file(follow_up_id, file_id, file_type)
  141. values
  142. (#{followUpId}, #{fileId}, #{fileType})
  143. </insert>
  144. </mapper>