TSpecdevGlMapper.xml 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342
  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.TSpecdevGlMapper">
  6. <resultMap type="TSpecdevGl" id="TSpecdevGlResult">
  7. <result property="id" column="id" />
  8. <result property="plantCode" column="plant_code" />
  9. <result property="unit" column="unit" />
  10. <result property="devname" column="devname" />
  11. <result property="devno" column="devno" />
  12. <result property="submitdate" column="submitdate" />
  13. <result property="status" column="status" />
  14. <result property="delFlag" column="del_flag" />
  15. <result property="createrCode" column="creater_code" />
  16. <result property="createdate" column="createdate" />
  17. <result property="updaterCode" column="updater_code" />
  18. <result property="updatedate" column="updatedate" />
  19. <result property="deptId" column="dept_id" />
  20. <result property="remarks" column="remarks" />
  21. <result property="approveStatus" column="approve_status" />
  22. <result property="regno" column="regno" />
  23. <result property="useno" column="useno" />
  24. <result property="warnDate" column="warn_date" />
  25. <result property="warnCycle" column="warn_cycle" />
  26. <result property="nextWarnDate" column="next_warn_date" />
  27. <result property="warnFlag" column="warn_flag" />
  28. <result property="createUnit" column="create_unit" />
  29. <result property="burnMode" column="burn_mode" />
  30. <result property="burnKind" column="burn_kind" />
  31. <result property="ratedPower" column="rated_power" />
  32. <result property="desPressure" column="des_pressure" />
  33. <result property="desTemp" column="des_temp" />
  34. <result property="optPressure" column="opt_pressure" />
  35. <result property="optTemp" column="opt_temp" />
  36. <result property="checkUnit" column="check_unit" />
  37. <result property="checkConclusion" column="check_conclusion" />
  38. <result property="model" column="model" />
  39. <result property="waterMode" column="water_mode" />
  40. <result property="reportNo" column="report_no" />
  41. <result property="approveTime" column="approve_time" />
  42. <result property="changeTime" column="change_time" />
  43. <result property="plantMaint" column="plant_maint" />
  44. <result property="outWarnDate" column="out_warn_date" />
  45. <result property="outNextWarnDate" column="out_next_warn_date" />
  46. <result property="outCheckConclusion" column="out_check_conclusion" />
  47. <result property="outReportNo" column="out_report_no" />
  48. <result property="engineer" column="engineer" />
  49. <result property="hiFlag" column="hiFlag" />
  50. </resultMap>
  51. <sql id="selectTSpecdevGlVo">
  52. select d.id, d.plant_code, d.unit, d.devname, d.devno, d.submitdate, d.status, d.del_flag, d.creater_code, d.createdate, d.updater_code, d.updatedate, d.dept_id, d.remarks, d.approve_status, d.regno, d.useno, d.warn_date, d.warn_cycle, d.next_warn_date, d.warn_flag, d.create_unit, d.burn_mode, d.burn_kind, d.rated_power, d.des_pressure, d.des_temp, d.opt_pressure, d.opt_temp, d.check_unit, d.check_conclusion, d.model, d.water_mode, d.report_no, d.approve_time, d.change_time, d.plant_maint, d.out_warn_date, d.out_next_warn_date, d.out_check_conclusion, d.out_report_no, d.engineer ,s.dept_name,
  53. (SELECT COUNT(1) from T_SPECHI_GL h where h.DEV_ID = d.id and HI_TYPE = 0 ) as hiFlag
  54. from t_specdev_gl d
  55. left join sys_dept s on s.dept_id = d.dept_id
  56. </sql>
  57. <select id="selectTSpecdevGlList" parameterType="TSpecdevGl" resultMap="TSpecdevGlResult">
  58. <include refid="selectTSpecdevGlVo"/>
  59. <where>
  60. <if test="plantCode != null and plantCode != ''"> and plant_code = #{plantCode}</if>
  61. <if test="unit != null and unit != ''"> and unit = #{unit}</if>
  62. <if test="devname != null and devname != ''"> and devname like concat(concat('%', #{devname}), '%')</if>
  63. <if test="devno != null and devno != ''"> and devno = #{devno}</if>
  64. <if test="regno != null and regno != ''"> and regno = #{regno}</if>
  65. <if test="useno != null and useno != ''"> and useno = #{useno}</if>
  66. <if test="warnDate != null "> and warn_date = #{warnDate}</if>
  67. <if test="nextWarnDate != null "> and next_warn_date = #{nextWarnDate}</if>
  68. <if test="warnFlag != null "> and warn_flag = #{warnFlag}</if>
  69. <if test="createUnit != null and createUnit != ''"> and create_unit = #{createUnit}</if>
  70. <if test="burnMode != null and burnMode != ''"> and burn_mode = #{burnMode}</if>
  71. <if test="burnKind != null and burnKind != ''"> and burn_kind = #{burnKind}</if>
  72. <if test="ratedPower != null and ratedPower != ''"> and rated_power = #{ratedPower}</if>
  73. <if test="desPressure != null and desPressure != ''"> and des_pressure = #{desPressure}</if>
  74. <if test="desTemp != null and desTemp != ''"> and des_temp = #{desTemp}</if>
  75. <if test="optPressure != null and optPressure != ''"> and opt_pressure = #{optPressure}</if>
  76. <if test="optTemp != null and optTemp != ''"> and opt_temp = #{optTemp}</if>
  77. <if test="checkUnit != null and checkUnit != ''"> and check_unit = #{checkUnit}</if>
  78. <if test="checkConclusion != null and checkConclusion != ''"> and check_conclusion = #{checkConclusion}</if>
  79. <if test="model != null and model != ''"> and model = #{model}</if>
  80. <if test="waterMode != null and waterMode != ''"> and water_mode = #{waterMode}</if>
  81. <if test="reportNo != null and reportNo != ''"> and report_no = #{reportNo}</if>
  82. <if test="approveTime != null "> and approve_time = #{approveTime}</if>
  83. <if test="changeTime != null "> and change_time = #{changeTime}</if>
  84. <if test="plantMaint != null and plantMaint != ''"> and plant_maint = #{plantMaint}</if>
  85. <if test="status != null "> and d.status = #{status}</if>
  86. <if test="approveStatus != null ">and approve_status = #{approveStatus}</if>
  87. and d.del_flag = 0
  88. </where>
  89. <!-- 数据范围过滤 -->
  90. ${params.dataScopePlant}
  91. order by d.plant_code, d.unit, d.id
  92. </select>
  93. <select id="selectTSpecdevGlListByYear" parameterType="TSpecdevGl" resultMap="TSpecdevGlResult">
  94. <include refid="selectTSpecdevGlVo"/>
  95. <where>
  96. <if test="status != null ">and d.status = #{status}</if>
  97. <if test="hiType == 1 ">and to_char(NEXT_WARN_DATE,'yyyy') = #{checkYear}</if>
  98. <if test="hiType == 2 ">and to_char(out_next_warn_date,'yyyy') = #{checkYear}</if>
  99. <if test="plantIds != null and plantIds != ''">
  100. and
  101. d.plant_code in
  102. <foreach collection="plantIds.split(',')" item="item" index="index"
  103. open="(" close=")" separator=",">
  104. #{item}
  105. </foreach>
  106. </if>
  107. <if test="unitIds != null and unitIds != ''">
  108. and
  109. (
  110. d.unit in
  111. <foreach collection="unitIds.split(',')" item="item" index="index"
  112. open="(" close=")" separator=",">
  113. #{item}
  114. </foreach>
  115. )
  116. </if>
  117. and d.del_flag = 0
  118. </where>
  119. </select>
  120. <select id="selectTSpecdevGlById" parameterType="Long" resultMap="TSpecdevGlResult">
  121. <include refid="selectTSpecdevGlVo"/>
  122. where id = #{id}
  123. </select>
  124. <insert id="insertTSpecdevGl" parameterType="TSpecdevGl">
  125. <selectKey keyProperty="id" resultType="long" order="BEFORE">
  126. SELECT seq_t_specdev_ylrq.NEXTVAL as id FROM DUAL
  127. </selectKey>
  128. insert into t_specdev_gl
  129. <trim prefix="(" suffix=")" suffixOverrides=",">
  130. <if test="id != null">id,</if>
  131. <if test="plantCode != null and plantCode != ''">plant_code,</if>
  132. <if test="unit != null">unit,</if>
  133. <if test="devname != null">devname,</if>
  134. <if test="devno != null">devno,</if>
  135. <if test="submitdate != null">submitdate,</if>
  136. <if test="status != null">status,</if>
  137. <if test="delFlag != null">del_flag,</if>
  138. <if test="createrCode != null">creater_code,</if>
  139. <if test="createdate != null">createdate,</if>
  140. <if test="updaterCode != null">updater_code,</if>
  141. <if test="updatedate != null">updatedate,</if>
  142. <if test="deptId != null">dept_id,</if>
  143. <if test="remarks != null">remarks,</if>
  144. <if test="approveStatus != null">approve_status,</if>
  145. <if test="regno != null">regno,</if>
  146. <if test="useno != null">useno,</if>
  147. <if test="warnDate != null">warn_date,</if>
  148. <if test="warnCycle != null">warn_cycle,</if>
  149. <if test="nextWarnDate != null">next_warn_date,</if>
  150. <if test="warnFlag != null">warn_flag,</if>
  151. <if test="createUnit != null">create_unit,</if>
  152. <if test="burnMode != null">burn_mode,</if>
  153. <if test="burnKind != null">burn_kind,</if>
  154. <if test="ratedPower != null">rated_power,</if>
  155. <if test="desPressure != null">des_pressure,</if>
  156. <if test="desTemp != null">des_temp,</if>
  157. <if test="optPressure != null">opt_pressure,</if>
  158. <if test="optTemp != null">opt_temp,</if>
  159. <if test="checkUnit != null">check_unit,</if>
  160. <if test="checkConclusion != null">check_conclusion,</if>
  161. <if test="model != null">model,</if>
  162. <if test="waterMode != null">water_mode,</if>
  163. <if test="reportNo != null">report_no,</if>
  164. <if test="approveTime != null">approve_time,</if>
  165. <if test="changeTime != null">change_time,</if>
  166. <if test="plantMaint != null">plant_maint,</if>
  167. <if test="outWarnDate != null">out_warn_date,</if>
  168. <if test="outNextWarnDate != null">out_next_warn_date,</if>
  169. <if test="outCheckConclusion != null">out_check_conclusion,</if>
  170. <if test="outReportNo != null">out_report_no,</if>
  171. <if test="engineer != null">engineer,</if>
  172. </trim>
  173. <trim prefix="values (" suffix=")" suffixOverrides=",">
  174. <if test="id != null">#{id},</if>
  175. <if test="plantCode != null and plantCode != ''">#{plantCode},</if>
  176. <if test="unit != null">#{unit},</if>
  177. <if test="devname != null">#{devname},</if>
  178. <if test="devno != null">#{devno},</if>
  179. <if test="submitdate != null">#{submitdate},</if>
  180. <if test="status != null">#{status},</if>
  181. <if test="delFlag != null">#{delFlag},</if>
  182. <if test="createrCode != null">#{createrCode},</if>
  183. <if test="createdate != null">#{createdate},</if>
  184. <if test="updaterCode != null">#{updaterCode},</if>
  185. <if test="updatedate != null">#{updatedate},</if>
  186. <if test="deptId != null">#{deptId},</if>
  187. <if test="remarks != null">#{remarks},</if>
  188. <if test="approveStatus != null">#{approveStatus},</if>
  189. <if test="regno != null">#{regno},</if>
  190. <if test="useno != null">#{useno},</if>
  191. <if test="warnDate != null">#{warnDate},</if>
  192. <if test="warnCycle != null">#{warnCycle},</if>
  193. <if test="nextWarnDate != null">#{nextWarnDate},</if>
  194. <if test="warnFlag != null">#{warnFlag},</if>
  195. <if test="createUnit != null">#{createUnit},</if>
  196. <if test="burnMode != null">#{burnMode},</if>
  197. <if test="burnKind != null">#{burnKind},</if>
  198. <if test="ratedPower != null">#{ratedPower},</if>
  199. <if test="desPressure != null">#{desPressure},</if>
  200. <if test="desTemp != null">#{desTemp},</if>
  201. <if test="optPressure != null">#{optPressure},</if>
  202. <if test="optTemp != null">#{optTemp},</if>
  203. <if test="checkUnit != null">#{checkUnit},</if>
  204. <if test="checkConclusion != null">#{checkConclusion},</if>
  205. <if test="model != null">#{model},</if>
  206. <if test="waterMode != null">#{waterMode},</if>
  207. <if test="reportNo != null">#{reportNo},</if>
  208. <if test="approveTime != null">#{approveTime},</if>
  209. <if test="changeTime != null">#{changeTime},</if>
  210. <if test="plantMaint != null">#{plantMaint},</if>
  211. <if test="outWarnDate != null">#{outWarnDate},</if>
  212. <if test="outNextWarnDate != null">#{outNextWarnDate},</if>
  213. <if test="outCheckConclusion != null">#{outCheckConclusion},</if>
  214. <if test="outReportNo != null">#{outReportNo},</if>
  215. <if test="engineer != null">#{engineer},</if>
  216. </trim>
  217. </insert>
  218. <update id="updateTSpecdevGl" parameterType="TSpecdevGl">
  219. update t_specdev_gl
  220. <trim prefix="SET" suffixOverrides=",">
  221. <if test="plantCode != null and plantCode != ''">plant_code = #{plantCode},</if>
  222. <if test="unit != null">unit = #{unit},</if>
  223. <if test="devname != null">devname = #{devname},</if>
  224. <if test="devno != null">devno = #{devno},</if>
  225. <if test="submitdate != null">submitdate = #{submitdate},</if>
  226. <if test="status != null">status = #{status},</if>
  227. <if test="delFlag != null">del_flag = #{delFlag},</if>
  228. <if test="createrCode != null">creater_code = #{createrCode},</if>
  229. <if test="createdate != null">createdate = #{createdate},</if>
  230. <if test="updaterCode != null">updater_code = #{updaterCode},</if>
  231. <if test="updatedate != null">updatedate = #{updatedate},</if>
  232. <if test="deptId != null">dept_id = #{deptId},</if>
  233. <if test="remarks != null">remarks = #{remarks},</if>
  234. <if test="approveStatus != null">approve_status = #{approveStatus},</if>
  235. <if test="regno != null">regno = #{regno},</if>
  236. <if test="useno != null">useno = #{useno},</if>
  237. <if test="warnDate != null">warn_date = #{warnDate},</if>
  238. <if test="warnCycle != null">warn_cycle = #{warnCycle},</if>
  239. <if test="nextWarnDate != null">next_warn_date = #{nextWarnDate},</if>
  240. <if test="warnFlag != null">warn_flag = #{warnFlag},</if>
  241. <if test="createUnit != null">create_unit = #{createUnit},</if>
  242. <if test="burnMode != null">burn_mode = #{burnMode},</if>
  243. <if test="burnKind != null">burn_kind = #{burnKind},</if>
  244. <if test="ratedPower != null">rated_power = #{ratedPower},</if>
  245. <if test="desPressure != null">des_pressure = #{desPressure},</if>
  246. <if test="desTemp != null">des_temp = #{desTemp},</if>
  247. <if test="optPressure != null">opt_pressure = #{optPressure},</if>
  248. <if test="optTemp != null">opt_temp = #{optTemp},</if>
  249. <if test="checkUnit != null">check_unit = #{checkUnit},</if>
  250. <if test="checkConclusion != null">check_conclusion = #{checkConclusion},</if>
  251. <if test="model != null">model = #{model},</if>
  252. <if test="waterMode != null">water_mode = #{waterMode},</if>
  253. <if test="reportNo != null">report_no = #{reportNo},</if>
  254. <if test="approveTime != null">approve_time = #{approveTime},</if>
  255. <if test="changeTime != null">change_time = #{changeTime},</if>
  256. <if test="plantMaint != null">plant_maint = #{plantMaint},</if>
  257. <if test="outWarnDate != null">out_warn_date = #{outWarnDate},</if>
  258. <if test="outNextWarnDate != null">out_next_warn_date = #{outNextWarnDate},</if>
  259. <if test="outCheckConclusion != null">out_check_conclusion = #{outCheckConclusion},</if>
  260. <if test="outReportNo != null">out_report_no = #{outReportNo},</if>
  261. <if test="engineer != null">engineer = #{engineer},</if>
  262. </trim>
  263. where id = #{id}
  264. </update>
  265. <update id="updateTSpecdevGlByHi" parameterType="TSpechiGl">
  266. update t_specdev_gl
  267. <trim prefix="SET" suffixOverrides=",">
  268. <if test="plantCode != null and plantCode != ''">plant_code = #{plantCode},</if>
  269. <if test="unit != null">unit = #{unit},</if>
  270. <if test="devname != null">devname = #{devname},</if>
  271. <if test="devno != null">devno = #{devno},</if>
  272. <if test="submitdate != null">submitdate = #{submitdate},</if>
  273. <if test="status != null">status = #{status},</if>
  274. <if test="delFlag != null">del_flag = #{delFlag},</if>
  275. <if test="createrCode != null">creater_code = #{createrCode},</if>
  276. <if test="createdate != null">createdate = #{createdate},</if>
  277. <if test="updaterCode != null">updater_code = #{updaterCode},</if>
  278. <if test="updatedate != null">updatedate = #{updatedate},</if>
  279. <if test="deptId != null">dept_id = #{deptId},</if>
  280. <if test="remarks != null">remarks = #{remarks},</if>
  281. <if test="approveStatus != null">approve_status = #{approveStatus},</if>
  282. <if test="regno != null">regno = #{regno},</if>
  283. <if test="useno != null">useno = #{useno},</if>
  284. <if test="warnDate != null">warn_date = #{warnDate},</if>
  285. <if test="warnCycle != null">warn_cycle = #{warnCycle},</if>
  286. <if test="nextWarnDate != null">next_warn_date = #{nextWarnDate},</if>
  287. <if test="warnFlag != null">warn_flag = #{warnFlag},</if>
  288. <if test="createUnit != null">create_unit = #{createUnit},</if>
  289. <if test="burnMode != null">burn_mode = #{burnMode},</if>
  290. <if test="burnKind != null">burn_kind = #{burnKind},</if>
  291. <if test="ratedPower != null">rated_power = #{ratedPower},</if>
  292. <if test="desPressure != null">des_pressure = #{desPressure},</if>
  293. <if test="desTemp != null">des_temp = #{desTemp},</if>
  294. <if test="optPressure != null">opt_pressure = #{optPressure},</if>
  295. <if test="optTemp != null">opt_temp = #{optTemp},</if>
  296. <if test="checkUnit != null">check_unit = #{checkUnit},</if>
  297. <if test="checkConclusion != null">check_conclusion = #{checkConclusion},</if>
  298. <if test="model != null">model = #{model},</if>
  299. <if test="waterMode != null">water_mode = #{waterMode},</if>
  300. <if test="reportNo != null">report_no = #{reportNo},</if>
  301. <if test="approveTime != null">approve_time = #{approveTime},</if>
  302. <if test="changeTime != null">change_time = #{changeTime},</if>
  303. <if test="plantMaint != null">plant_maint = #{plantMaint},</if>
  304. <if test="outWarnDate != null">out_warn_date = #{outWarnDate},</if>
  305. <if test="outNextWarnDate != null">out_next_warn_date = #{outNextWarnDate},</if>
  306. <if test="outCheckConclusion != null">out_check_conclusion = #{outCheckConclusion},</if>
  307. <if test="outReportNo != null">out_report_no = #{outReportNo},</if>
  308. <if test="engineer != null">engineer = #{engineer},</if>
  309. </trim>
  310. where id = #{devId}
  311. </update>
  312. <update id="deleteTSpecdevGlById" parameterType="Long">
  313. update t_specdev_gl set del_flag = 2 where id = #{id}
  314. </update>
  315. <update id="deleteTSpecdevGlByIds" parameterType="String">
  316. update t_specdev_gl set del_flag = 2 where id in
  317. <foreach item="id" collection="array" open="(" separator="," close=")">
  318. #{id}
  319. </foreach>
  320. </update>
  321. <update id="duplicateTSpecdevGl" >
  322. UPDATE T_SPECDEV_GL set DEL_FLAG = 2
  323. where rowid !=( select max(rowid)
  324. from T_SPECDEV_GL b
  325. where b.DEVNO = T_SPECDEV_GL.DEVNO and T_SPECDEV_GL.DEL_FLAG = 0 and b.DEL_FLAG = 0
  326. and T_SPECDEV_GL.APPROVE_STATUS = 0
  327. )
  328. </update>
  329. </mapper>