BisInspWiuqhRgstrDao.xml 19 KB

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