TSpecdevGlMapper.xml 23 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384
  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. <result property="isRepeat" column="is_repeat"/>
  51. <result property="containerNo" column="container_no"/>
  52. <result property="filedSituation" column="filed_situation"/>
  53. <result property="internalInspection" column="internal_inspection"/>
  54. <result property="externalInspection" column="external_inspection"/>
  55. <result property="pressureTest" column="pressure_test"/>
  56. <result property="energyEfficiencyTest" column="energy_efficiency_test"/>
  57. <result property="factoryInfo" column="factory_info"/>
  58. <result property="factoryNo" column="factory_no"/>
  59. <result property="medium" column="medium"/>
  60. <result property="designUnit" column="design_unit"/>
  61. </resultMap>
  62. <sql id="selectTSpecdevGlVo">
  63. 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,
  64. d.is_repeat,d.container_no,
  65. d.filed_situation,
  66. d.internal_inspection,
  67. d.external_inspection,
  68. d.pressure_test,
  69. d.energy_efficiency_test,
  70. d.factory_info,
  71. d.factory_no,
  72. d.medium,
  73. d.design_unit
  74. from t_specdev_gl d
  75. left join sys_dept s on s.dept_id = d.dept_id
  76. </sql>
  77. <select id="selectTSpecdevGlList" parameterType="TSpecdevGl" resultMap="TSpecdevGlResult">
  78. <include refid="selectTSpecdevGlVo"/>
  79. <where>
  80. <if test="plantCode != null and plantCode != ''"> and plant_code = #{plantCode}</if>
  81. <if test="unit != null and unit != ''"> and unit = #{unit}</if>
  82. <if test="devname != null and devname != ''"> and devname like concat(concat('%', #{devname}), '%')</if>
  83. <if test="devno != null and devno != ''"> and devno = #{devno}</if>
  84. <if test="regno != null and regno != ''"> and regno = #{regno}</if>
  85. <if test="useno != null and useno != ''"> and useno = #{useno}</if>
  86. <if test="warnDate != null "> and warn_date = #{warnDate}</if>
  87. <if test="nextWarnDate != null "> and next_warn_date = #{nextWarnDate}</if>
  88. <if test="warnFlag != null "> and warn_flag = #{warnFlag}</if>
  89. <if test="createUnit != null and createUnit != ''"> and create_unit = #{createUnit}</if>
  90. <if test="burnMode != null and burnMode != ''"> and burn_mode = #{burnMode}</if>
  91. <if test="burnKind != null and burnKind != ''"> and burn_kind = #{burnKind}</if>
  92. <if test="ratedPower != null and ratedPower != ''"> and rated_power = #{ratedPower}</if>
  93. <if test="desPressure != null and desPressure != ''"> and des_pressure = #{desPressure}</if>
  94. <if test="desTemp != null and desTemp != ''"> and des_temp = #{desTemp}</if>
  95. <if test="optPressure != null and optPressure != ''"> and opt_pressure = #{optPressure}</if>
  96. <if test="optTemp != null and optTemp != ''"> and opt_temp = #{optTemp}</if>
  97. <if test="checkUnit != null and checkUnit != ''"> and check_unit = #{checkUnit}</if>
  98. <if test="checkConclusion != null and checkConclusion != ''"> and check_conclusion = #{checkConclusion}</if>
  99. <if test="model != null and model != ''"> and model = #{model}</if>
  100. <if test="waterMode != null and waterMode != ''"> and water_mode = #{waterMode}</if>
  101. <if test="reportNo != null and reportNo != ''"> and report_no = #{reportNo}</if>
  102. <if test="approveTime != null "> and approve_time = #{approveTime}</if>
  103. <if test="changeTime != null "> and change_time = #{changeTime}</if>
  104. <if test="plantMaint != null and plantMaint != ''"> and plant_maint = #{plantMaint}</if>
  105. <if test="status != null "> and d.status = #{status}</if>
  106. <if test="approveStatus != null ">and approve_status = #{approveStatus}</if>
  107. <if test="warnFlag != null ">and warn_Flag = #{warnFlag}</if>
  108. <if test="containerNo != null "> and `container_no` = #{containerNo}</if>
  109. <if test="filedSituation != null "> and `filed_situation` = #{filedSituation}</if>
  110. <if test="internalInspection != null "> and `internal_inspection` = #{internalInspection}</if>
  111. <if test="externalInspection != null "> and `external_inspection` = #{externalInspection}</if>
  112. <if test="pressureTest != null "> and `pressure_test` = #{pressureTest}</if>
  113. <if test="energyEfficiencyTest != null "> and `energy_efficiency_test` = #{energyEfficiencyTest}</if>
  114. <if test="factoryInfo != null "> and `factory_info` = #{factoryInfo}</if>
  115. <if test="factoryNo != null "> and `factory_no` = #{factoryNo}</if>
  116. <if test="medium != null "> and `medium` = #{medium}</if>
  117. <if test="designUnit != null "> and `design_unit` = #{designUnit}</if>
  118. <if test="fuzzy != null and fuzzy!=''"> and (plant_code like concat('%',#{fuzzy},'%')
  119. or unit like concat('%',#{fuzzy},'%')
  120. or devname like concat('%',#{fuzzy},'%')
  121. or devno like concat('%',#{fuzzy},'%')
  122. or regno like concat('%',#{fuzzy},'%')
  123. or useno like concat('%',#{fuzzy},'%')
  124. or warn_date like concat('%',#{fuzzy},'%')
  125. or next_warn_date like concat('%',#{fuzzy},'%')
  126. or warn_flag like concat('%',#{fuzzy},'%')
  127. or create_unit like concat('%',#{fuzzy},'%')
  128. or burn_mode like concat('%',#{fuzzy},'%')
  129. or burn_kind like concat('%',#{fuzzy},'%')
  130. or rated_power like concat('%',#{fuzzy},'%')
  131. or des_pressure like concat('%',#{fuzzy},'%')
  132. or des_temp like concat('%',#{fuzzy},'%')
  133. or opt_pressure like concat('%',#{fuzzy},'%')
  134. or opt_temp like concat('%',#{fuzzy},'%')
  135. or check_unit like concat('%',#{fuzzy},'%')
  136. or check_conclusion like concat('%',#{fuzzy},'%')
  137. or model like concat('%',#{fuzzy},'%')
  138. or water_mode like concat('%',#{fuzzy},'%')
  139. or report_no like concat('%',#{fuzzy},'%')
  140. or plant_maint like concat('%',#{fuzzy},'%')
  141. or `container_no` like concat('%',#{fuzzy},'%')
  142. or `filed_situation` like concat('%',#{fuzzy},'%')
  143. or `internal_inspection` like concat('%',#{fuzzy},'%')
  144. or `external_inspection` like concat('%',#{fuzzy},'%')
  145. or `pressure_test` like concat('%',#{fuzzy},'%')
  146. or `energy_efficiency_test` like concat('%',#{fuzzy},'%')
  147. or `factory_info` like concat('%',#{fuzzy},'%')
  148. or `factory_no` like concat('%',#{fuzzy},'%')
  149. or `medium` like concat('%',#{fuzzy},'%')
  150. or `design_unit` like concat('%',#{fuzzy},'%'))</if>
  151. and d.del_flag = 0
  152. </where>
  153. <!-- 数据范围过滤 -->
  154. ${params.dataScopePlant}
  155. order by d.is_repeat desc, d.plant_code, d.unit, d.id
  156. </select>
  157. <select id="selectTSpecdevGlListByYear" parameterType="TSpecdevGl" resultMap="TSpecdevGlResult">
  158. <include refid="selectTSpecdevGlVo"/>
  159. <where>
  160. <if test="status != null ">and d.status = #{status}</if>
  161. <if test="hiType == 1 ">and date_format(NEXT_WARN_DATE,'%Y') = #{checkYear}</if>
  162. <if test="hiType == 2 ">and date_format(out_next_warn_date,'%Y') = #{checkYear}</if>
  163. <if test="plantIds != null and plantIds != ''">
  164. and
  165. d.plant_code in
  166. <foreach collection="plantIds.split(',')" item="item" index="index"
  167. open="(" close=")" separator=",">
  168. #{item}
  169. </foreach>
  170. </if>
  171. <!--<if test="unitIds != null and unitIds != ''">
  172. and
  173. (
  174. d.unit in
  175. <foreach collection="unitIds.split(',')" item="item" index="index"
  176. open="(" close=")" separator=",">
  177. #{item}
  178. </foreach>
  179. )
  180. </if>-->
  181. and d.del_flag = 0
  182. </where>
  183. </select>
  184. <select id="selectTSpecdevGlById" parameterType="Long" resultMap="TSpecdevGlResult">
  185. <include refid="selectTSpecdevGlVo"/>
  186. where id = #{id}
  187. </select>
  188. <insert id="insertTSpecdevGl" parameterType="TSpecdevGl">
  189. insert into t_specdev_gl
  190. <trim prefix="(" suffix=")" suffixOverrides=",">
  191. <if test="id != null">id,</if>
  192. <if test="plantCode != null and plantCode != ''">plant_code,</if>
  193. <if test="unit != null">unit,</if>
  194. <if test="devname != null">devname,</if>
  195. <if test="devno != null">devno,</if>
  196. <if test="submitdate != null">submitdate,</if>
  197. <if test="status != null">status,</if>
  198. <if test="delFlag != null">del_flag,</if>
  199. <if test="createrCode != null">creater_code,</if>
  200. <if test="createdate != null">createdate,</if>
  201. <if test="updaterCode != null">updater_code,</if>
  202. <if test="updatedate != null">updatedate,</if>
  203. <if test="deptId != null">dept_id,</if>
  204. <if test="remarks != null">remarks,</if>
  205. <if test="approveStatus != null">approve_status,</if>
  206. <if test="regno != null">regno,</if>
  207. <if test="useno != null">useno,</if>
  208. <if test="warnDate != null">warn_date,</if>
  209. <if test="warnCycle != null">warn_cycle,</if>
  210. <if test="nextWarnDate != null">next_warn_date,</if>
  211. <if test="warnFlag != null">warn_flag,</if>
  212. <if test="createUnit != null">create_unit,</if>
  213. <if test="burnMode != null">burn_mode,</if>
  214. <if test="burnKind != null">burn_kind,</if>
  215. <if test="ratedPower != null">rated_power,</if>
  216. <if test="desPressure != null">des_pressure,</if>
  217. <if test="desTemp != null">des_temp,</if>
  218. <if test="optPressure != null">opt_pressure,</if>
  219. <if test="optTemp != null">opt_temp,</if>
  220. <if test="checkUnit != null">check_unit,</if>
  221. <if test="checkConclusion != null">check_conclusion,</if>
  222. <if test="model != null">model,</if>
  223. <if test="waterMode != null">water_mode,</if>
  224. <if test="reportNo != null">report_no,</if>
  225. <if test="approveTime != null">approve_time,</if>
  226. <if test="changeTime != null">change_time,</if>
  227. <if test="plantMaint != null">plant_maint,</if>
  228. <if test="outWarnDate != null">out_warn_date,</if>
  229. <if test="outNextWarnDate != null">out_next_warn_date,</if>
  230. <if test="outCheckConclusion != null">out_check_conclusion,</if>
  231. <if test="outReportNo != null">out_report_no,</if>
  232. <if test="engineer != null">engineer,</if>
  233. <if test="containerNo != null "> `container_no`,</if>
  234. <if test="filedSituation != null "> `filed_situation` ,</if>
  235. <if test="internalInspection != null "> `internal_inspection` ,</if>
  236. <if test="externalInspection != null "> `external_inspection` ,</if>
  237. <if test="pressureTest != null "> `pressure_test`, </if>
  238. <if test="energyEfficiencyTest != null "> `energy_efficiency_test` ,</if>
  239. <if test="factoryInfo != null "> `factory_info` ,</if>
  240. <if test="factoryNo != null "> `factory_no` ,</if>
  241. <if test="medium != null "> `medium` ,</if>
  242. <if test="designUnit != null "> `design_unit` ,</if>
  243. </trim>
  244. <trim prefix="values (" suffix=")" suffixOverrides=",">
  245. <if test="id != null">#{id},</if>
  246. <if test="plantCode != null and plantCode != ''">#{plantCode},</if>
  247. <if test="unit != null">#{unit},</if>
  248. <if test="devname != null">#{devname},</if>
  249. <if test="devno != null">#{devno},</if>
  250. <if test="submitdate != null">#{submitdate},</if>
  251. <if test="status != null">#{status},</if>
  252. <if test="delFlag != null">#{delFlag},</if>
  253. <if test="createrCode != null">#{createrCode},</if>
  254. <if test="createdate != null">#{createdate},</if>
  255. <if test="updaterCode != null">#{updaterCode},</if>
  256. <if test="updatedate != null">#{updatedate},</if>
  257. <if test="deptId != null">#{deptId},</if>
  258. <if test="remarks != null">#{remarks},</if>
  259. <if test="approveStatus != null">#{approveStatus},</if>
  260. <if test="regno != null">#{regno},</if>
  261. <if test="useno != null">#{useno},</if>
  262. <if test="warnDate != null">#{warnDate},</if>
  263. <if test="warnCycle != null">#{warnCycle},</if>
  264. <if test="nextWarnDate != null">#{nextWarnDate},</if>
  265. <if test="warnFlag != null">#{warnFlag},</if>
  266. <if test="createUnit != null">#{createUnit},</if>
  267. <if test="burnMode != null">#{burnMode},</if>
  268. <if test="burnKind != null">#{burnKind},</if>
  269. <if test="ratedPower != null">#{ratedPower},</if>
  270. <if test="desPressure != null">#{desPressure},</if>
  271. <if test="desTemp != null">#{desTemp},</if>
  272. <if test="optPressure != null">#{optPressure},</if>
  273. <if test="optTemp != null">#{optTemp},</if>
  274. <if test="checkUnit != null">#{checkUnit},</if>
  275. <if test="checkConclusion != null">#{checkConclusion},</if>
  276. <if test="model != null">#{model},</if>
  277. <if test="waterMode != null">#{waterMode},</if>
  278. <if test="reportNo != null">#{reportNo},</if>
  279. <if test="approveTime != null">#{approveTime},</if>
  280. <if test="changeTime != null">#{changeTime},</if>
  281. <if test="plantMaint != null">#{plantMaint},</if>
  282. <if test="outWarnDate != null">#{outWarnDate},</if>
  283. <if test="outNextWarnDate != null">#{outNextWarnDate},</if>
  284. <if test="outCheckConclusion != null">#{outCheckConclusion},</if>
  285. <if test="outReportNo != null">#{outReportNo},</if>
  286. <if test="engineer != null">#{engineer},</if>
  287. <if test="containerNo != null "> #{containerNo},</if>
  288. <if test="filedSituation != null "> #{filedSituation},</if>
  289. <if test="internalInspection != null "> #{internalInspection},</if>
  290. <if test="externalInspection != null "> #{externalInspection},</if>
  291. <if test="pressureTest != null "> #{pressureTest},</if>
  292. <if test="energyEfficiencyTest != null "> #{energyEfficiencyTest},</if>
  293. <if test="factoryInfo != null "> #{factoryInfo},</if>
  294. <if test="factoryNo != null "> #{factoryNo},</if>
  295. <if test="medium != null "> #{medium},</if>
  296. <if test="designUnit != null "> #{designUnit},</if>
  297. </trim>
  298. </insert>
  299. <update id="updateTSpecdevGl" parameterType="TSpecdevGl">
  300. update t_specdev_gl
  301. <trim prefix="SET" suffixOverrides=",">
  302. <if test="plantCode != null and plantCode != ''">plant_code = #{plantCode},</if>
  303. <if test="unit != null">unit = #{unit},</if>
  304. <if test="devname != null">devname = #{devname},</if>
  305. <if test="devno != null">devno = #{devno},</if>
  306. <if test="submitdate != null">submitdate = #{submitdate},</if>
  307. <if test="status != null">status = #{status},</if>
  308. <if test="delFlag != null">del_flag = #{delFlag},</if>
  309. <if test="createrCode != null">creater_code = #{createrCode},</if>
  310. <if test="createdate != null">createdate = #{createdate},</if>
  311. <if test="updaterCode != null">updater_code = #{updaterCode},</if>
  312. <if test="updatedate != null">updatedate = #{updatedate},</if>
  313. <if test="deptId != null">dept_id = #{deptId},</if>
  314. <if test="remarks != null">remarks = #{remarks},</if>
  315. <if test="approveStatus != null">approve_status = #{approveStatus},</if>
  316. <if test="regno != null">regno = #{regno},</if>
  317. <if test="useno != null">useno = #{useno},</if>
  318. <if test="warnDate != null">warn_date = #{warnDate},</if>
  319. <if test="warnCycle != null">warn_cycle = #{warnCycle},</if>
  320. <if test="nextWarnDate != null">next_warn_date = #{nextWarnDate},</if>
  321. <if test="warnFlag != null">warn_flag = #{warnFlag},</if>
  322. <if test="createUnit != null">create_unit = #{createUnit},</if>
  323. <if test="burnMode != null">burn_mode = #{burnMode},</if>
  324. <if test="burnKind != null">burn_kind = #{burnKind},</if>
  325. <if test="ratedPower != null">rated_power = #{ratedPower},</if>
  326. <if test="desPressure != null">des_pressure = #{desPressure},</if>
  327. <if test="desTemp != null">des_temp = #{desTemp},</if>
  328. <if test="optPressure != null">opt_pressure = #{optPressure},</if>
  329. <if test="optTemp != null">opt_temp = #{optTemp},</if>
  330. <if test="checkUnit != null">check_unit = #{checkUnit},</if>
  331. <if test="checkConclusion != null">check_conclusion = #{checkConclusion},</if>
  332. <if test="model != null">model = #{model},</if>
  333. <if test="waterMode != null">water_mode = #{waterMode},</if>
  334. <if test="reportNo != null">report_no = #{reportNo},</if>
  335. <if test="approveTime != null">approve_time = #{approveTime},</if>
  336. <if test="changeTime != null">change_time = #{changeTime},</if>
  337. <if test="plantMaint != null">plant_maint = #{plantMaint},</if>
  338. <if test="outWarnDate != null">out_warn_date = #{outWarnDate},</if>
  339. <if test="outNextWarnDate != null">out_next_warn_date = #{outNextWarnDate},</if>
  340. <if test="outCheckConclusion != null">out_check_conclusion = #{outCheckConclusion},</if>
  341. <if test="outReportNo != null">out_report_no = #{outReportNo},</if>
  342. <if test="engineer != null">engineer = #{engineer},</if>
  343. <if test="isRepeat != null">is_repeat = #{isRepeat},</if>
  344. <if test="containerNo != null "> `container_no`= #{containerNo},</if>
  345. <if test="filedSituation != null "> `filed_situation`= #{filedSituation} ,</if>
  346. <if test="internalInspection != null "> `internal_inspection` = #{internalInspection},</if>
  347. <if test="externalInspection != null "> `external_inspection` = #{externalInspection},</if>
  348. <if test="pressureTest != null "> `pressure_test`= #{pressureTest}, </if>
  349. <if test="energyEfficiencyTest != null "> `energy_efficiency_test` = #{energyEfficiencyTest},</if>
  350. <if test="factoryInfo != null "> `factory_info`= #{factoryInfo} ,</if>
  351. <if test="factoryNo != null "> `factory_no` = #{factoryNo},</if>
  352. <if test="medium != null "> `medium` = #{medium},</if>
  353. <if test="designUnit != null "> `design_unit`= #{designUnit} ,</if>
  354. </trim>
  355. where id = #{id}
  356. </update>
  357. <update id="deleteTSpecdevGlById" parameterType="Long">
  358. update t_specdev_gl set del_flag = 2 where id = #{id}
  359. </update>
  360. <update id="deleteTSpecdevGlByIds" parameterType="String">
  361. update t_specdev_gl set del_flag = 2 where id in
  362. <foreach item="id" collection="array" open="(" separator="," close=")">
  363. #{id}
  364. </foreach>
  365. </update>
  366. <update id="duplicateTSpecdevGl" >
  367. UPDATE T_SPECDEV_GL set DEL_FLAG = 2 where id in (select b.id from ( select id from t_specdev_gl a where (a.DEVNO,a.plant_code) in(select DEVNO,plant_code from t_specdev_gl group by DEVNO,plant_code having count(*) > 1)
  368. and id not in (select min(id) from t_specdev_gl group by DEVNO,plant_code having count(*)>1) and a.DEL_FLAG = 0
  369. and a.APPROVE_STATUS = 0 ) AS b )
  370. </update>
  371. </mapper>