TReportYlgdMapper.xml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404
  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.sems.mapper.TReportYlgdMapper">
  6. <resultMap type="TReportYlgd" id="TReportYlgdResult">
  7. <result property="id" column="id"/>
  8. <result property="devId" column="dev_id"/>
  9. <result property="plantCode" column="plant_code"/>
  10. <result property="unit" column="unit"/>
  11. <result property="devname" column="devname"/>
  12. <result property="devno" column="devno"/>
  13. <result property="grade" column="grade"/>
  14. <result property="medium" column="medium"/>
  15. <result property="desPressure" column="des_pressure"/>
  16. <result property="desTemp" column="des_temp"/>
  17. <result property="optPressure" column="opt_pressure"/>
  18. <result property="optTemp" column="opt_temp"/>
  19. <result property="safeClass" column="safe_class"/>
  20. <result property="nextWarnDate" column="next_warn_date"/>
  21. <result property="yearReportNo" column="year_report_no"/>
  22. <result property="pj1" column="pj1"/>
  23. <result property="pj2" column="pj2"/>
  24. <result property="pj3" column="pj3"/>
  25. <result property="pj4" column="pj4"/>
  26. <result property="pj5" column="pj5"/>
  27. <result property="pj6" column="pj6"/>
  28. <result property="pj7" column="pj7"/>
  29. <result property="pj8" column="pj8"/>
  30. <result property="pj9" column="pj9"/>
  31. <result property="pj10" column="pj10"/>
  32. <result property="pj11" column="pj11"/>
  33. <result property="pj12" column="pj12"/>
  34. <result property="pj13" column="pj13"/>
  35. <result property="pj14" column="pj14"/>
  36. <result property="pj15" column="pj15"/>
  37. <result property="pj16" column="pj16"/>
  38. <result property="pj17" column="pj17"/>
  39. <result property="remarks" column="remarks"/>
  40. <result property="checkDate" column="check_date"/>
  41. <result property="nextCheckDate" column="next_check_date"/>
  42. <result property="problem" column="problem"/>
  43. <result property="con" column="con"/>
  44. <result property="approveStatus" column="approve_status"/>
  45. <result property="approveTime" column="approve_time"/>
  46. <result property="deptId" column="dept_id"/>
  47. <result property="delFlag" column="del_flag"/>
  48. <result property="createrCode" column="creater_code"/>
  49. <result property="createdate" column="createdate"/>
  50. <result property="updaterCode" column="updater_code"/>
  51. <result property="updatedate" column="updatedate"/>
  52. <result property="deptName" column="dept_name"/>
  53. </resultMap>
  54. <sql id="selectTReportYlgdVo">
  55. select d.id,
  56. d.dev_id,
  57. y.plant_code,
  58. y.unit,
  59. y.devname,
  60. y.devno,
  61. y.grade,
  62. d.medium,
  63. d.des_pressure,
  64. d.des_temp,
  65. d.opt_pressure,
  66. d.opt_temp,
  67. y.safe_class,
  68. y.next_warn_date,
  69. d.year_report_no,
  70. d.pj1,
  71. d.pj2,
  72. d.pj3,
  73. d.pj4,
  74. d.pj5,
  75. d.pj6,
  76. d.pj7,
  77. d.pj8,
  78. d.pj9,
  79. d.pj10,
  80. d.pj11,
  81. d.pj12,
  82. d.pj13,
  83. d.pj14,
  84. d.pj15,
  85. d.pj16,
  86. d.pj17,
  87. d.remarks,
  88. d.check_date,
  89. d.next_check_date,
  90. d.problem,
  91. d.con,
  92. d.approve_status,
  93. d.approve_time,
  94. d.dept_id,
  95. d.del_flag,
  96. d.creater_code,
  97. d.createdate,
  98. d.updater_code,
  99. d.updatedate,
  100. s.dept_name
  101. from t_report_ylgd d
  102. left join sys_dept s on s.dept_id = d.dept_id
  103. left join t_specdev_ylgd y on y.id = d.dev_id
  104. </sql>
  105. <select id="selectTReportYlgdList" parameterType="TReportYlgd" resultMap="TReportYlgdResult">
  106. <include refid="selectTReportYlgdVo"/>
  107. <where>
  108. <if test="plantCode != null and plantCode != ''"> and y.plant_code like concat(concat('%', #{plantCode}), '%')</if>
  109. <if test="approveStatus != null and approveStatus != '' or approveStatus== 0"> and d.approve_status = #{approveStatus}</if>
  110. <if test="unit != null and unit != ''"> and y.unit like concat(concat('%', #{unit}), '%')</if>
  111. and d.del_flag = 0
  112. </where>
  113. <!-- 数据范围过滤 -->
  114. ${params.dataScopePlant}
  115. </select>
  116. <select id="queryNeedInsertIds" resultType="Long">
  117. SELECT b.id
  118. FROM t_specdev_ylgd b
  119. where b.del_flag = 0
  120. and b.status = 1
  121. MINUS
  122. SELECT a.id
  123. FROM t_report_ylgd a
  124. where a.del_flag = 0
  125. </select>
  126. <update id="updateForImport">
  127. update t_report_ylgd
  128. <trim prefix="SET" suffixOverrides=",">
  129. <if test="pj1 != null">pj1 = #{pj1},</if>
  130. <if test="pj2 != null">pj2 = #{pj2},</if>
  131. <if test="pj3 != null">pj3 = #{pj3},</if>
  132. <if test="pj4 != null">pj4 = #{pj4},</if>
  133. <if test="pj5 != null">pj5 = #{pj5},</if>
  134. <if test="pj6 != null">pj6 = #{pj6},</if>
  135. <if test="pj7 != null">pj7 = #{pj7},</if>
  136. <if test="pj8 != null">pj8 = #{pj8},</if>
  137. <if test="pj9 != null">pj9 = #{pj9},</if>
  138. <if test="pj10 != null">pj10 = #{pj10},</if>
  139. <if test="pj11 != null">pj11 = #{pj11},</if>
  140. <if test="pj12 != null">pj12 = #{pj12},</if>
  141. <if test="pj13 != null">pj13 = #{pj13},</if>
  142. <if test="pj14 != null">pj14 = #{pj14},</if>
  143. <if test="pj15 != null">pj15 = #{pj15},</if>
  144. <if test="pj16 != null">pj16 = #{pj16},</if>
  145. <if test="pj17 != null">pj17 = #{pj17},</if>
  146. </trim>
  147. where dev_id = (
  148. select id
  149. from t_specdev_ylgd
  150. where devno = #{devno}
  151. and useno = #{useno}
  152. and regno = #{regno}
  153. and del_flag = 0
  154. )
  155. </update>
  156. <select id="queryNeedUpdateIds" resultType="Long">
  157. SELECT b.id
  158. FROM t_specdev_ylgd b
  159. WHERE b.del_flag = 0
  160. and b.status = 1
  161. INTERSECT
  162. SELECT a.id
  163. FROM t_report_ylgd a
  164. WHERE a.del_flag = 0
  165. </select>
  166. <select id="queryNeedDeleteIds" resultType="Long">
  167. SELECT a.id
  168. FROM t_report_ylgd a
  169. where a.del_flag = 0
  170. MINUS
  171. SELECT b.id
  172. FROM t_specdev_ylgd b
  173. where b.del_flag = 0
  174. and b.status = 1
  175. </select>
  176. <!-- 新增同步台账下数据 -->
  177. <insert id="insertByTSpecdevYlgd">
  178. insert into t_report_ylgd
  179. <trim prefix="(" suffix=")" suffixOverrides=",">
  180. <if test="id != null">id,</if>
  181. <if test="id != null">dev_id,</if>
  182. <if test="medium != null">medium,</if>
  183. <if test="desPressure != null">des_pressure,</if>
  184. <if test="desTemp != null">des_temp,</if>
  185. <if test="optPressure != null">opt_pressure,</if>
  186. <if test="optTemp != null">opt_temp,</if>
  187. <if test="yearReportNo != null">year_report_no,</if>
  188. <if test="remarks != null">remarks,</if>
  189. <if test="deptId != null">dept_id,</if>
  190. <if test="delFlag != null">del_flag,</if>
  191. <if test="createrCode != null">creater_code,</if>
  192. <if test="createdate != null">createdate,</if>
  193. <if test="updaterCode != null">updater_code,</if>
  194. <if test="updatedate != null">updatedate,</if>
  195. pj1,pj2,pj3,pj4,pj5,pj6,pj7,pj8,pj9,pj10,pj11,pj12,pj13,pj14,pj15,pj16,pj17
  196. </trim>
  197. <trim prefix="values (" suffix=")" suffixOverrides=",">
  198. <if test="id != null">#{id},</if>
  199. <if test="id != null">#{id},</if>
  200. <if test="medium != null">#{medium},</if>
  201. <if test="desPressure != null">#{desPressure},</if>
  202. <if test="desTemp != null">#{desTemp},</if>
  203. <if test="optPressure != null">#{optPressure},</if>
  204. <if test="optTemp != null">#{optTemp},</if>
  205. <if test="yearReportNo != null">#{yearReportNo},</if>
  206. <if test="remarks != null">#{remarks},</if>
  207. <if test="deptId != null">#{deptId},</if>
  208. <if test="delFlag != null">#{delFlag},</if>
  209. <if test="createrCode != null">#{createrCode},</if>
  210. <if test="createdate != null">#{createdate},</if>
  211. <if test="updaterCode != null">#{updaterCode},</if>
  212. <if test="updatedate != null">#{updatedate},</if>
  213. <![CDATA[
  214. '√','√','√','√','√','√','√','√','√','√','√','√','√','√','√','√','√',]]>
  215. </trim>
  216. </insert>
  217. <update id="updateByTSpecdevYlgd">
  218. update t_report_ylgd
  219. <trim prefix="SET" suffixOverrides=",">
  220. <if test="id != null">dev_id = #{id},</if>
  221. <if test="medium != null">medium = #{medium},</if>
  222. <if test="desPressure != null">des_pressure = #{desPressure},</if>
  223. <if test="desTemp != null">des_temp = #{desTemp},</if>
  224. <if test="optPressure != null">opt_pressure = #{optPressure},</if>
  225. <if test="optTemp != null">opt_temp = #{optTemp},</if>
  226. <if test="yearReportNo != null">year_report_no = #{yearReportNo},</if>
  227. <if test="remarks != null">remarks = #{remarks},</if>
  228. <if test="deptId != null">dept_id = #{deptId},</if>
  229. <if test="delFlag != null">del_flag = #{delFlag},</if>
  230. <if test="createrCode != null">creater_code = #{createrCode},</if>
  231. <if test="createdate != null">createdate = #{createdate},</if>
  232. <if test="updaterCode != null">updater_code = #{updaterCode},</if>
  233. <if test="updatedate != null">updatedate = #{updatedate},</if>
  234. </trim>
  235. where id = #{id}
  236. </update>
  237. <select id="selectTReportYlgdById" parameterType="Long" resultMap="TReportYlgdResult">
  238. <include refid="selectTReportYlgdVo"/>
  239. where d.id = #{id}
  240. </select>
  241. <insert id="insertTReportYlgd" parameterType="TReportYlgd">
  242. <selectKey keyProperty="id" resultType="long" order="BEFORE">
  243. SELECT seq_t_report_ylgd.NEXTVAL as id FROM DUAL
  244. </selectKey>
  245. insert into t_report_ylgd
  246. <trim prefix="(" suffix=")" suffixOverrides=",">
  247. <if test="id != null">id,</if>
  248. <if test="devId != null">dev_id,</if>
  249. <if test="medium != null">medium,</if>
  250. <if test="desPressure != null">des_pressure,</if>
  251. <if test="desTemp != null">des_temp,</if>
  252. <if test="optPressure != null">opt_pressure,</if>
  253. <if test="optTemp != null">opt_temp,</if>
  254. <if test="yearReportNo != null">year_report_no,</if>
  255. <if test="pj1 != null">pj1,</if>
  256. <if test="pj2 != null">pj2,</if>
  257. <if test="pj3 != null">pj3,</if>
  258. <if test="pj4 != null">pj4,</if>
  259. <if test="pj5 != null">pj5,</if>
  260. <if test="pj6 != null">pj6,</if>
  261. <if test="pj7 != null">pj7,</if>
  262. <if test="pj8 != null">pj8,</if>
  263. <if test="pj9 != null">pj9,</if>
  264. <if test="pj10 != null">pj10,</if>
  265. <if test="pj11 != null">pj11,</if>
  266. <if test="pj12 != null">pj12,</if>
  267. <if test="pj13 != null">pj13,</if>
  268. <if test="pj14 != null">pj14,</if>
  269. <if test="pj15 != null">pj15,</if>
  270. <if test="pj16 != null">pj16,</if>
  271. <if test="pj17 != null">pj17,</if>
  272. <if test="remarks != null">remarks,</if>
  273. <if test="checkDate != null">check_date,</if>
  274. <if test="nextCheckDate != null">next_check_date,</if>
  275. <if test="problem != null">problem,</if>
  276. <if test="con != null">con,</if>
  277. <if test="approveStatus != null">approve_status,</if>
  278. <if test="approveTime != null">approve_time,</if>
  279. <if test="deptId != null">dept_id,</if>
  280. <if test="delFlag != null">del_flag,</if>
  281. <if test="createrCode != null">creater_code,</if>
  282. <if test="createdate != null">createdate,</if>
  283. <if test="updaterCode != null">updater_code,</if>
  284. <if test="updatedate != null">updatedate,</if>
  285. </trim>
  286. <trim prefix="values (" suffix=")" suffixOverrides=",">
  287. <if test="id != null">#{id},</if>
  288. <if test="devId != null">#{devId},</if>
  289. <if test="medium != null">#{medium},</if>
  290. <if test="desPressure != null">#{desPressure},</if>
  291. <if test="desTemp != null">#{desTemp},</if>
  292. <if test="optPressure != null">#{optPressure},</if>
  293. <if test="optTemp != null">#{optTemp},</if>
  294. <if test="yearReportNo != null">#{yearReportNo},</if>
  295. <if test="pj1 != null">#{pj1},</if>
  296. <if test="pj2 != null">#{pj2},</if>
  297. <if test="pj3 != null">#{pj3},</if>
  298. <if test="pj4 != null">#{pj4},</if>
  299. <if test="pj5 != null">#{pj5},</if>
  300. <if test="pj6 != null">#{pj6},</if>
  301. <if test="pj7 != null">#{pj7},</if>
  302. <if test="pj8 != null">#{pj8},</if>
  303. <if test="pj9 != null">#{pj9},</if>
  304. <if test="pj10 != null">#{pj10},</if>
  305. <if test="pj11 != null">#{pj11},</if>
  306. <if test="pj12 != null">#{pj12},</if>
  307. <if test="pj13 != null">#{pj13},</if>
  308. <if test="pj14 != null">#{pj14},</if>
  309. <if test="pj15 != null">#{pj15},</if>
  310. <if test="pj16 != null">#{pj16},</if>
  311. <if test="pj17 != null">#{pj17},</if>
  312. <if test="remarks != null">#{remarks},</if>
  313. <if test="checkDate != null">#{checkDate},</if>
  314. <if test="nextCheckDate != null">#{nextCheckDate},</if>
  315. <if test="problem != null">#{problem},</if>
  316. <if test="con != null">#{con},</if>
  317. <if test="approveStatus != null">#{approveStatus},</if>
  318. <if test="approveTime != null">#{approveTime},</if>
  319. <if test="deptId != null">#{deptId},</if>
  320. <if test="delFlag != null">#{delFlag},</if>
  321. <if test="createrCode != null">#{createrCode},</if>
  322. <if test="createdate != null">#{createdate},</if>
  323. <if test="updaterCode != null">#{updaterCode},</if>
  324. <if test="updatedate != null">#{updatedate},</if>
  325. </trim>
  326. </insert>
  327. <update id="updateTReportYlgd" parameterType="TReportYlgd">
  328. update t_report_ylgd
  329. <trim prefix="SET" suffixOverrides=",">
  330. <if test="devId != null">dev_id = #{devId},</if>
  331. <if test="medium != null">medium = #{medium},</if>
  332. <if test="desPressure != null">des_pressure = #{desPressure},</if>
  333. <if test="desTemp != null">des_temp = #{desTemp},</if>
  334. <if test="optPressure != null">opt_pressure = #{optPressure},</if>
  335. <if test="optTemp != null">opt_temp = #{optTemp},</if>
  336. <if test="yearReportNo != null">year_report_no = #{yearReportNo},</if>
  337. <if test="pj1 != null">pj1 = #{pj1},</if>
  338. <if test="pj2 != null">pj2 = #{pj2},</if>
  339. <if test="pj3 != null">pj3 = #{pj3},</if>
  340. <if test="pj4 != null">pj4 = #{pj4},</if>
  341. <if test="pj5 != null">pj5 = #{pj5},</if>
  342. <if test="pj6 != null">pj6 = #{pj6},</if>
  343. <if test="pj7 != null">pj7 = #{pj7},</if>
  344. <if test="pj8 != null">pj8 = #{pj8},</if>
  345. <if test="pj9 != null">pj9 = #{pj9},</if>
  346. <if test="pj10 != null">pj10 = #{pj10},</if>
  347. <if test="pj11 != null">pj11 = #{pj11},</if>
  348. <if test="pj12 != null">pj12 = #{pj12},</if>
  349. <if test="pj13 != null">pj13 = #{pj13},</if>
  350. <if test="pj14 != null">pj14 = #{pj14},</if>
  351. <if test="pj15 != null">pj15 = #{pj15},</if>
  352. <if test="pj16 != null">pj16 = #{pj16},</if>
  353. <if test="pj17 != null">pj17 = #{pj17},</if>
  354. <if test="remarks != null">remarks = #{remarks},</if>
  355. <if test="checkDate != null">check_date = #{checkDate},</if>
  356. <if test="nextCheckDate != null">next_check_date = #{nextCheckDate},</if>
  357. <if test="problem != null">problem = #{problem},</if>
  358. <if test="con != null">con = #{con},</if>
  359. <if test="approveStatus != null">approve_status = #{approveStatus},</if>
  360. <if test="approveTime != null">approve_time = #{approveTime},</if>
  361. <if test="deptId != null">dept_id = #{deptId},</if>
  362. <if test="delFlag != null">del_flag = #{delFlag},</if>
  363. <if test="createrCode != null">creater_code = #{createrCode},</if>
  364. <if test="createdate != null">createdate = #{createdate},</if>
  365. <if test="updaterCode != null">updater_code = #{updaterCode},</if>
  366. <if test="updatedate != null">updatedate = #{updatedate},</if>
  367. </trim>
  368. where id = #{id}
  369. </update>
  370. <update id="deleteTReportYlgdById" parameterType="Long">
  371. update t_report_ylgd
  372. set del_flag = 2
  373. where id = #{id}
  374. </update>
  375. <update id="deleteTReportYlgdByIds" parameterType="String">
  376. update t_report_ylgd set del_flag = 2 where id in
  377. <foreach item="id" collection="array" open="(" close=")" index="index">
  378. <if test="index != 0">
  379. <choose>
  380. <when test="index % 1000 == 999">) OR id in (</when>
  381. <otherwise>,</otherwise>
  382. </choose>
  383. </if>
  384. #{id}
  385. </foreach>
  386. </update>
  387. </mapper>