BisInspRssfgdRgstrDao.xml 21 KB

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