CheckTaskMapper.xml 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312
  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.sundot.airport.check.mapper.CheckTaskMapper">
  6. <resultMap type="CheckTask" id="CheckTaskResult">
  7. <result property="tenantId" column="tenant_id"/>
  8. <result property="revision" column="revision"/>
  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="taskCode" column="task_code"/>
  14. <result property="taskName" column="task_name"/>
  15. <result property="checkStartTime" column="check_start_time"/>
  16. <result property="status" column="status"/>
  17. <result property="checkLevel" column="check_level"/>
  18. <result property="checkedLevel" column="checked_level"/>
  19. <result property="checkResult" column="check_result"/>
  20. <result property="checkCategory" column="check_category"/>
  21. <result property="id" column="id"/>
  22. <result property="description" column="description"/>
  23. <result property="checkEndTime" column="check_end_time"/>
  24. <result property="isRegularTasks" column="is_regular_tasks"/>
  25. <result property="ruleType" column="rule_type"/>
  26. <result property="statusDesc" column="status_desc"/>
  27. <result property="checkLevelDesc" column="check_level_desc"/>
  28. <result property="checkedLevelDesc" column="checked_level_desc"/>
  29. <result property="checkResultDesc" column="check_result_desc"/>
  30. <result property="checkCategoryDesc" column="check_category_desc"/>
  31. <result property="ruleTypeDesc" column="rule_type_desc"/>
  32. <result property="remark" column="remark"/>
  33. <result property="isSelfCheck" column="is_self_check"/>
  34. <result property="ruleTypeNum" column="rule_type_num"/>
  35. <result property="createId" column="create_id"/>
  36. <result property="updateId" column="update_id"/>
  37. <result property="selfCheckDeptId" column="self_check_dept_id"/>
  38. <result property="selfCheckDeptName" column="self_check_dept_name"/>
  39. </resultMap>
  40. <sql id="selectCheckTaskVo">
  41. select tenant_id,
  42. revision,
  43. create_by,
  44. create_time,
  45. update_by,
  46. update_time,
  47. task_code,
  48. task_name,
  49. check_start_time,
  50. status,
  51. check_level,
  52. checked_level,
  53. check_result,
  54. check_category,
  55. id,
  56. description,
  57. check_end_time,
  58. is_regular_tasks,
  59. rule_type,
  60. status_desc,
  61. check_level_desc,
  62. checked_level_desc,
  63. check_result_desc,
  64. check_category_desc,
  65. rule_type_desc,
  66. remark,
  67. is_self_check,
  68. rule_type_num,
  69. create_id,
  70. update_id,
  71. self_check_dept_id,
  72. self_check_dept_name
  73. from check_task
  74. </sql>
  75. <select id="selectCheckTaskList" parameterType="CheckTask" resultMap="CheckTaskResult">
  76. <include refid="selectCheckTaskVo"/>
  77. <where>
  78. <if test="tenantId != null and tenantId != ''">and tenant_id = #{tenantId}</if>
  79. <if test="revision != null ">and revision = #{revision}</if>
  80. <if test="taskCode != null and taskCode != ''">and task_code = #{taskCode}</if>
  81. <if test="taskName != null and taskName != ''">and task_name like concat('%', #{taskName}, '%')</if>
  82. <if test="checkStartTime != null ">and check_start_time = #{checkStartTime}</if>
  83. <choose>
  84. <when test="status == 'PENDING_EXECUTION'">
  85. and current_date() <![CDATA[<]]> check_start_time
  86. </when>
  87. <when test="status == 'COMPLETED'">
  88. and current_date() <![CDATA[>]]> check_end_time
  89. </when>
  90. <when test="status == 'IN_PROGRESS'">
  91. and current_date() <![CDATA[>=]]> check_start_time
  92. and current_date() <![CDATA[<=]]> check_end_time
  93. </when>
  94. <otherwise>
  95. </otherwise>
  96. </choose>
  97. <if test="checkLevel != null and checkLevel != ''">and check_level = #{checkLevel}</if>
  98. <if test="checkedLevel != null and checkedLevel != ''">and checked_level = #{checkedLevel}</if>
  99. <if test="checkResult != null and checkResult != ''">and check_result = #{checkResult}</if>
  100. <if test="checkCategory != null and checkCategory != ''">and check_category = #{checkCategory}</if>
  101. <if test="description != null and description != ''">and description = #{description}</if>
  102. <if test="checkEndTime != null ">and check_end_time = #{checkEndTime}</if>
  103. <if test="isRegularTasks != null ">and is_regular_tasks = #{isRegularTasks}</if>
  104. <if test="ruleType != null and ruleType != ''">and rule_type = #{ruleType}</if>
  105. <if test="statusDesc != null and statusDesc != ''">and status_desc = #{statusDesc}</if>
  106. <if test="checkLevelDesc != null and checkLevelDesc != ''">and check_level_desc = #{checkLevelDesc}</if>
  107. <if test="checkedLevelDesc != null and checkedLevelDesc != ''">and checked_level_desc =
  108. #{checkedLevelDesc}
  109. </if>
  110. <if test="checkResultDesc != null and checkResultDesc != ''">and check_result_desc = #{checkResultDesc}
  111. </if>
  112. <if test="checkCategoryDesc != null and checkCategoryDesc != ''">and check_category_desc =
  113. #{checkCategoryDesc}
  114. </if>
  115. <if test="ruleTypeDesc != null and ruleTypeDesc != ''">and rule_type_desc = #{ruleTypeDesc}</if>
  116. <if test="isSelfCheck != null ">and is_self_check = #{isSelfCheck}</if>
  117. <if test="ruleTypeNum != null ">and rule_type_num = #{ruleTypeNum}</if>
  118. <if test="createId != null ">and create_id = #{createId}</if>
  119. <if test="updateId != null ">and update_id = #{updateId}</if>
  120. <if test="selfCheckDeptId != null ">and (is_self_check = 0 or self_check_dept_id = #{selfCheckDeptId})</if>
  121. <if test="selfCheckDeptName != null and selfCheckDeptName != ''">and self_check_dept_name like concat('%',
  122. #{selfCheckDeptName}, '%')
  123. </if>
  124. </where>
  125. order by create_time desc
  126. </select>
  127. <select id="selectCheckTaskById" parameterType="Long" resultMap="CheckTaskResult">
  128. <include refid="selectCheckTaskVo"/>
  129. where id = #{id}
  130. </select>
  131. <insert id="insertCheckTask" parameterType="CheckTask" useGeneratedKeys="true" keyProperty="id">
  132. insert into check_task
  133. <trim prefix="(" suffix=")" suffixOverrides=",">
  134. <if test="tenantId != null">tenant_id,</if>
  135. <if test="revision != null">revision,</if>
  136. <if test="createBy != null">create_by,</if>
  137. <if test="createTime != null">create_time,</if>
  138. <if test="updateBy != null">update_by,</if>
  139. <if test="updateTime != null">update_time,</if>
  140. <if test="taskCode != null and taskCode != ''">task_code,</if>
  141. <if test="taskName != null and taskName != ''">task_name,</if>
  142. <if test="checkStartTime != null">check_start_time,</if>
  143. <if test="status != null and status != ''">status,</if>
  144. <if test="checkLevel != null and checkLevel != ''">check_level,</if>
  145. <if test="checkedLevel != null and checkedLevel != ''">checked_level,</if>
  146. <if test="checkResult != null">check_result,</if>
  147. <if test="checkCategory != null">check_category,</if>
  148. <if test="description != null">description,</if>
  149. <if test="checkEndTime != null">check_end_time,</if>
  150. <if test="isRegularTasks != null">is_regular_tasks,</if>
  151. <if test="ruleType != null">rule_type,</if>
  152. <if test="statusDesc != null and statusDesc != ''">status_desc,</if>
  153. <if test="checkLevelDesc != null and checkLevelDesc != ''">check_level_desc,</if>
  154. <if test="checkedLevelDesc != null and checkedLevelDesc != ''">checked_level_desc,</if>
  155. <if test="checkResultDesc != null">check_result_desc,</if>
  156. <if test="checkCategoryDesc != null">check_category_desc,</if>
  157. <if test="ruleTypeDesc != null">rule_type_desc,</if>
  158. <if test="remark != null">remark,</if>
  159. <if test="isSelfCheck != null">is_self_check,</if>
  160. <if test="ruleTypeNum != null">rule_type_num,</if>
  161. <if test="createId != null">create_id,</if>
  162. <if test="updateId != null">update_id,</if>
  163. <if test="selfCheckDeptId != null">self_check_dept_id,</if>
  164. <if test="selfCheckDeptName != null">self_check_dept_name,</if>
  165. </trim>
  166. <trim prefix="values (" suffix=")" suffixOverrides=",">
  167. <if test="tenantId != null">#{tenantId},</if>
  168. <if test="revision != null">#{revision},</if>
  169. <if test="createBy != null">#{createBy},</if>
  170. <if test="createTime != null">#{createTime},</if>
  171. <if test="updateBy != null">#{updateBy},</if>
  172. <if test="updateTime != null">#{updateTime},</if>
  173. <if test="taskCode != null and taskCode != ''">#{taskCode},</if>
  174. <if test="taskName != null and taskName != ''">#{taskName},</if>
  175. <if test="checkStartTime != null">#{checkStartTime},</if>
  176. <if test="status != null and status != ''">#{status},</if>
  177. <if test="checkLevel != null and checkLevel != ''">#{checkLevel},</if>
  178. <if test="checkedLevel != null and checkedLevel != ''">#{checkedLevel},</if>
  179. <if test="checkResult != null">#{checkResult},</if>
  180. <if test="checkCategory != null">#{checkCategory},</if>
  181. <if test="description != null">#{description},</if>
  182. <if test="checkEndTime != null">#{checkEndTime},</if>
  183. <if test="isRegularTasks != null">#{isRegularTasks},</if>
  184. <if test="ruleType != null">#{ruleType},</if>
  185. <if test="statusDesc != null and statusDesc != ''">#{statusDesc},</if>
  186. <if test="checkLevelDesc != null and checkLevelDesc != ''">#{checkLevelDesc},</if>
  187. <if test="checkedLevelDesc != null and checkedLevelDesc != ''">#{checkedLevelDesc},</if>
  188. <if test="checkResultDesc != null">#{checkResultDesc},</if>
  189. <if test="checkCategoryDesc != null">#{checkCategoryDesc},</if>
  190. <if test="ruleTypeDesc != null">#{ruleTypeDesc},</if>
  191. <if test="remark != null">#{remark},</if>
  192. <if test="isSelfCheck != null">#{isSelfCheck},</if>
  193. <if test="ruleTypeNum != null">#{ruleTypeNum},</if>
  194. <if test="createId != null">#{createId},</if>
  195. <if test="updateId != null">#{updateId},</if>
  196. <if test="selfCheckDeptId != null">#{selfCheckDeptId},</if>
  197. <if test="selfCheckDeptName != null">#{selfCheckDeptName},</if>
  198. </trim>
  199. </insert>
  200. <update id="updateCheckTask" parameterType="CheckTask">
  201. update check_task
  202. <trim prefix="SET" suffixOverrides=",">
  203. <if test="tenantId != null">tenant_id = #{tenantId},</if>
  204. <if test="revision != null">revision = #{revision},</if>
  205. <if test="createBy != null">create_by = #{createBy},</if>
  206. <if test="createTime != null">create_time = #{createTime},</if>
  207. <if test="updateBy != null">update_by = #{updateBy},</if>
  208. <if test="updateTime != null">update_time = #{updateTime},</if>
  209. <if test="taskCode != null and taskCode != ''">task_code = #{taskCode},</if>
  210. <if test="taskName != null and taskName != ''">task_name = #{taskName},</if>
  211. <if test="checkStartTime != null">check_start_time = #{checkStartTime},</if>
  212. <if test="status != null and status != ''">status = #{status},</if>
  213. <if test="checkLevel != null and checkLevel != ''">check_level = #{checkLevel},</if>
  214. <if test="checkedLevel != null and checkedLevel != ''">checked_level = #{checkedLevel},</if>
  215. <if test="checkResult != null">check_result = #{checkResult},</if>
  216. <if test="checkCategory != null">check_category = #{checkCategory},</if>
  217. <if test="description != null">description = #{description},</if>
  218. <if test="checkEndTime != null">check_end_time = #{checkEndTime},</if>
  219. <if test="isRegularTasks != null">is_regular_tasks = #{isRegularTasks},</if>
  220. <if test="ruleType != null">rule_type = #{ruleType},</if>
  221. <if test="statusDesc != null and statusDesc != ''">status_desc = #{statusDesc},</if>
  222. <if test="checkLevelDesc != null and checkLevelDesc != ''">check_level_desc = #{checkLevelDesc},</if>
  223. <if test="checkedLevelDesc != null and checkedLevelDesc != ''">checked_level_desc = #{checkedLevelDesc},
  224. </if>
  225. <if test="checkResultDesc != null">check_result_desc = #{checkResultDesc},</if>
  226. <if test="checkCategoryDesc != null">check_category_desc = #{checkCategoryDesc},</if>
  227. <if test="ruleTypeDesc != null">rule_type_desc = #{ruleTypeDesc},</if>
  228. <if test="remark != null">remark = #{remark},</if>
  229. <if test="isSelfCheck != null">is_self_check = #{isSelfCheck},</if>
  230. <if test="ruleTypeNum != null">rule_type_num = #{ruleTypeNum},</if>
  231. <if test="createId != null">create_id = #{createId},</if>
  232. <if test="updateId != null">update_id = #{updateId},</if>
  233. <if test="selfCheckDeptId != null">self_check_dept_id = #{selfCheckDeptId},</if>
  234. <if test="selfCheckDeptName != null">self_check_dept_name = #{selfCheckDeptName},</if>
  235. </trim>
  236. where id = #{id}
  237. </update>
  238. <delete id="deleteCheckTaskById" parameterType="Long">
  239. delete
  240. from check_task
  241. where id = #{id}
  242. </delete>
  243. <delete id="deleteCheckTaskByIds" parameterType="String">
  244. delete from check_task where id in
  245. <foreach item="id" collection="array" open="(" separator="," close=")">
  246. #{id}
  247. </foreach>
  248. </delete>
  249. <select id="selectCheckTaskListWeb" parameterType="CheckTask" resultMap="CheckTaskResult">
  250. <include refid="selectCheckTaskVo"/>
  251. <where>
  252. <if test="taskCode != null and taskCode != ''">and task_code = #{taskCode}</if>
  253. <if test="taskName != null and taskName != ''">and task_name like concat('%', #{taskName}, '%')</if>
  254. <choose>
  255. <when test="status == 'PENDING_EXECUTION'">
  256. and current_date() <![CDATA[<]]> check_start_time
  257. </when>
  258. <when test="status == 'COMPLETED'">
  259. and current_date() <![CDATA[>]]> check_end_time
  260. </when>
  261. <when test="status == 'IN_PROGRESS'">
  262. and current_date() <![CDATA[>=]]> check_start_time
  263. and current_date() <![CDATA[<=]]> check_end_time
  264. </when>
  265. <otherwise>
  266. </otherwise>
  267. </choose>
  268. <if test="checkedLevel != null and checkedLevel != ''">and checked_level = #{checkedLevel}</if>
  269. and ((is_self_check = 0 and check_level in ('DEPARTMENT_LEVEL', 'TEAM_LEVEL'))
  270. or (is_self_check = 1 and self_check_dept_id = #{selfCheckDeptId}))
  271. </where>
  272. order by create_time desc
  273. </select>
  274. <select id="selectCheckTaskListBrigadeWeb" parameterType="CheckTask" resultMap="CheckTaskResult">
  275. <include refid="selectCheckTaskVo"/>
  276. <where>
  277. <if test="taskCode != null and taskCode != ''">and task_code = #{taskCode}</if>
  278. <if test="taskName != null and taskName != ''">and task_name like concat('%', #{taskName}, '%')</if>
  279. <choose>
  280. <when test="status == 'PENDING_EXECUTION'">
  281. and current_date() <![CDATA[<]]> check_start_time
  282. </when>
  283. <when test="status == 'COMPLETED'">
  284. and current_date() <![CDATA[>]]> check_end_time
  285. </when>
  286. <when test="status == 'IN_PROGRESS'">
  287. and current_date() <![CDATA[>=]]> check_start_time
  288. and current_date() <![CDATA[<=]]> check_end_time
  289. </when>
  290. <otherwise>
  291. </otherwise>
  292. </choose>
  293. <if test="checkedLevel != null and checkedLevel != ''">and checked_level = #{checkedLevel}</if>
  294. and check_level in ('BRIGADE_LEVEL','DEPARTMENT_LEVEL', 'TEAM_LEVEL')
  295. </where>
  296. order by create_time desc
  297. </select>
  298. </mapper>