TSaiApplyMapper.xml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper
  3. PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
  4. "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  5. <mapper namespace="com.ruoyi.project.production.mapper.TSaiApplyMapper">
  6. <resultMap type="TSaiApply" id="TSaiApplyResult">
  7. <result property="saiApplyId" column="sai_apply_id" />
  8. <result property="delFlag" column="del_flag" />
  9. <result property="createBy" column="create_by" />
  10. <result property="createTime" column="create_time" />
  11. <result property="updateBy" column="update_by" />
  12. <result property="updateTime" column="update_time" />
  13. <result property="deptId" column="dept_id" />
  14. <result property="applyStatus" column="apply_status" />
  15. <result property="apNo" column="ap_no" />
  16. <result property="processId" column="process_id" />
  17. <result property="applicant" column="applicant" />
  18. <result property="assessor" column="assessor" />
  19. <result property="executor" column="executor" />
  20. <result property="inspectors" column="inspectors" />
  21. <result property="applicantDept" column="applicant_dept" />
  22. <result property="applicantTeam" column="applicant_team" />
  23. <result property="description" column="description" />
  24. <result property="unsafeStatus" column="unsafe_status" />
  25. <result property="unsafeAction" column="unsafe_action" />
  26. <result property="applyDate" column="apply_date" />
  27. <result property="taskId" column="task_id" />
  28. <result property="taskName" column="task_name" />
  29. <result property="handler" column="handler" />
  30. <result property="estimateFinishDate" column="estimate_finish_date" />
  31. <result property="actualFinishDate" column="actual_finish_date" />
  32. <result property="isRecorded" column="is_recorded" />
  33. <result property="recordNo" column="record_no" />
  34. <result property="reaction" column="reaction" />
  35. <result property="needVe" column="need_ve" />
  36. <result property="veItems" column="ve_items" />
  37. <result property="veResult" column="ve_result" />
  38. <result property="remarks" column="remarks" />
  39. <result property="veItemOther" column="ve_item_other" />
  40. <result property="saiLevel" column="sai_level" />
  41. <result property="category" column="category" />
  42. <result property="remarksAssess" column="remarks_assess" />
  43. <result property="remarksExecute" column="remarks_execute" />
  44. <result property="workArea" column="work_area" />
  45. </resultMap>
  46. <sql id="selectTSaiApplyVo">
  47. select d.sai_apply_id, d.del_flag, d.create_by, d.create_time, d.update_by, d.update_time, d.dept_id, d.apply_status, d.ap_no, d.process_id,
  48. d.applicant, d.assessor, d.executor, d.inspectors, d.applicant_dept, d.applicant_team, d.description,
  49. d.unsafe_status, d.unsafe_action, d.apply_date, d.task_id, d.task_name,d.remarks, d.ve_item_other,
  50. d.handler, d.estimate_finish_date, d.actual_finish_date, d.is_recorded, d.record_no, d.reaction, d.need_ve, d.ve_items, d.ve_result,
  51. d.sai_level, d.category, d.remarks_assess, d.remarks_execute, d.work_area
  52. from t_sai_apply d
  53. left join sys_dept s on s.dept_id = d.dept_id
  54. </sql>
  55. <select id="selectTSaiApplyList"
  56. parameterType="com.ruoyi.project.production.controller.vo.SaiApplyQueryVO"
  57. resultMap="TSaiApplyResult">
  58. <include refid="selectTSaiApplyVo"/>
  59. <where>
  60. <if test="tab == 1">
  61. and handler like concat(concat('%', #{currentUser}), '%')
  62. and apply_status != 4
  63. and apply_status != 5
  64. </if>
  65. <if test="tab == 2">
  66. and (handler like concat(concat('%', #{currentUser}), '%')
  67. or assessor like concat(concat('%', #{currentUser}), '%')
  68. or executor like concat(concat('%', #{currentUser}), '%')
  69. or inspectors like concat(concat('%', #{currentUser}), '%'))
  70. </if>
  71. <if test="isSpecialRole == true">
  72. and apply_status != 5
  73. </if>
  74. <if test="applyDateStart != null ">and apply_date <![CDATA[>=]]> #{applyDateStart}</if>
  75. <if test="applyDateEnd != null">and apply_date <![CDATA[<=]]>#{applyDateEnd}</if>
  76. <if test="estimateFinishDateStart != null ">and estimate_finish_date <![CDATA[>=]]> #{estimateFinishDateStart}</if>
  77. <if test="estimateFinishDateEnd != null">and estimate_finish_date <![CDATA[<=]]>#{estimateFinishDateEnd}</if>
  78. <if test="saiApplyId != null "> and sai_apply_id = #{saiApplyId}</if>
  79. <if test="deptId != null "> and dept_id = #{deptId}</if>
  80. <if test="applyStatus != null and applyStatus != ''"> and apply_status = #{applyStatus}</if>
  81. <if test="apNo != null and apNo != ''"> and ap_no = #{apNo}</if>
  82. <if test="processId != null and processId != ''"> and process_id = #{processId}</if>
  83. <if test="applicant != null and applicant != ''"> and applicant = #{applicant}</if>
  84. <if test="assessor != null and assessor != ''"> and assessor = #{assessor}</if>
  85. <if test="executor != null and executor != ''"> and executor = #{executor}</if>
  86. <if test="inspectors != null and inspectors != ''"> and inspectors = #{inspectors}</if>
  87. <if test="applicantDept != null and applicantDept != ''"> and applicant_dept = #{applicantDept}</if>
  88. <if test="applicantTeam != null and applicantTeam != ''"> and applicant_team = #{applicantTeam}</if>
  89. <if test="description != null and description != ''"> and description like concat(concat('%', #{description}), '%') </if>
  90. <if test="unsafeStatus != null "> and unsafe_status = #{unsafeStatus}</if>
  91. <if test="unsafeAction != null "> and unsafe_action = #{unsafeAction}</if>
  92. <if test="applyDate != null "> and apply_date = #{applyDate}</if>
  93. <if test="taskId != null and taskId != ''"> and task_id = #{taskId}</if>
  94. <if test="taskName != null and taskName != ''"> and task_name like concat(concat('%', #{taskName}), '%')</if>
  95. <if test="handler != null and handler != ''"> and handler = #{handler}</if>
  96. <if test="estimateFinishDate != null "> and estimate_finish_date = #{estimateFinishDate}</if>
  97. <if test="actualFinishDate != null "> and actual_finish_date = #{actualFinishDate}</if>
  98. <if test="isRecorded != null "> and is_recorded = #{isRecorded}</if>
  99. <if test="recordNo != null and recordNo != ''"> and record_no = #{recordNo}</if>
  100. <if test="reaction != null and reaction != ''"> and reaction = #{reaction}</if>
  101. <if test="needVe != null "> and need_ve = #{needVe}</if>
  102. <if test="veItems != null and veItems != ''"> and ve_items = #{veItems}</if>
  103. <if test="veResult != null and veResult != ''"> and ve_result = #{veResult}</if>
  104. <if test="remarks != null and remarks != ''"> and remarks = #{remarks}</if>
  105. <if test="veItemOther != null and veItemOther != ''"> and ve_item_other = #{veItemOther}</if>
  106. <if test="saiLevel != null "> and sai_level = #{saiLevel}</if>
  107. <if test="category != null and category != ''"> and category = #{category}</if>
  108. <if test="remarksAssess != null and remarksAssess != ''"> and remarks_assess = #{remarksAssess}</if>
  109. <if test="remarksExecute != null and remarksExecute != ''"> and remarks_execute = #{remarksExecute}</if>
  110. <if test="workArea != null and workArea != ''"> and instr(#{workArea}, work_area ) > 0 </if>
  111. and d.del_flag = 0
  112. </where>
  113. order by APPLY_DATE desc
  114. </select>
  115. <select id="selectTSaiApplyById" parameterType="Long" resultMap="TSaiApplyResult">
  116. <include refid="selectTSaiApplyVo"/>
  117. where sai_apply_id = #{saiApplyId}
  118. </select>
  119. <insert id="insertTSaiApply" parameterType="TSaiApply">
  120. <selectKey keyProperty="saiApplyId" resultType="long" order="BEFORE">
  121. SELECT seq_t_sai_apply.NEXTVAL as saiApplyId FROM DUAL
  122. </selectKey>
  123. insert into t_sai_apply
  124. <trim prefix="(" suffix=")" suffixOverrides=",">
  125. <if test="saiApplyId != null">sai_apply_id,</if>
  126. <if test="delFlag != null">del_flag,</if>
  127. <if test="createBy != null">create_by,</if>
  128. <if test="createTime != null">create_time,</if>
  129. <if test="updateBy != null">update_by,</if>
  130. <if test="updateTime != null">update_time,</if>
  131. <if test="deptId != null">dept_id,</if>
  132. <if test="applyStatus != null">apply_status,</if>
  133. <if test="apNo != null">ap_no,</if>
  134. <if test="processId != null">process_id,</if>
  135. <if test="applicant != null">applicant,</if>
  136. <if test="assessor != null">assessor,</if>
  137. <if test="executor != null">executor,</if>
  138. <if test="inspectors != null">inspectors,</if>
  139. <if test="applicantDept != null">applicant_dept,</if>
  140. <if test="applicantTeam != null">applicant_team,</if>
  141. <if test="description != null">description,</if>
  142. <if test="unsafeStatus != null">unsafe_status,</if>
  143. <if test="unsafeAction != null">unsafe_action,</if>
  144. <if test="applyDate != null">apply_date,</if>
  145. <if test="taskId != null">task_id,</if>
  146. <if test="taskName != null">task_name,</if>
  147. <if test="handler != null">handler,</if>
  148. <if test="estimateFinishDate != null">estimate_finish_date,</if>
  149. <if test="actualFinishDate != null">actual_finish_date,</if>
  150. <if test="isRecorded != null">is_recorded,</if>
  151. <if test="recordNo != null">record_no,</if>
  152. <if test="reaction != null">reaction,</if>
  153. <if test="needVe != null">need_ve,</if>
  154. <if test="veItems != null">ve_items,</if>
  155. <if test="veResult != null">ve_result,</if>
  156. <if test="remarks != null">remarks,</if>
  157. <if test="veItemOther != null">ve_item_other,</if>
  158. <if test="saiLevel != null">sai_level,</if>
  159. <if test="category != null">category,</if>
  160. <if test="remarksAssess != null">remarks_assess,</if>
  161. <if test="remarksExecute != null">remarks_execute,</if>
  162. <if test="workArea != null">work_area,</if>
  163. </trim>
  164. <trim prefix="values (" suffix=")" suffixOverrides=",">
  165. <if test="saiApplyId != null">#{saiApplyId},</if>
  166. <if test="delFlag != null">#{delFlag},</if>
  167. <if test="createBy != null">#{createBy},</if>
  168. <if test="createTime != null">#{createTime},</if>
  169. <if test="updateBy != null">#{updateBy},</if>
  170. <if test="updateTime != null">#{updateTime},</if>
  171. <if test="deptId != null">#{deptId},</if>
  172. <if test="applyStatus != null">#{applyStatus},</if>
  173. <if test="apNo != null">#{apNo},</if>
  174. <if test="processId != null">#{processId},</if>
  175. <if test="applicant != null">#{applicant},</if>
  176. <if test="assessor != null">#{assessor},</if>
  177. <if test="executor != null">#{executor},</if>
  178. <if test="inspectors != null">#{inspectors},</if>
  179. <if test="applicantDept != null">#{applicantDept},</if>
  180. <if test="applicantTeam != null">#{applicantTeam},</if>
  181. <if test="description != null">#{description},</if>
  182. <if test="unsafeStatus != null">#{unsafeStatus},</if>
  183. <if test="unsafeAction != null">#{unsafeAction},</if>
  184. <if test="applyDate != null">#{applyDate},</if>
  185. <if test="taskId != null">#{taskId},</if>
  186. <if test="taskName != null">#{taskName},</if>
  187. <if test="handler != null">#{handler},</if>
  188. <if test="estimateFinishDate != null">#{estimateFinishDate},</if>
  189. <if test="actualFinishDate != null">#{actualFinishDate},</if>
  190. <if test="isRecorded != null">#{isRecorded},</if>
  191. <if test="recordNo != null">#{recordNo},</if>
  192. <if test="reaction != null">#{reaction},</if>
  193. <if test="needVe != null">#{needVe},</if>
  194. <if test="veItems != null">#{veItems},</if>
  195. <if test="veResult != null">#{veResult},</if>
  196. <if test="remarks != null">#{remarks},</if>
  197. <if test="veItemOther != null">#{veItemOther},</if>
  198. <if test="saiLevel != null">#{saiLevel},</if>
  199. <if test="category != null">#{category},</if>
  200. <if test="remarksAssess != null">#{remarksAssess},</if>
  201. <if test="remarksExecute != null">#{remarksExecute},</if>
  202. <if test="workArea != null">#{workArea},</if>
  203. </trim>
  204. </insert>
  205. <update id="updateTSaiApply" parameterType="TSaiApply">
  206. update t_sai_apply
  207. <trim prefix="SET" suffixOverrides=",">
  208. <if test="delFlag != null">del_flag = #{delFlag},</if>
  209. <if test="createBy != null">create_by = #{createBy},</if>
  210. <if test="createTime != null">create_time = #{createTime},</if>
  211. <if test="updateBy != null">update_by = #{updateBy},</if>
  212. <if test="updateTime != null">update_time = #{updateTime},</if>
  213. <if test="deptId != null">dept_id = #{deptId},</if>
  214. <if test="applyStatus != null">apply_status = #{applyStatus},</if>
  215. <if test="apNo != null">ap_no = #{apNo},</if>
  216. <if test="processId != null">process_id = #{processId},</if>
  217. <if test="applicant != null">applicant = #{applicant},</if>
  218. <if test="assessor != null">assessor = #{assessor},</if>
  219. <if test="executor != null">executor = #{executor},</if>
  220. <if test="inspectors != null">inspectors = #{inspectors},</if>
  221. <if test="applicantDept != null">applicant_dept = #{applicantDept},</if>
  222. <if test="applicantTeam != null">applicant_team = #{applicantTeam},</if>
  223. <if test="description != null">description = #{description},</if>
  224. <if test="unsafeStatus != null">unsafe_status = #{unsafeStatus},</if>
  225. <if test="unsafeStatus == null">unsafe_status = null,</if>
  226. <if test="unsafeAction != null">unsafe_action = #{unsafeAction},</if>
  227. <if test="unsafeAction == null">unsafe_action = null,</if>
  228. <if test="applyDate != null">apply_date = #{applyDate},</if>
  229. <if test="taskId != null">task_id = #{taskId},</if>
  230. <if test="taskId == null">task_id = null,</if>
  231. <if test="taskName != null">task_name = #{taskName},</if>
  232. <if test="taskName == null">task_name = null,</if>
  233. <if test="handler != null">handler = #{handler},</if>
  234. <if test="estimateFinishDate != null">estimate_finish_date = #{estimateFinishDate},</if>
  235. <if test="actualFinishDate != null">actual_finish_date = #{actualFinishDate},</if>
  236. <if test="isRecorded != null">is_recorded = #{isRecorded},</if>
  237. <if test="recordNo != null">record_no = #{recordNo},</if>
  238. <if test="recordNo == null">record_no = null,</if>
  239. <if test="reaction != null">reaction = #{reaction},</if>
  240. <if test="needVe != null">need_ve = #{needVe},</if>
  241. <if test="veItems != null">ve_items = #{veItems},</if>
  242. <if test="veItems == null">ve_items = null,</if>
  243. <if test="veResult != null">ve_result = #{veResult},</if>
  244. <if test="remarks != null">remarks = #{remarks},</if>
  245. <if test="veItemOther != null">ve_item_other = #{veItemOther},</if>
  246. <if test="veItemOther == null">ve_item_other = null,</if>
  247. <if test="saiLevel != null">sai_level = #{saiLevel},</if>
  248. <if test="category != null">category = #{category},</if>
  249. <if test="remarksAssess != null">remarks_assess = #{remarksAssess},</if>
  250. <if test="remarksExecute != null">remarks_execute = #{remarksExecute},</if>
  251. <if test="workArea != null">work_area = #{workArea},</if>
  252. </trim>
  253. where sai_apply_id = #{saiApplyId}
  254. </update>
  255. <update id="deleteTSaiApplyById" parameterType="Long">
  256. update t_sai_apply set del_flag = 2 where sai_apply_id = #{saiApplyId}
  257. </update>
  258. <update id="deleteTSaiApplyByIds" parameterType="String">
  259. update t_sai_apply set del_flag = 2 where sai_apply_id in
  260. <foreach item="saiApplyId" collection="array" open="(" separator="," close=")">
  261. #{saiApplyId}
  262. </foreach>
  263. </update>
  264. </mapper>