BisInspKeysafqhRegisterDao.xml 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570
  1. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
  3. <mapper namespace="cn.com.goldenwater.dcproj.dao.BisInspKeysafqhRegisterDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspKeysafqhRegister" id="bisInspKeysafqhRegisterResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="objId" column="OBJ_ID"/>
  7. <result property="ptype" column="PTYPE"/>
  8. <result property="adCode" column="AD_CODE"/>
  9. <result property="nm" column="NM"/>
  10. <result property="stwktm" column="STWKTM"/>
  11. <result property="plantm" column="PLANTM"/>
  12. <result property="estapp" column="ESTAPP"/>
  13. <result property="lgtd" column="LGTD"/>
  14. <result property="lttd" column="LTTD"/>
  15. <result property="lgtdPc" column="LGTD_PC"/>
  16. <result property="lttdPc" column="LTTD_PC"/>
  17. <result property="unitId" column="UNIT_ID"/>
  18. <result property="unitNm" column="UNIT_NM"/>
  19. <result property="groupLeaderId" column="GROUP_LEADER_ID"/>
  20. <result property="groupLeader" column="GROUP_LEADER"/>
  21. <result property="groupLeaderTel" column="GROUP_LEADER_TEL"/>
  22. <result property="recPersId" column="REC_PERS_ID"/>
  23. <result property="recPers" column="REC_PERS"/>
  24. <result property="recPersTel" column="REC_PERS_TEL"/>
  25. <result property="intm" column="INTM"/>
  26. <result property="uptm" column="UPTM"/>
  27. <result property="note" column="NOTE"/>
  28. <result property="dataStat" column="DATA_STAT"/>
  29. <result property="state" column="STATE"/>
  30. <result property="secStat" column="SEC_STAT"/>
  31. <result property="oneUnitStat" column="ONE_UNIT_STAT"/>
  32. <result property="twoUnitStat" column="TWO_UNIT_STAT"/>
  33. <result property="threeUnitStat" column="THREE_UNIT_STAT"/>
  34. <result property="engSta" column="ENG_STA"/>
  35. <result property="buidTimeYear" column="BUID_TIME_YEAR"/>
  36. <result property="engProfil" column="ENG_PROFIL"/>
  37. <result property="engBuild" column="ENG_BUILD"/>
  38. <result property="orgId" column="ORG_ID"/>
  39. </resultMap>
  40. <sql id="table_columns">
  41. ID,
  42. OBJ_ID,
  43. PTYPE,
  44. AD_CODE,
  45. NM,
  46. STWKTM,
  47. PLANTM,
  48. ESTAPP,
  49. LGTD,
  50. LTTD,
  51. LGTD_PC,
  52. LTTD_PC,
  53. UNIT_ID,
  54. UNIT_NM,
  55. GROUP_LEADER_ID,
  56. GROUP_LEADER,
  57. GROUP_LEADER_TEL,
  58. REC_PERS_ID,
  59. REC_PERS,
  60. REC_PERS_TEL,
  61. INTM,
  62. UPTM,
  63. NOTE,
  64. DATA_STAT,
  65. STATE,
  66. SEC_STAT,
  67. ONE_UNIT_STAT,
  68. TWO_UNIT_STAT,
  69. THREE_UNIT_STAT,
  70. ENG_STA,
  71. BUID_TIME_YEAR,
  72. ENG_PROFIL,
  73. ENG_BUILD,
  74. ORG_ID
  75. </sql>
  76. <sql id="entity_properties">
  77. #{id},
  78. #{objId},
  79. #{ptype},
  80. #{adCode},
  81. #{nm},
  82. #{stwktm},
  83. #{plantm},
  84. #{estapp},
  85. #{lgtd},
  86. #{lttd},
  87. #{lgtdPc},
  88. #{lttdPc},
  89. #{unitId},
  90. #{unitNm},
  91. #{groupLeaderId},
  92. #{groupLeader},
  93. #{groupLeaderTel},
  94. #{recPersId},
  95. #{recPers},
  96. #{recPersTel},
  97. #{intm},
  98. #{uptm},
  99. #{note},
  100. #{dataStat},
  101. #{state},
  102. #{secStat},
  103. #{oneUnitStat},
  104. #{twoUnitStat},
  105. #{threeUnitStat},
  106. #{engSta},
  107. #{buidTimeYear},
  108. #{engProfil},
  109. #{engBuild},
  110. #{orgId}
  111. </sql>
  112. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  113. <sql id="page_where">
  114. <trim prefix="where" prefixOverrides="and | or ">
  115. <if test="objId != null and objId != ''">
  116. and OBJ_ID = #{objId}
  117. </if>
  118. <if test="ptype != null and ptype != ''">
  119. and PTYPE = #{ptype}
  120. </if>
  121. <if test="adCode != null and adCode != ''">
  122. and AD_CODE = #{adCode}
  123. </if>
  124. <if test="nm != null and nm != ''">
  125. and NM = #{nm}
  126. </if>
  127. <if test="stwktm != null and stwktm != ''">
  128. and STWKTM = #{stwktm}
  129. </if>
  130. <if test="plantm != null and plantm != ''">
  131. and PLANTM = #{plantm}
  132. </if>
  133. <if test="estapp != null and estapp != ''">
  134. and ESTAPP = #{estapp}
  135. </if>
  136. <if test="lgtd != null and lgtd != ''">
  137. and LGTD = #{lgtd}
  138. </if>
  139. <if test="lttd != null and lttd != ''">
  140. and LTTD = #{lttd}
  141. </if>
  142. <if test="lgtdPc != null and lgtdPc != ''">
  143. and LGTD_PC = #{lgtdPc}
  144. </if>
  145. <if test="lttdPc != null and lttdPc != ''">
  146. and LTTD_PC = #{lttdPc}
  147. </if>
  148. <if test="unitId != null and unitId != ''">
  149. and UNIT_ID = #{unitId}
  150. </if>
  151. <if test="unitNm != null and unitNm != ''">
  152. and UNIT_NM = #{unitNm}
  153. </if>
  154. <if test="groupLeaderId != null and groupLeaderId != ''">
  155. and GROUP_LEADER_ID = #{groupLeaderId}
  156. </if>
  157. <if test="groupLeader != null and groupLeader != ''">
  158. and GROUP_LEADER = #{groupLeader}
  159. </if>
  160. <if test="groupLeaderTel != null and groupLeaderTel != ''">
  161. and GROUP_LEADER_TEL = #{groupLeaderTel}
  162. </if>
  163. <if test="recPersId != null and recPersId != ''">
  164. and REC_PERS_ID = #{recPersId}
  165. </if>
  166. <if test="recPers != null and recPers != ''">
  167. and REC_PERS = #{recPers}
  168. </if>
  169. <if test="recPersTel != null and recPersTel != ''">
  170. and REC_PERS_TEL = #{recPersTel}
  171. </if>
  172. <if test="intm != null">
  173. and INTM = #{intm}
  174. </if>
  175. <if test="uptm != null">
  176. and UPTM = #{uptm}
  177. </if>
  178. <if test="note != null and note != ''">
  179. and NOTE = #{note}
  180. </if>
  181. <if test="dataStat != null and dataStat != ''">
  182. and DATA_STAT = #{dataStat}
  183. </if>
  184. <if test="state != null and state != ''">
  185. and STATE = #{state}
  186. </if>
  187. <if test="secStat != null and secStat != ''">
  188. and SEC_STAT = #{secStat}
  189. </if>
  190. <if test="oneUnitStat != null and oneUnitStat != ''">
  191. and ONE_UNIT_STAT = #{oneUnitStat}
  192. </if>
  193. <if test="twoUnitStat != null and twoUnitStat != ''">
  194. and TWO_UNIT_STAT = #{twoUnitStat}
  195. </if>
  196. <if test="threeUnitStat != null and threeUnitStat != ''">
  197. and THREE_UNIT_STAT = #{threeUnitStat}
  198. </if>
  199. <if test="engSta != null and engSta != ''">
  200. and ENG_STA = #{engSta}
  201. </if>
  202. <if test="buidTimeYear != null and buidTimeYear != ''">
  203. and BUID_TIME_YEAR = #{buidTimeYear}
  204. </if>
  205. <if test="engProfil != null and engProfil != ''">
  206. and ENG_PROFIL = #{engProfil}
  207. </if>
  208. <if test="engBuild != null and engBuild != ''">
  209. and ENG_BUILD = #{engBuild}
  210. </if>
  211. <if test="orgId != null and orgId != ''">
  212. and ORG_ID = #{orgId}
  213. </if>
  214. and DATA_STAT='0'
  215. </trim>
  216. </sql>
  217. <select id="get" resultMap="bisInspKeysafqhRegisterResultMap" parameterType="String">
  218. select
  219. <include refid="table_columns"/>
  220. from BIS_INSP_KEYSAFQH_REGISTER where ID = #{id}
  221. </select>
  222. <select id="getBy" resultMap="bisInspKeysafqhRegisterResultMap">
  223. select
  224. <include refid="table_columns"/>
  225. from BIS_INSP_KEYSAFQH_REGISTER
  226. <include refid="page_where"/>
  227. </select>
  228. <select id="findAll" resultMap="bisInspKeysafqhRegisterResultMap">
  229. select
  230. <include refid="table_columns"/>
  231. from BIS_INSP_KEYSAFQH_REGISTER
  232. </select>
  233. <select id="findList" resultMap="bisInspKeysafqhRegisterResultMap">
  234. select
  235. <include refid="table_columns"/>
  236. from BIS_INSP_KEYSAFQH_REGISTER
  237. <include refid="page_where"/>
  238. </select>
  239. <select id="selectCount" resultType="int">
  240. select count(ID) from BIS_INSP_KEYSAFQH_REGISTER
  241. <include refid="page_where"/>
  242. </select>
  243. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspKeysafqhRegister">
  244. insert into BIS_INSP_KEYSAFQH_REGISTER(
  245. <include refid="table_columns"/>
  246. )
  247. values (
  248. <include refid="entity_properties"/>
  249. )
  250. </insert>
  251. <delete id="delete" parameterType="java.lang.String">
  252. update BIS_INSP_KEYSAFQH_REGISTER set DATA_STAT='9' where ID = #{id}
  253. </delete>
  254. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspKeysafqhRegister">
  255. update BIS_INSP_KEYSAFQH_REGISTER set DATA_STAT='9'
  256. <include refid="page_where"/>
  257. </delete>
  258. <update id="deleteInFlag" parameterType="java.lang.String">
  259. update BIS_INSP_KEYSAFQH_REGISTER set DATA_STAT = '9' where ID = #{id}
  260. </update>
  261. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspKeysafqhRegister">
  262. update BIS_INSP_KEYSAFQH_REGISTER
  263. <trim prefix="set" suffixOverrides=",">
  264. <if test="objId != null and objId != ''">OBJ_ID
  265. = #{objId},
  266. </if>
  267. <if test="ptype != null and ptype != ''">PTYPE
  268. = #{ptype},
  269. </if>
  270. <if test="adCode != null and adCode != ''">AD_CODE
  271. = #{adCode},
  272. </if>
  273. <if test="nm != null and nm != ''">NM
  274. = #{nm},
  275. </if>
  276. <if test="stwktm != null and stwktm != ''">STWKTM
  277. = #{stwktm},
  278. </if>
  279. <if test="plantm != null and plantm != ''">PLANTM
  280. = #{plantm},
  281. </if>
  282. <if test="estapp != null and estapp != ''">ESTAPP
  283. = #{estapp},
  284. </if>
  285. <if test="lgtd != null and lgtd != ''">LGTD
  286. = #{lgtd},
  287. </if>
  288. <if test="lttd != null and lttd != ''">LTTD
  289. = #{lttd},
  290. </if>
  291. <if test="lgtdPc != null and lgtdPc != ''">LGTD_PC
  292. = #{lgtdPc},
  293. </if>
  294. <if test="lttdPc != null and lttdPc != ''">LTTD_PC
  295. = #{lttdPc},
  296. </if>
  297. <if test="unitId != null and unitId != ''">UNIT_ID
  298. = #{unitId},
  299. </if>
  300. <if test="unitNm != null and unitNm != ''">UNIT_NM
  301. = #{unitNm},
  302. </if>
  303. <if test="groupLeaderId != null and groupLeaderId != ''">GROUP_LEADER_ID
  304. = #{groupLeaderId},
  305. </if>
  306. <if test="groupLeader != null and groupLeader != ''">GROUP_LEADER
  307. = #{groupLeader},
  308. </if>
  309. <if test="groupLeaderTel != null and groupLeaderTel != ''">GROUP_LEADER_TEL
  310. = #{groupLeaderTel},
  311. </if>
  312. <if test="recPersId != null and recPersId != ''">REC_PERS_ID
  313. = #{recPersId},
  314. </if>
  315. <if test="recPers != null and recPers != ''">REC_PERS
  316. = #{recPers},
  317. </if>
  318. <if test="recPersTel != null and recPersTel != ''">REC_PERS_TEL
  319. = #{recPersTel},
  320. </if>
  321. <if test="intm != null">INTM
  322. = #{intm},
  323. </if>
  324. <if test="uptm != null">UPTM
  325. = #{uptm},
  326. </if>
  327. <if test="note != null and note != ''">NOTE
  328. = #{note},
  329. </if>
  330. <if test="dataStat != null and dataStat != ''">DATA_STAT
  331. = #{dataStat},
  332. </if>
  333. <if test="state != null and state != ''">STATE
  334. = #{state},
  335. </if>
  336. <if test="secStat != null and secStat != ''">SEC_STAT
  337. = #{secStat},
  338. </if>
  339. <if test="oneUnitStat != null and oneUnitStat != ''">ONE_UNIT_STAT
  340. = #{oneUnitStat},
  341. </if>
  342. <if test="twoUnitStat != null and twoUnitStat != ''">TWO_UNIT_STAT
  343. = #{twoUnitStat},
  344. </if>
  345. <if test="threeUnitStat != null and threeUnitStat != ''">THREE_UNIT_STAT
  346. = #{threeUnitStat},
  347. </if>
  348. <if test="engSta != null and engSta != ''">ENG_STA
  349. = #{engSta},
  350. </if>
  351. <if test="buidTimeYear != null and buidTimeYear != ''">BUID_TIME_YEAR
  352. = #{buidTimeYear},
  353. </if>
  354. <if test="engProfil != null and engProfil != ''">ENG_PROFIL
  355. = #{engProfil},
  356. </if>
  357. <if test="engBuild != null and engBuild != ''">ENG_BUILD
  358. = #{engBuild},
  359. </if>
  360. <if test="orgId != null and orgId != ''">ORG_ID
  361. = #{orgId},
  362. </if>
  363. </trim>
  364. <where>ID = #{id}</where>
  365. </update>
  366. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspKeysafqhRegister">
  367. update BIS_INSP_KEYSAFQH_REGISTER
  368. <trim prefix="set" suffixOverrides=",">
  369. <if test="objId != null and objId != ''">OBJ_ID
  370. = #{objId},
  371. </if>
  372. <if test="ptype != null and ptype != ''">PTYPE
  373. = #{ptype},
  374. </if>
  375. <if test="adCode != null and adCode != ''">AD_CODE
  376. = #{adCode},
  377. </if>
  378. <if test="nm != null and nm != ''">NM
  379. = #{nm},
  380. </if>
  381. <if test="stwktm != null and stwktm != ''">STWKTM
  382. = #{stwktm},
  383. </if>
  384. <if test="plantm != null and plantm != ''">PLANTM
  385. = #{plantm},
  386. </if>
  387. <if test="estapp != null and estapp != ''">ESTAPP
  388. = #{estapp},
  389. </if>
  390. <if test="lgtd != null and lgtd != ''">LGTD
  391. = #{lgtd},
  392. </if>
  393. <if test="lttd != null and lttd != ''">LTTD
  394. = #{lttd},
  395. </if>
  396. <if test="lgtdPc != null and lgtdPc != ''">LGTD_PC
  397. = #{lgtdPc},
  398. </if>
  399. <if test="lttdPc != null and lttdPc != ''">LTTD_PC
  400. = #{lttdPc},
  401. </if>
  402. <if test="unitId != null and unitId != ''">UNIT_ID
  403. = #{unitId},
  404. </if>
  405. <if test="unitNm != null and unitNm != ''">UNIT_NM
  406. = #{unitNm},
  407. </if>
  408. <if test="groupLeaderId != null and groupLeaderId != ''">GROUP_LEADER_ID
  409. = #{groupLeaderId},
  410. </if>
  411. <if test="groupLeader != null and groupLeader != ''">GROUP_LEADER
  412. = #{groupLeader},
  413. </if>
  414. <if test="groupLeaderTel != null and groupLeaderTel != ''">GROUP_LEADER_TEL
  415. = #{groupLeaderTel},
  416. </if>
  417. <if test="recPersId != null and recPersId != ''">REC_PERS_ID
  418. = #{recPersId},
  419. </if>
  420. <if test="recPers != null and recPers != ''">REC_PERS
  421. = #{recPers},
  422. </if>
  423. <if test="recPersTel != null and recPersTel != ''">REC_PERS_TEL
  424. = #{recPersTel},
  425. </if>
  426. <if test="intm != null">INTM
  427. = #{intm},
  428. </if>
  429. <if test="uptm != null">UPTM
  430. = #{uptm},
  431. </if>
  432. <if test="note != null and note != ''">NOTE
  433. = #{note},
  434. </if>
  435. <if test="dataStat != null and dataStat != ''">DATA_STAT
  436. = #{dataStat},
  437. </if>
  438. <if test="state != null and state != ''">STATE
  439. = #{state},
  440. </if>
  441. <if test="secStat != null and secStat != ''">SEC_STAT
  442. = #{secStat},
  443. </if>
  444. <if test="oneUnitStat != null and oneUnitStat != ''">ONE_UNIT_STAT
  445. = #{oneUnitStat},
  446. </if>
  447. <if test="twoUnitStat != null and twoUnitStat != ''">TWO_UNIT_STAT
  448. = #{twoUnitStat},
  449. </if>
  450. <if test="threeUnitStat != null and threeUnitStat != ''">THREE_UNIT_STAT
  451. = #{threeUnitStat},
  452. </if>
  453. <if test="engSta != null and engSta != ''">ENG_STA
  454. = #{engSta},
  455. </if>
  456. <if test="buidTimeYear != null and buidTimeYear != ''">BUID_TIME_YEAR
  457. = #{buidTimeYear},
  458. </if>
  459. <if test="engProfil != null and engProfil != ''">ENG_PROFIL
  460. = #{engProfil},
  461. </if>
  462. <if test="engBuild != null and engBuild != ''">ENG_BUILD
  463. = #{engBuild},
  464. </if>
  465. <if test="orgId != null and orgId != ''">ORG_ID
  466. = #{orgId},
  467. </if>
  468. </trim>
  469. <include refid="page_where"/>
  470. </update>
  471. <!-- 其他自定义SQL -->
  472. <select id="findPageList" resultType="cn.com.goldenwater.dcproj.dto.BisInspKeysafqhRegisterDto">
  473. SELECT * FROM (
  474. select
  475. A.CODE, A.ID nodeId, A.ptype AS OBJ_TYPE, ia.pnm groupName,
  476. B.id as rgstrId, (case when b.STATE is null then '0' else b.state end) STATE,
  477. B.ID,
  478. B.OBJ_ID,
  479. B.PTYPE,
  480. B.AD_CODE,
  481. B.NM,
  482. B.STWKTM,
  483. B.PLANTM,
  484. B.ESTAPP,
  485. B.LGTD,
  486. B.LTTD,
  487. B.LGTD_PC,
  488. B.LTTD_PC,
  489. B.UNIT_ID,
  490. B.UNIT_NM,
  491. B.GROUP_LEADER_ID,
  492. B.GROUP_LEADER,
  493. B.GROUP_LEADER_TEL,
  494. B.REC_PERS_ID,
  495. B.REC_PERS,
  496. B.REC_PERS_TEL,
  497. B.INTM,
  498. B.UPTM,
  499. B.NOTE,
  500. B.DATA_STAT,
  501. B.SEC_STAT,
  502. B.ONE_UNIT_STAT,
  503. B.TWO_UNIT_STAT,
  504. B.THREE_UNIT_STAT,
  505. B.ENG_STA,
  506. B.BUID_TIME_YEAR,
  507. B.ENG_PROFIL,
  508. B.ENG_BUILD,
  509. B.ORG_ID
  510. FROM BIS_INSP_ALL_OBJ A
  511. JOIN BIS_INSP_KEYSAFQH_REGISTER B ON A.OBJ_ID=B.OBJ_ID
  512. LEFT JOIN BIS_INSP_ALL IA ON A.ID = IA.ID
  513. where A.ptype= #{pType}
  514. <if test="adCodes ==null or adCodes ==''">
  515. <choose>
  516. <when test='isAll =="1"'>
  517. </when>
  518. <otherwise>
  519. <if test="groupIds != null and groupIds.length &gt; 0">
  520. <foreach collection="groupIds" index="index" item="gId" separator=" OR " open="and (" close=")">
  521. A.id like '${gId}%'
  522. </foreach>
  523. </if>
  524. </otherwise>
  525. </choose>
  526. </if>
  527. <if test="adCodes !=null and adCodes !=''">
  528. and
  529. <foreach item="item" index="index" collection="adCodes.split(',')" open="(" separator="or" close=")">
  530. b.ad_code like concat('${item}','%')
  531. </foreach>
  532. </if>
  533. ) A
  534. <where>
  535. <if test="id !=null and id !=''">and nodeId like '${id}%'</if>
  536. <if test="plnaId !=null and plnaId !=''">and nodeId like '${plnaId}%'</if>
  537. <if test="groupId != null and groupId != ''">and nodeId like '${groupId}%'</if>
  538. <if test="code !=null and code !=''">and code = #{code}</if>
  539. <if test="nm !=null and nm !=''">and nm like '%${nm}%'</if>
  540. <if test="name !=null and name !=''">and nm like '%${name}%'</if>
  541. <if test="state !=null and state !=''">and STATE in (${state})</if>
  542. <if test="adName != null and adName != ''">and AD_NAME like '%${adName}%'</if>
  543. <if test="sttm != null and sttm != ''">and Intm &gt;= STR_TO_DATE(#{sttm},'%Y-%m-%d')</if>
  544. <if test="entm != null and entm != ''">and Intm &lt; DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') ,INTERVAL 1 DAY)</if>
  545. </where>
  546. order by nodeId asc
  547. <if test="orderBy != null and orderBy != ''">
  548. ,CONVERT( nm USING gbk ) COLLATE gbk_chinese_ci ASC
  549. </if>
  550. </select>
  551. </mapper>