TCheckCheckpointsMapper.xml 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477
  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.check.mapper.TCheckCheckpointsMapper">
  6. <resultMap type="TCheckCheckpoints" id="TCheckCheckpointsResult">
  7. <result property="checkId" column="check_id"/>
  8. <result property="pointId" column="point_id"/>
  9. <result property="inspectionId" column="inspection_id"/>
  10. <result property="instrumentId" column="instrument_id"/>
  11. <result property="testValue" column="test_value"/>
  12. <result property="netTestValue" column="net_test_value"/>
  13. <result property="plantId" column="plant_id"/>
  14. <result property="plantName" column="plant_name"/>
  15. <result property="regionId" column="region_id"/>
  16. <result property="regionName" column="region_name"/>
  17. <result property="layer" column="layer"/>
  18. <result property="devId" column="dev_id"/>
  19. <result property="devName" column="dev_name"/>
  20. <result property="devCode" column="dev_code"/>
  21. <result property="groupCode" column="group_code"/>
  22. <result property="extendCode" column="extend_code"/>
  23. <result property="pointType" column="point_type"/>
  24. <result property="instrumentCode" column="instrument_code"/>
  25. <result property="leakagePosition" column="leakage_position"/>
  26. <result property="checker" column="checker"/>
  27. <result property="checkDate" column="check_date"/>
  28. <result property="leakageDegree" column="leakage_degree"/>
  29. <result property="remarks" column="remarks"/>
  30. <result property="approveStatus" column="approve_status"/>
  31. <result property="approveTime" column="approve_time"/>
  32. <result property="deptId" column="dept_id"/>
  33. <result property="delFlag" column="del_flag"/>
  34. <result property="createrCode" column="creater_code"/>
  35. <result property="createdate" column="createdate"/>
  36. <result property="updaterCode" column="updater_code"/>
  37. <result property="updatedate" column="updatedate"/>
  38. <result property="repairId" column="repair_id"/>
  39. <result property="planId" column="plan_id"/>
  40. </resultMap>
  41. <sql id="selectTCheckCheckpointsVo">
  42. select check_id,
  43. point_id,
  44. instrument_id,
  45. inspection_id,
  46. test_value,
  47. net_test_value,
  48. plant_id,
  49. plant_name,
  50. region_id,
  51. region_name,
  52. layer,
  53. dev_id,
  54. dev_name,
  55. dev_code,
  56. group_code,
  57. extend_code,
  58. point_type,
  59. instrument_code,
  60. leakage_position,
  61. checker,
  62. check_date,
  63. leakage_degree,
  64. remarks,
  65. approve_status,
  66. approve_time,
  67. dept_id,
  68. del_flag,
  69. creater_code,
  70. createdate,
  71. updater_code,
  72. updatedate,
  73. plan_id
  74. from t_check_checkpoints
  75. </sql>
  76. <select id="selectTCheckCheckpointsList" parameterType="TCheckCheckpoints" resultMap="TCheckCheckpointsResult">
  77. select d.plan_id,d.medium_type,d.plant_type,d.check_id,d.point_id, d.instrument_id, d.inspection_id, d.test_value,
  78. d.net_test_value, d.plant_id,d.plant_name,
  79. d.region_id, d.layer, d.dev_id, d.group_code, d.extend_code, d.point_type, d.instrument_code,
  80. leakage_position, d.checker, d.check_date, d.leakage_degree, d.remarks, d.approve_status, d.approve_time,
  81. d.dept_id, d.del_flag,
  82. d.creater_code, d.createdate, d.updater_code, d.updatedate,br.region_name,bd.dev_code,bd.dev_describe as
  83. dev_name from t_check_checkpoints d
  84. left join t_base_region br on d.region_id = br.region_id
  85. left join t_base_device bd on d.dev_id = bd.dev_id
  86. <where>
  87. <if test="pointId != null ">and d.point_id = #{pointId}</if>
  88. <if test="instrumentId != null ">and d.instrument_id = #{instrumentId}</if>
  89. <if test="inspectionId != null ">and d.inspection_id = #{inspectionId}</if>
  90. <if test="testValue != null and testValue != ''">and d.test_value = #{testValue}</if>
  91. <if test="netTestValue != null and netTestValue != ''">and d.net_test_value = #{netTestValue}</if>
  92. <if test="plantId != null and plantId != ''">and d.plant_id = #{plantId}</if>
  93. <if test="plantName != null and plantName != ''">and d.plant_name like concat('%', #{plantName}, '%')</if>
  94. <if test="regionId != null and regionId != ''">and d.region_id= #{regionId}</if>
  95. <if test="regionName != null and regionName != ''">and d.region_name like concat('%', #{regionName}, '%')
  96. </if>
  97. <if test="layer != null and layer != ''">and d.layer = #{layer}</if>
  98. <if test="devId != null and devId != ''">and d.dev_id = #{devId}</if>
  99. <if test="devName != null and devName != ''">and d.dev_name like concat('%', #{devName}, '%')</if>
  100. <if test="devCode != null and devCode != ''">and d.dev_code = #{devCode}</if>
  101. <if test="groupCode != null and groupCode != ''">and d.group_code = #{groupCode}</if>
  102. <if test="extendCode != null and extendCode != ''">and d.extend_code = #{extendCode}</if>
  103. <if test="pointType != null and pointType != ''">and d.point_type = #{pointType}</if>
  104. <if test="instrumentCode != null and instrumentCode != ''">and d.instrument_code = #{instrumentCode}</if>
  105. <if test="leakagePosition != null and leakagePosition != ''">and d.leakage_position = #{leakagePosition}
  106. </if>
  107. <if test="checker != null and checker != ''">and d.checker = #{checker}</if>
  108. <if test="checkDate != null ">and d.check_date = #{checkDate}</if>
  109. <if test="leakageDegree != null and leakageDegree != ''">and d.leakage_degree = #{leakageDegree}</if>
  110. <if test="remarks != null and remarks != ''">and d.remarks = #{remarks}</if>
  111. <if test="approveStatus != null ">and d.approve_status = #{approveStatus}</if>
  112. <if test="approveTime != null ">and d.approve_time = #{approveTime}</if>
  113. <if test="deptId != null ">and d.dept_id = #{deptId}</if>
  114. <if test="choose != null ">and d.inspection_id is null</if>
  115. <if test="repairId == null and repairId !=1">and d.repair_id is null</if>
  116. <if test="repairId != null and repairId !=1">and d.repair_id is not null</if>
  117. <if test="planId != null">and d.plan_id=#{planId}</if>
  118. and d.del_flag = 0
  119. </where>
  120. </select>
  121. <select id="selectTCheckCheckpointByEntity" parameterType="TCheckCheckpoints" resultMap="TCheckCheckpointsResult">
  122. select d.* from t_check_checkpoints d
  123. <where>
  124. <if test="pointId != null ">and d.point_id = #{pointId}</if>
  125. <if test="instrumentId != null ">and d.instrument_id = #{instrumentId}</if>
  126. <if test="inspectionId != null ">and d.inspection_id = #{inspectionId}</if>
  127. <if test="testValue != null and testValue != ''">and d.test_value = #{testValue}</if>
  128. <if test="netTestValue != null and netTestValue != ''">and d.net_test_value = #{netTestValue}</if>
  129. <if test="plantId != null and plantId != ''">and d.plant_id = #{plantId}</if>
  130. <if test="plantName != null and plantName != ''">and d.plant_name like concat('%', #{plantName}, '%')</if>
  131. <if test="regionId != null and regionId != ''">and d.region_id= #{regionId}</if>
  132. <if test="regionName != null and regionName != ''">and d.region_name like concat('%', #{regionName}, '%')
  133. </if>
  134. <if test="layer != null and layer != ''">and d.layer = #{layer}</if>
  135. <if test="devId != null and devId != ''">and d.dev_id = #{devId}</if>
  136. <if test="devName != null and devName != ''">and d.dev_name like concat('%', #{devName}, '%')</if>
  137. <if test="devCode != null and devCode != ''">and d.dev_code = #{devCode}</if>
  138. <if test="groupCode != null and groupCode != ''">and d.group_code = #{groupCode}</if>
  139. <if test="extendCode != null and extendCode != ''">and d.extend_code = #{extendCode}</if>
  140. <if test="pointType != null and pointType != ''">and d.point_type = #{pointType}</if>
  141. <if test="instrumentCode != null and instrumentCode != ''">and d.instrument_code = #{instrumentCode}</if>
  142. <if test="leakagePosition != null and leakagePosition != ''">and d.leakage_position = #{leakagePosition}
  143. </if>
  144. <if test="checker != null and checker != ''">and d.checker = #{checker}</if>
  145. <if test="checkDate != null ">and d.check_date = #{checkDate}</if>
  146. <if test="leakageDegree != null and leakageDegree != ''">and d.leakage_degree = #{leakageDegree}</if>
  147. <if test="remarks != null and remarks != ''">and d.remarks = #{remarks}</if>
  148. <if test="approveStatus != null ">and d.approve_status = #{approveStatus}</if>
  149. <if test="approveTime != null ">and d.approve_time = #{approveTime}</if>
  150. <if test="deptId != null ">and d.dept_id = #{deptId}</if>
  151. <if test="choose != null ">and d.inspection_id is null</if>
  152. <if test="planId != null">and d.plan_id=#{planId}</if>
  153. and d.del_flag = 0
  154. </where>
  155. </select>
  156. <select id="selectPointsByIds" parameterType="String" resultMap="TCheckCheckpointsResult">
  157. select d.plan_id,d.medium_type,d.plant_type,d.check_id,d.point_id, d.instrument_id, d.inspection_id, d.test_value,
  158. d.net_test_value, d.plant_id,d.plant_name,
  159. d.region_id, d.layer, d.dev_id, d.group_code, d.extend_code, d.point_type, d.instrument_code,
  160. leakage_position, d.checker, d.check_date, d.leakage_degree, d.remarks, d.approve_status, d.approve_time,
  161. d.dept_id, d.del_flag,
  162. d.creater_code, d.createdate, d.updater_code, d.updatedate,br.region_name,bd.dev_code,bd.dev_describe as
  163. dev_name from t_check_checkpoints d
  164. left join t_base_region br on d.region_id = br.region_id
  165. left join t_base_device bd on d.dev_id = bd.dev_id where d.check_id in
  166. <foreach item="checkId" collection="array" open="(" separator="," close=")">
  167. #{checkId}
  168. </foreach>
  169. and d.approve_status=2
  170. </select>
  171. <select id="selectPointsByPlantNameGroupCodeAndExtendCode" parameterType="TCheckCheckpoints"
  172. resultMap="TCheckCheckpointsResult">
  173. select *from t_check_checkpoints d
  174. <where>
  175. <if test="instrumentId != null ">and d.instrument_id = #{instrumentId}</if>
  176. <if test="inspectionId != null ">and d.inspection_id = #{inspectionId}</if>
  177. <if test="testValue != null and testValue != ''">and d.test_value = #{testValue}</if>
  178. <if test="netTestValue != null and netTestValue != ''">and d.net_test_value = #{netTestValue}</if>
  179. <if test="plantId != null and plantId != ''">and d.plant_id = #{plantId}</if>
  180. <if test="plantName != null and plantName != ''">and d.plant_name like concat('%', #{plantName}, '%')</if>
  181. <if test="regionId != null and regionId != ''">and d.region_id= #{regionId}</if>
  182. <if test="regionName != null and regionName != ''">and d.region_name like concat('%', #{regionName}, '%')
  183. </if>
  184. <if test="layer != null and layer != ''">and d.layer = #{layer}</if>
  185. <if test="devId != null and devId != ''">and d.dev_id = #{devId}</if>
  186. <if test="devName != null and devName != ''">and d.dev_name like concat('%', #{devName}, '%')</if>
  187. <if test="devCode != null and devCode != ''">and d.dev_code = #{devCode}</if>
  188. <if test="groupCode != null and groupCode != ''">and d.group_code = #{groupCode}</if>
  189. <if test="extendCode != null and extendCode != ''">and d.extend_code = #{extendCode}</if>
  190. <if test="pointType != null and pointType != ''">and d.point_type = #{pointType}</if>
  191. <if test="instrumentCode != null and instrumentCode != ''">and d.instrument_code = #{instrumentCode}</if>
  192. <if test="leakagePosition != null and leakagePosition != ''">and d.leakage_position = #{leakagePosition}
  193. </if>
  194. <if test="checker != null and checker != ''">and d.checker = #{checker}</if>
  195. <if test="checkDate != null and checkDate != ''">and d.check_date = #{checkDate}</if>
  196. <if test="leakageDegree != null and leakageDegree != ''">and d.leakage_degree = #{leakageDegree}</if>
  197. <if test="remarks != null and remarks != ''">and d.remarks = #{remarks}</if>
  198. <if test="approveStatus != null ">and d.approve_status = #{approveStatus}</if>
  199. <if test="approveTime != null ">and d.approve_time = #{approveTime}</if>
  200. <if test="deptId != null ">and d.dept_id = #{deptId}</if>
  201. <if test="createrCode != null ">and d.creater_code = #{createrCode}</if>
  202. <if test="createdate != null ">and d.createdate = #{createdate}</if>
  203. <if test="updaterCode != null ">and d.updater_code = #{updaterCode}</if>
  204. <if test="updatedate != null ">and d.updatedate = #{updatedate}</if>
  205. <if test="choose != null ">and d.inspection_id is null</if>
  206. <if test="planId != null">and d.plan_id=#{planId}</if>
  207. and d.del_flag = 0
  208. </where>
  209. </select>
  210. <select id="selectTCheckCheckpointsByCheckId" parameterType="Long" resultMap="TCheckCheckpointsResult">
  211. <include refid="selectTCheckCheckpointsVo"/>
  212. where check_id = #{checkId}
  213. </select>
  214. <insert id="insertTCheckCheckpoints" parameterType="TCheckCheckpoints" useGeneratedKeys="true"
  215. keyProperty="checkId">
  216. insert into t_check_checkpoints
  217. <trim prefix="(" suffix=")" suffixOverrides=",">
  218. <if test="pointId != null">point_id,</if>
  219. <if test="instrumentId != null">instrument_id,</if>
  220. <if test="inspectionId != null">inspection_id,</if>
  221. <if test="testValue != null">test_value,</if>
  222. <if test="netTestValue != null">net_test_value,</if>
  223. <if test="plantId != null">plant_id,</if>
  224. <if test="plantName != null">plant_name,</if>
  225. <if test="regionId != null">region_id,</if>
  226. <if test="regionName != null">region_name,</if>
  227. <if test="layer != null">layer,</if>
  228. <if test="devId != null">dev_id,</if>
  229. <if test="devName != null">dev_name,</if>
  230. <if test="devCode != null">dev_code,</if>
  231. <if test="groupCode != null">group_code,</if>
  232. <if test="extendCode != null">extend_code,</if>
  233. <if test="pointType != null">point_type,</if>
  234. <if test="instrumentCode != null">instrument_code,</if>
  235. <if test="leakagePosition != null">leakage_position,</if>
  236. <if test="checker != null">checker,</if>
  237. <if test="checkDate != null">check_date,</if>
  238. <if test="leakageDegree != null">leakage_degree,</if>
  239. <if test="remarks != null">remarks,</if>
  240. <if test="approveStatus != null">approve_status,</if>
  241. <if test="approveTime != null">approve_time,</if>
  242. <if test="deptId != null">dept_id,</if>
  243. <if test="delFlag != null">del_flag,</if>
  244. <if test="createrCode != null">creater_code,</if>
  245. <if test="createdate != null">createdate,</if>
  246. <if test="updaterCode != null">updater_code,</if>
  247. <if test="updatedate != null">updatedate,</if>
  248. <if test="plantType != null">plant_type,</if>
  249. <if test="planId != null">plan_id,</if>
  250. </trim>
  251. <trim prefix="values (" suffix=")" suffixOverrides=",">
  252. <if test="pointId != null">#{pointId},</if>
  253. <if test="instrumentId != null">#{instrumentId},</if>
  254. <if test="inspectionId != null">#{inspectionId},</if>
  255. <if test="testValue != null">#{testValue},</if>
  256. <if test="netTestValue != null">#{netTestValue},</if>
  257. <if test="plantId != null">#{plantId},</if>
  258. <if test="plantName != null">#{plantName},</if>
  259. <if test="regionId != null">#{regionId},</if>
  260. <if test="regionName != null">#{regionName},</if>
  261. <if test="layer != null">#{layer},</if>
  262. <if test="devId != null">#{devId},</if>
  263. <if test="devName != null">#{devName},</if>
  264. <if test="devCode != null">#{devCode},</if>
  265. <if test="groupCode != null">#{groupCode},</if>
  266. <if test="extendCode != null">#{extendCode},</if>
  267. <if test="pointType != null">#{pointType},</if>
  268. <if test="instrumentCode != null">#{instrumentCode},</if>
  269. <if test="leakagePosition != null">#{leakagePosition},</if>
  270. <if test="checker != null">#{checker},</if>
  271. <if test="checkDate != null">#{checkDate},</if>
  272. <if test="leakageDegree != null">#{leakageDegree},</if>
  273. <if test="remarks != null">#{remarks},</if>
  274. <if test="approveStatus != null">#{approveStatus},</if>
  275. <if test="approveTime != null">#{approveTime},</if>
  276. <if test="deptId != null">#{deptId},</if>
  277. <if test="delFlag != null">#{delFlag},</if>
  278. <if test="createrCode != null">#{createrCode},</if>
  279. <if test="createdate != null">#{createdate},</if>
  280. <if test="updaterCode != null">#{updaterCode},</if>
  281. <if test="updatedate != null">#{updatedate},</if>
  282. <if test="plantType != null">#{plantType},</if>
  283. <if test="planId != null">#{plan_id},</if>
  284. </trim>
  285. </insert>
  286. <insert id="insertTCheckCheckpointsByList" parameterType="TCheckCheckpoints" useGeneratedKeys="true"
  287. keyProperty="checkId">
  288. insert into t_check_checkpoints
  289. <trim prefix="(" suffix=")" suffixOverrides=",">
  290. point_id,
  291. plant_name,
  292. plant_id,
  293. region_id,
  294. layer,
  295. dev_id,
  296. group_code,
  297. extend_code,
  298. point_type,
  299. creater_code,
  300. createdate,
  301. updater_code,
  302. updatedate,
  303. plant_type,
  304. medium_type,
  305. plan_id,
  306. repair_id,
  307. </trim>
  308. values
  309. <foreach collection="list" index="index" separator="," item="item">
  310. <trim prefix="(" suffix=")" suffixOverrides=",">
  311. #{item.pointId},
  312. #{item.plantName},
  313. #{item.plantId},
  314. #{item.regionId},
  315. #{item.layer},
  316. #{item.devId},
  317. #{item.groupCode},
  318. #{item.extendCode},
  319. #{item.pointType},
  320. #{item.createrCode},
  321. #{item.createdate},
  322. #{item.updaterCode},
  323. #{item.updatedate},
  324. #{item.plantType},
  325. #{item.mediumType},
  326. #{item.planId},
  327. <if test="item.repairId!=null">#{item.repairId},</if>
  328. <if test="item.repairId==null">null,</if>
  329. </trim>
  330. </foreach>
  331. </insert>
  332. <update id="updateTCheckCheckpoints" parameterType="TCheckCheckpoints">
  333. update t_check_checkpoints
  334. <trim prefix="SET" suffixOverrides=",">
  335. <if test="pointId != null">point_id = #{pointId},</if>
  336. <if test="inspectionId != null">inspection_id = #{inspectionId},</if>
  337. <if test="instrumentId != null">instrument_id = #{instrumentId},</if>
  338. <if test="testValue != null">test_value = #{testValue},</if>
  339. <if test="netTestValue != null">net_test_value = #{netTestValue},</if>
  340. <if test="plantName != null">plant_name = #{plantName},</if>
  341. <if test="regionName != null">region_name = #{regionName},</if>
  342. <if test="layer != null">layer = #{layer},</if>
  343. <if test="devName != null">dev_name = #{devName},</if>
  344. <if test="devCode != null">dev_code = #{devCode},</if>
  345. <if test="groupCode != null">group_code = #{groupCode},</if>
  346. <if test="extendCode != null">extend_code = #{extendCode},</if>
  347. <if test="pointType != null">point_type = #{pointType},</if>
  348. <if test="instrumentCode != null">instrument_code = #{instrumentCode},</if>
  349. <if test="leakagePosition != null">leakage_position = #{leakagePosition},</if>
  350. <if test="checker != null">checker = #{checker},</if>
  351. <if test="checkDate != null">check_date = #{checkDate},</if>
  352. <if test="leakageDegree != null">leakage_degree = #{leakageDegree},</if>
  353. <if test="remarks != null">remarks = #{remarks},</if>
  354. <if test="approveStatus != null">approve_status = #{approveStatus},</if>
  355. <if test="approveTime != null">approve_time = #{approveTime},</if>
  356. <if test="deptId != null">dept_id = #{deptId},</if>
  357. <if test="delFlag != null">del_flag = #{delFlag},</if>
  358. <if test="createrCode != null">creater_code = #{createrCode},</if>
  359. <if test="createdate != null">createdate = #{createdate},</if>
  360. <if test="updaterCode != null">updater_code = #{updaterCode},</if>
  361. <if test="updatedate != null">updatedate = #{updatedate},</if>
  362. <if test="plantType != null">plant_type = #{plantType},</if>
  363. <if test="planId != null">plan_id = #{planId},</if>
  364. </trim>
  365. where check_id = #{checkId}
  366. </update>
  367. <update id="updateTCheckCheckpointsByUpload" parameterType="TCheckCheckpoints">
  368. update t_check_checkpoints
  369. <trim prefix="SET" suffixOverrides=",">
  370. <if test="testValue != null">test_value = #{testValue},</if>
  371. <if test="netTestValue != null">net_test_value = #{netTestValue},</if>
  372. <if test="leakagePosition != null">leakage_position = #{leakagePosition},</if>
  373. <if test="checker != null">checker = #{checker},</if>
  374. <if test="checkDate != null">check_date = #{checkDate},</if>
  375. <if test="instrumentCode != null">instrument_code = #{instrumentCode},</if>
  376. <if test="instrumentId != null">instrument_id = #{instrumentId},</if>
  377. <if test="leakageDegree != null">leakage_degree = #{leakageDegree},</if>
  378. <if test="updaterCode != null">updater_code = #{updaterCode},</if>
  379. <if test="updatedate != null">updatedate = #{updatedate},</if>
  380. <if test="approveStatus != null">approve_status = #{approveStatus},</if>
  381. <if test="planId != null">plan_id = #{planId},</if>
  382. </trim>
  383. where plant_name=#{plantName} and group_code=#{groupCode} and extend_code=#{extendCode} and
  384. inspection_id=#{inspectionId} and (approve_status is null or approve_status=0)
  385. </update>
  386. <update id="updateApproveStatusByIds" parameterType="TCheckCheckpoints">
  387. update t_check_checkpoints
  388. <trim prefix="SET" suffixOverrides=",">
  389. <if test="approveStatus != null">approve_status = #{approveStatus},</if>
  390. </trim>
  391. <where>
  392. check_id in
  393. <foreach item="checkId" collection="checkIds" open="(" separator="," close=")">
  394. #{checkId}
  395. </foreach>
  396. <if test="approveStatus ==1">
  397. and approve_status=0
  398. </if>
  399. <if test="approveStatus ==2">
  400. and approve_status=1
  401. </if>
  402. and test_value is not null
  403. </where>
  404. </update>
  405. <delete id="deleteTCheckCheckpointsByCheckId" parameterType="Long">
  406. update t_check_checkpoints
  407. set del_flag=1
  408. where check_id = #{checkId}
  409. </delete>
  410. <delete id="deleteTCheckCheckpointsByCheckIds" parameterType="String">
  411. update t_check_checkpoints set del_flag=1 where check_id in
  412. <foreach item="checkId" collection="array" open="(" separator="," close=")">
  413. #{checkId}
  414. </foreach>
  415. </delete>
  416. <update id="updateTCheckCheckpointsByCheckIds" parameterType="TCheckCheckpoints">
  417. <if test="choose == 1">
  418. update t_check_checkpoints set inspection_id=#{inspectionId} where check_id in
  419. <foreach item="checkId" collection="checkIds" open="(" separator="," close=")">
  420. #{checkId}
  421. </foreach>
  422. </if>
  423. <if test="choose == 2">
  424. update t_check_checkpoints set inspection_id = null where check_id in
  425. <foreach item="checkId" collection="checkIds" open="(" separator="," close=")">
  426. #{checkId}
  427. </foreach>
  428. </if>
  429. <if test="choose == 3">
  430. update t_check_checkpoints set inspection_id = #{inspectionId} where check_id in
  431. (select t.check_id from (select check_id from t_check_checkpoints d
  432. <where>
  433. <if test="plantId != null and plantId != ''">and d.plant_id = #{plantId}</if>
  434. <if test="regionId != null and regionId != ''">and d.region_id= #{regionId}</if>
  435. <if test="devId != null and devId != ''">and d.dev_id = #{devId}</if>
  436. and d.inspection_id is null
  437. <if test="repairId == null">and repair_id is null</if>
  438. <if test="repairId != null">and repair_id is not null</if>
  439. <if test="planId != null">and plan_id=#{planId}</if>
  440. </where>
  441. ) t)
  442. </if>
  443. <if test="choose == 4">
  444. update t_check_checkpoints set inspection_id = null where inspection_id =#{inspectionId}
  445. </if>
  446. </update>
  447. <delete id="deleteCheckpoints" parameterType="TCheckCheckpoints">
  448. <if test="choose == 2">
  449. delete from t_check_checkpoints where check_id in
  450. <foreach item="checkId" collection="checkIds" open="(" separator="," close=")">
  451. #{checkId}
  452. </foreach>
  453. </if>
  454. <if test="choose == 4">
  455. delete from t_check_checkpoints where plan_id =#{planId}
  456. </if>
  457. </delete>
  458. </mapper>