cd07d18f1d45a54f6fc25e2956fbffdcf55dbbae.svn-base 21 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539
  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.AttGrwBaseDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.AttGrwBase" id="attGrwBaseResultMap">
  5. <result property="stcd" column="STCD"/>
  6. <result property="dtmmdpr" column="DTMMDPR"/>
  7. <result property="dtmnm" column="DTMNM"/>
  8. <result property="esstym" column="ESSTYM"/>
  9. <result property="lgtdPc" column="LGTD_PC"/>
  10. <result property="isart" column="ISART"/>
  11. <result property="stlc" column="STLC"/>
  12. <result property="welldep" column="WELLDEP"/>
  13. <result property="note" column="NOTE"/>
  14. <result property="lttd" column="LTTD"/>
  15. <result property="aqme" column="AQME"/>
  16. <result property="burcn" column="BURCN"/>
  17. <result property="pbprj" column="PBPRJ"/>
  18. <result property="bwsttp" column="BWSTTP"/>
  19. <result property="stnm" column="STNM"/>
  20. <result property="adcd" column="ADCD"/>
  21. <result property="sttp" column="STTP"/>
  22. <result property="stel" column="STEL"/>
  23. <result property="calym" column="CALYM"/>
  24. <result property="rvnm" column="RVNM"/>
  25. <result property="gogunt" column="GOGUNT"/>
  26. <result property="prtc" column="PRTC"/>
  27. <result property="grdlvl" column="GRDLVL"/>
  28. <result property="adnm" column="ADNM"/>
  29. <result property="lttdPc" column="LTTD_PC"/>
  30. <result property="lgtd" column="LGTD"/>
  31. <result property="wsttp" column="WSTTP"/>
  32. <result property="ostcd" column="OSTCD"/>
  33. <result property="esstyr" column="ESSTYR"/>
  34. <result property="intm" column="INTM"/>
  35. <result property="stndpnt" column="STNDPNT"/>
  36. <result property="mnun" column="MNUN"/>
  37. <result property="onun" column="ONUN"/>
  38. <result property="spghgh" column="SPGHGH"/>
  39. </resultMap>
  40. <sql id="table_columns">
  41. STCD ,
  42. DTMMDPR ,
  43. DTMNM ,
  44. TO_CHAR(ESSTYM,'YYYY-MM-DD') ESSTYM,
  45. LGTD_PC ,
  46. ISART ,
  47. STLC ,
  48. WELLDEP ,
  49. NOTE ,
  50. LTTD ,
  51. AQME ,
  52. BURCN ,
  53. PBPRJ ,
  54. BWSTTP ,
  55. STNM ,
  56. ADCD ,
  57. STTP ,
  58. STEL ,
  59. TO_CHAR(CALYM,'YYYY-MM-DD') CALYM,
  60. RVNM ,
  61. GOGUNT ,
  62. PRTC ,
  63. GRDLVL ,
  64. ADNM ,
  65. LTTD_PC ,
  66. LGTD ,
  67. WSTTP ,
  68. OSTCD ,
  69. ESSTYR ,
  70. TO_CHAR(INTM,'YYYY-MM-DD HH24:MI:SS') INTM,
  71. STNDPNT ,
  72. MNUN ,
  73. ONUN ,
  74. SPGHGH
  75. </sql>
  76. <sql id="table_columns2">
  77. STCD ,
  78. DTMMDPR ,
  79. DTMNM ,
  80. ESSTYM ,
  81. LGTD_PC ,
  82. ISART ,
  83. STLC ,
  84. WELLDEP ,
  85. NOTE ,
  86. LTTD ,
  87. AQME ,
  88. BURCN ,
  89. PBPRJ ,
  90. BWSTTP ,
  91. STNM ,
  92. ADCD ,
  93. STTP ,
  94. STEL ,
  95. CALYM ,
  96. RVNM ,
  97. GOGUNT ,
  98. PRTC ,
  99. GRDLVL ,
  100. ADNM ,
  101. LTTD_PC ,
  102. LGTD ,
  103. WSTTP ,
  104. OSTCD ,
  105. ESSTYR ,
  106. INTM ,
  107. STNDPNT ,
  108. MNUN ,
  109. ONUN ,
  110. SPGHGH
  111. </sql>
  112. <sql id="entity_properties">
  113. #{stcd},
  114. #{dtmmdpr},
  115. #{dtmnm},
  116. TO_DATE(#{esstym},'YYYY-MM-DD'),
  117. #{lgtdPc},
  118. #{isart},
  119. #{stlc},
  120. #{welldep},
  121. #{note},
  122. #{lttd},
  123. #{aqme},
  124. #{burcn},
  125. #{pbprj},
  126. #{bwsttp},
  127. #{stnm},
  128. #{adcd},
  129. #{sttp},
  130. #{stel},
  131. TO_DATE(#{calym},'YYYY-MM-DD'),
  132. #{rvnm},
  133. #{gogunt},
  134. #{prtc},
  135. #{grdlvl},
  136. #{adnm},
  137. #{lttdPc},
  138. #{lgtd},
  139. #{wsttp},
  140. #{ostcd},
  141. #{esstyr},
  142. TO_DATE(#{intm},'YYYY-MM-DD HH24:MI:SS') ,
  143. #{stndpnt},
  144. #{mnun},
  145. #{onun},
  146. #{spghgh}
  147. </sql>
  148. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  149. <sql id="page_where">
  150. <trim prefix="where" prefixOverrides="and | or ">
  151. <if test="stcd != null and stcd != ''">and STCD = #{stcd}</if>
  152. <if test="dtmmdpr != null and dtmmdpr != ''">and DTMMDPR = #{dtmmdpr}</if>
  153. <if test="dtmnm != null and dtmnm != ''">and DTMNM = #{dtmnm}</if>
  154. <if test="esstym != null and esstym != ''">and ESSTYM = TO_DATE(#{esstym},'YYYY-MM-DD')</if>
  155. <if test="lgtdPc != null">and LGTD_PC = #{lgtdPc}</if>
  156. <if test="isart != null and isart != ''">and ISART = #{isart}</if>
  157. <if test="stlc != null and stlc != ''">and STLC = #{stlc}</if>
  158. <if test="welldep != null">and WELLDEP = #{welldep}</if>
  159. <if test="note != null and note != ''">and NOTE = #{note}</if>
  160. <if test="lttd != null">and LTTD = #{lttd}</if>
  161. <if test="aqme != null and aqme != ''">and AQME = #{aqme}</if>
  162. <if test="burcn != null and burcn != ''">and BURCN = #{burcn}</if>
  163. <if test="pbprj != null and pbprj != ''">and PBPRJ = #{pbprj}</if>
  164. <if test="bwsttp != null and bwsttp != ''">and BWSTTP = #{bwsttp}</if>
  165. <if test="stnm != null and stnm != ''">and STNM like '%${stnm}%'</if>
  166. <if test="adcd != null and adcd != ''">and ADCD like '${adcd}%'</if>
  167. <if test="sttp != null and sttp != ''">and STTP = #{sttp}</if>
  168. <if test="stel != null and stel != ''">and STEL = #{stel}</if>
  169. <if test="calym != null and calym != ''">and CALYM = TO_DATE(#{calym},'YYYY-MM-DD')</if>
  170. <if test="rvnm != null and rvnm != ''">and RVNM = #{rvnm}</if>
  171. <if test="gogunt != null and gogunt != ''">and GOGUNT = #{gogunt}</if>
  172. <if test="prtc != null and prtc != ''">and PRTC = #{prtc}</if>
  173. <if test="grdlvl != null">and GRDLVL = #{grdlvl}</if>
  174. <if test="adnm != null and adnm != ''">and ADNM = #{adnm}</if>
  175. <if test="lttdPc != null">and LTTD_PC = #{lttdPc}</if>
  176. <if test="lgtd != null">and LGTD = #{lgtd}</if>
  177. <if test="wsttp != null and wsttp != ''">and WSTTP = #{wsttp}</if>
  178. <if test="ostcd != null and ostcd != ''">and OSTCD = #{ostcd}</if>
  179. <if test="esstyr != null and esstyr != ''">and ESSTYR = #{esstyr}</if>
  180. <if test="intm != null and intm != ''">and INTM = TO_DATE(#{intm},'YYYY-MM-DD HH24:MI:SS')</if>
  181. <if test="stndpnt != null">and STNDPNT = #{stndpnt}</if>
  182. <if test="mnun != null and mnun != ''">and MNUN = #{mnun}</if>
  183. <if test="onun != null and onun != ''">and ONUN = #{onun}</if>
  184. <if test="spghgh != null">and SPGHGH = #{spghgh}</if>
  185. <if test="province != null and province != ''">and ADCD like '${province}%'</if>
  186. </trim>
  187. </sql>
  188. <select id="get" resultMap="attGrwBaseResultMap" parameterType="String" >
  189. select <include refid="table_columns" /> from ATT_GRW_BASE where STCD = #{stcd}
  190. </select>
  191. <select id="getBy" resultMap="attGrwBaseResultMap">
  192. select <include refid="table_columns" /> from ATT_GRW_BASE <include refid="page_where" />
  193. </select>
  194. <select id="findAll" resultMap="attGrwBaseResultMap">
  195. select <include refid="table_columns" /> from ATT_GRW_BASE
  196. </select>
  197. <select id="findList" resultMap="attGrwBaseResultMap">
  198. select <include refid="table_columns" /> from ATT_GRW_BASE <include refid="page_where" /> ORDER BY STCD
  199. </select>
  200. <select id="selectCount" resultType="int" >
  201. select count(STCD) from ATT_GRW_BASE <include refid="page_where" />
  202. </select>
  203. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.AttGrwBase">
  204. insert into ATT_GRW_BASE( <include refid="table_columns2" /> )
  205. values ( <include refid="entity_properties" /> )
  206. </insert>
  207. <delete id="delete" parameterType="java.lang.String">
  208. delete from ATT_GRW_BASE where STCD = #{stcd}
  209. </delete>
  210. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.AttGrwBase">
  211. delete from ATT_GRW_BASE <include refid="page_where" />
  212. </delete>
  213. <update id="deleteInFlag" parameterType="java.lang.String">
  214. update ATT_GRW_BASE set flag_valid = 0 where STCD = #{stcd}
  215. </update>
  216. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.AttGrwBase">
  217. update ATT_GRW_BASE
  218. <trim prefix="set" suffixOverrides=",">
  219. <if test="dtmmdpr != null and dtmmdpr != ''"> DTMMDPR = #{dtmmdpr},</if>
  220. <if test="dtmnm != null and dtmnm != ''"> DTMNM = #{dtmnm},</if>
  221. <if test="esstym != null and esstym != ''"> ESSTYM = TO_DATE(#{esstym},'YYYY-MM-DD'),</if>
  222. <if test="lgtdPc != null"> LGTD_PC = #{lgtdPc},</if>
  223. <if test="isart != null and isart != ''"> ISART = #{isart},</if>
  224. <if test="stlc != null and stlc != ''"> STLC = #{stlc},</if>
  225. <if test="welldep != null"> WELLDEP = #{welldep},</if>
  226. <if test="note != null and note != ''"> NOTE = #{note},</if>
  227. <if test="lttd != null"> LTTD = #{lttd},</if>
  228. <if test="aqme != null and aqme != ''"> AQME = #{aqme},</if>
  229. <if test="burcn != null and burcn != ''"> BURCN = #{burcn},</if>
  230. <if test="pbprj != null and pbprj != ''"> PBPRJ = #{pbprj},</if>
  231. <if test="bwsttp != null and bwsttp != ''"> BWSTTP = #{bwsttp},</if>
  232. <if test="stnm != null and stnm != ''"> STNM = #{stnm},</if>
  233. <if test="adcd != null and adcd != ''"> ADCD = #{adcd},</if>
  234. <if test="sttp != null and sttp != ''"> STTP = #{sttp},</if>
  235. <if test="stel != null and stel != ''"> STEL = #{stel},</if>
  236. <if test="calym != null and calym != ''"> CALYM = TO_DATE(#{calym},'YYYY-MM-DD'),</if>
  237. <if test="rvnm != null and rvnm != ''"> RVNM = #{rvnm},</if>
  238. <if test="gogunt != null and gogunt != ''"> GOGUNT = #{gogunt},</if>
  239. <if test="prtc != null and prtc != ''"> PRTC = #{prtc},</if>
  240. <if test="grdlvl != null"> GRDLVL = #{grdlvl},</if>
  241. <if test="adnm != null and adnm != ''"> ADNM = #{adnm},</if>
  242. <if test="lttdPc != null"> LTTD_PC = #{lttdPc},</if>
  243. <if test="lgtd != null"> LGTD = #{lgtd},</if>
  244. <if test="wsttp != null and wsttp != ''"> WSTTP = #{wsttp},</if>
  245. <if test="ostcd != null and ostcd != ''"> OSTCD = #{ostcd},</if>
  246. <if test="esstyr != null and esstyr != ''"> ESSTYR = #{esstyr},</if>
  247. <if test="intm != null and intm != ''"> INTM = TO_DATE(#{intm},'YYYY-MM-DD HH24:MI:SS'),</if>
  248. <if test="stndpnt != null"> STNDPNT = #{stndpnt},</if>
  249. <if test="mnun != null and mnun != ''"> MNUN = #{mnun},</if>
  250. <if test="onun != null and onun != ''"> ONUN = #{onun},</if>
  251. <if test="spghgh != null"> SPGHGH = #{spghgh},</if>
  252. </trim>
  253. <where>STCD = #{stcd}</where>
  254. </update>
  255. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.AttGrwBase">
  256. update ATT_GRW_BASE
  257. <trim prefix="set" suffixOverrides=",">
  258. <if test="stcd != null and stcd != ''"> STCD = #{stcd},</if>
  259. <if test="dtmmdpr != null and dtmmdpr != ''"> DTMMDPR = #{dtmmdpr},</if>
  260. <if test="dtmnm != null and dtmnm != ''"> DTMNM = #{dtmnm},</if>
  261. <if test="esstym != null and esstym != ''"> ESSTYM = TO_DATE(#{esstym},'YYYY-MM-DD'),</if>
  262. <if test="lgtdPc != null"> LGTD_PC = #{lgtdPc},</if>
  263. <if test="isart != null and isart != ''"> ISART = #{isart},</if>
  264. <if test="stlc != null and stlc != ''"> STLC = #{stlc},</if>
  265. <if test="welldep != null"> WELLDEP = #{welldep},</if>
  266. <if test="note != null and note != ''"> NOTE = #{note},</if>
  267. <if test="lttd != null"> LTTD = #{lttd},</if>
  268. <if test="aqme != null and aqme != ''"> AQME = #{aqme},</if>
  269. <if test="burcn != null and burcn != ''"> BURCN = #{burcn},</if>
  270. <if test="pbprj != null and pbprj != ''"> PBPRJ = #{pbprj},</if>
  271. <if test="bwsttp != null and bwsttp != ''"> BWSTTP = #{bwsttp},</if>
  272. <if test="stnm != null and stnm != ''"> STNM = #{stnm},</if>
  273. <if test="adcd != null and adcd != ''"> ADCD = #{adcd},</if>
  274. <if test="sttp != null and sttp != ''"> STTP = #{sttp},</if>
  275. <if test="stel != null and stel != ''"> STEL = #{stel},</if>
  276. <if test="calym != null and calym != ''"> CALYM = TO_DATE(#{calym},'YYYY-MM-DD'),</if>
  277. <if test="rvnm != null and rvnm != ''"> RVNM = #{rvnm},</if>
  278. <if test="gogunt != null and gogunt != ''"> GOGUNT = #{gogunt},</if>
  279. <if test="prtc != null and prtc != ''"> PRTC = #{prtc},</if>
  280. <if test="grdlvl != null"> GRDLVL = #{grdlvl},</if>
  281. <if test="adnm != null and adnm != ''"> ADNM = #{adnm},</if>
  282. <if test="lttdPc != null"> LTTD_PC = #{lttdPc},</if>
  283. <if test="lgtd != null"> LGTD = #{lgtd},</if>
  284. <if test="wsttp != null and wsttp != ''"> WSTTP = #{wsttp},</if>
  285. <if test="ostcd != null and ostcd != ''"> OSTCD = #{ostcd},</if>
  286. <if test="esstyr != null and esstyr != ''"> ESSTYR = #{esstyr},</if>
  287. <if test="intm != null and intm != ''"> INTM = TO_DATE(#{intm},'YYYY-MM-DD HH24:MI:SS'),</if>
  288. <if test="stndpnt != null"> STNDPNT = #{stndpnt},</if>
  289. <if test="mnun != null and mnun != ''"> MNUN = #{mnun},</if>
  290. <if test="onun != null and onun != ''"> ONUN = #{onun},</if>
  291. <if test="spghgh != null"> SPGHGH = #{spghgh},</if>
  292. </trim>
  293. <include refid="page_where" />
  294. </update>
  295. <!-- 其他自定义SQL -->
  296. <select id="getListBy" parameterType="cn.com.goldenwater.dcproj.param.AttGrwListByParam" resultMap="attGrwBaseResultMap">
  297. select A.STCD ,
  298. A.DTMMDPR ,
  299. A.DTMNM ,
  300. TO_CHAR(A.ESSTYM,'YYYY-MM-DD') ESSTYM,
  301. A.LGTD_PC ,
  302. A.ISART ,
  303. A.STLC ,
  304. A.WELLDEP ,
  305. A.NOTE ,
  306. A.LTTD ,
  307. A.AQME ,
  308. A.BURCN ,
  309. A.PBPRJ ,
  310. A.BWSTTP ,
  311. A.STNM ,
  312. A.ADCD ,
  313. A.STTP ,
  314. A.STEL ,
  315. TO_CHAR(A.CALYM,'YYYY-MM-DD') CALYM,
  316. A.RVNM ,
  317. A.GOGUNT ,
  318. A.PRTC ,
  319. A.GRDLVL ,
  320. A.ADNM ,
  321. A.LTTD_PC ,
  322. A.LGTD ,
  323. A.WSTTP ,
  324. A.OSTCD ,
  325. A.ESSTYR ,
  326. TO_CHAR(A.INTM,'YYYY-MM-DD HH24:MI:SS') INTM,
  327. A.STNDPNT ,
  328. A.MNUN ,
  329. A.ONUN ,
  330. A.SPGHGH
  331. FROM
  332. ATT_GRW_BASE a
  333. LEFT JOIN ( SELECT * FROM BIS_INSP_ALL_OBJ WHERE ID IN (select ID from BIS_INSP_ALL
  334. start with ID IN (SELECT ID FROM BIS_INSP_ALL_RLATION WHERE PERSID = #{persId})
  335. connect by prior ID = PID) AND PTYPE='5') b ON b.CODE = a.STCD
  336. WHERE 1=1
  337. AND b.CODE IS NULL
  338. AND A.ADCD IN ( select DISTINCT C.AD_CODE from BIS_INSP_ALL_RLATION A
  339. LEFT JOIN BIS_INSP_ALL B ON A.ID=B.ID LEFT JOIN BIS_INSP_SEL_AREA C ON C.ID LIKE A.ID||'%'
  340. LEFT JOIN BIS_INSP_ALL_OBJ D ON D.ID LIKE A.ID || '%'
  341. WHERE A.PERSID=#{persId} )
  342. <if test="stnm != null and stnm.length()>0">AND a.STNM like CONCAT('%',CONCAT(#{stnm}, '%'))</if>
  343. <if test="sttp != null and sttp != ''">and (A.STTP Like #{sttp}||'%' OR A.STTP=#{sttp2})</if>
  344. <if test="adnm != null and adnm != ''">and A.ADNM Like '%'||#{adnm}||'%'</if>
  345. <if test="adcd != null and adcd != ''">and A.ADCD Like #{adcd}||'%'</if>
  346. </select>
  347. <!--获取不在某督察组的地下水信息-->
  348. <select id="getGrwNotInGroup" parameterType="cn.com.goldenwater.dcproj.param.InGroupGrwParam" resultType="cn.com.goldenwater.dcproj.model.AttGrwBase">
  349. SELECT STCD,
  350. STNM,
  351. ADCD,
  352. ADNM,
  353. GOGUNT,
  354. STLC,
  355. LGTD,
  356. LTTD,
  357. LGTD_PC,
  358. LTTD_PC,
  359. RVNM,
  360. WELLDEP,
  361. STNDPNT,
  362. GRDLVL,
  363. SPGHGH,
  364. STTP,
  365. WSTTP,
  366. PRTC,
  367. BWSTTP,
  368. ISART,
  369. BURCN,
  370. AQME,
  371. PBPRJ,
  372. ESSTYM,
  373. CALYM,
  374. ONUN,
  375. MNUN,
  376. OSTCD,
  377. INTM,
  378. ESSTYR,
  379. STEL,
  380. DTMNM,
  381. DTMMDPR,
  382. NOTE FROM ATT_GRW_BASE WHERE STCD NOT IN
  383. (SELECT CODE FROM BIS_INSP_ALL_OBJ WHERE ID = #{groupId} AND PTYPE = '5'
  384. <choose>
  385. <when test="province !=null and province !=''">
  386. and ad_code like '${province}%'
  387. </when>
  388. <otherwise>
  389. and ad_code is null
  390. </otherwise>
  391. </choose>
  392. )
  393. <if test="stcd != null and stcd != ''">and STCD = #{stcd}</if>
  394. <if test="stnm != null and stnm != ''">and STNM LIKE '%${stnm}%'</if>
  395. <if test="sttp != null and sttp != ''">and STTP = #{sttp}</if>
  396. <if test="adcd != null and adcd != ''">and ${adcd}</if>
  397. <if test="adnm != null and adnm != ''">and adnm LIKE '%${adnm}%'</if>
  398. <if test="province !=null and province !=''">
  399. and adcd like '${province}%'
  400. </if>
  401. </select>
  402. <select id="getListByInspGroupIdObjType" parameterType="cn.com.goldenwater.dcproj.param.PagePersObjParam" resultType="cn.com.goldenwater.dcproj.model.GrwBaseByType">
  403. select t.*,C.id,C.PNM,o.obj_id
  404. from ATT_GRW_BASE t
  405. left join BIS_INSP_ALL_OBJ o
  406. on o.CODE = t.stcd LEFT JOIN BIS_INSP_ALL C ON o.ID = C.ID
  407. and o.ptype = #{objType}
  408. where 1 = 1
  409. <if test='isAll == "0"'>and o.ID = #{inspGroupId}</if>
  410. <if test='isAll == "1"'>and o.ID LIKE '${inspGroupId}%'</if>
  411. <if test="stnm != null and stnm != ''">and t.stnm LIKE '%${stnm}%'</if>
  412. <if test="sttp != null and sttp != ''">and t.sttp = #{sttp}</if>
  413. <if test="adCode != null and adCode != ''">and t.ADCD LIKE '${adCode}%'</if>
  414. <choose>
  415. <when test="province !=null and province !=''">
  416. and o.ad_code like '${province}%'
  417. </when>
  418. <otherwise>
  419. and o.ad_code is null
  420. </otherwise>
  421. </choose>
  422. </select>
  423. <select id="getObjByPersId" parameterType="cn.com.goldenwater.dcproj.param.PersObjParam" resultType="cn.com.goldenwater.dcproj.model.AttPersGrw">
  424. SELECT A.STCD,
  425. A.STNM,
  426. A.ADCD,
  427. A.ADNM,
  428. A.GOGUNT,
  429. A.STLC,
  430. A.LGTD,
  431. A.LTTD,
  432. A.LGTD_PC,
  433. A.LTTD_PC,
  434. A.RVNM,
  435. A.WELLDEP,
  436. A.STNDPNT,
  437. A.GRDLVL,
  438. A.SPGHGH,
  439. A.STTP,
  440. A.WSTTP,
  441. A.PRTC,
  442. A.BWSTTP,
  443. A.ISART,
  444. A.BURCN,
  445. A.AQME,
  446. A.PBPRJ,
  447. A.ESSTYM,
  448. A.CALYM,
  449. A.ONUN,
  450. A.MNUN,
  451. A.OSTCD,
  452. A.INTM,
  453. A.ESSTYR,
  454. A.STEL,
  455. A.DTMNM,
  456. A.DTMMDPR,B.OBJ_ID,
  457. A.NOTE FROM ATT_GRW_BASE A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.STCD = B.CODE
  458. WHERE B.PTYPE = '5'
  459. AND
  460. REGEXP_LIKE(
  461. B.Id,'^('||
  462. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persGuid}
  463. <include refid="orgIdSql"/>
  464. )>0 then
  465. (SELECT LISTAGG(id, '|') WITHIN GROUP(ORDER BY PERSID) as
  466. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persGuid}
  467. <include refid="orgIdSql"/>
  468. )
  469. else (select 'non' from dual) end)
  470. ||')')
  471. <choose>
  472. <when test="province !=null and province !=''">
  473. and B.ad_code like '${province}%'
  474. </when>
  475. <otherwise>
  476. and B.ad_code is null
  477. </otherwise>
  478. </choose>
  479. <if test="province != null and province != ''">and A.ADCD LIKE '${province}%'</if>
  480. <if test="adCode != null and adCode != ''">and A.ADCD LIKE '${adCode}%'</if>
  481. <if test="stnm != null and stnm != ''">and A.stnm LIKE '%${stnm}%'</if>
  482. <if test="maxLgtd != null and maxLgtd != '' and minLgtd != null and minLgtd != ''">and A.LGTD_PC BETWEEN #{minLgtd} AND #{maxLgtd}</if>
  483. <if test="maxLttd != null and maxLttd != '' and minLttd != null and minLttd != ''">and A.LTTD_PC BETWEEN #{minLttd} AND #{maxLttd}</if>
  484. </select>
  485. <sql id="orgIdSql">
  486. <choose>
  487. <when test="orgId !=null and orgId !=''">
  488. and ORG_ID=#{orgId}
  489. </when>
  490. <otherwise>
  491. and ORG_ID is null
  492. </otherwise>
  493. </choose>
  494. </sql>
  495. <select id="getObjListNotInspGroupId" resultType="cn.com.goldenwater.dcproj.model.AttGrwBase" parameterType="String">
  496. select t.*
  497. from ATT_GRW_BASE t
  498. where t.stcd not in (
  499. select CODE from BIS_INSP_ALL_OBJ B where id like concat(#{inspGroupId},'%') and B.obj_type=#{objType}
  500. <choose>
  501. <when test="province !=null and province !=''">
  502. and B.AD_CODE =#{province}
  503. </when>
  504. <otherwise>
  505. and B.AD_CODE is null
  506. </otherwise>
  507. </choose>
  508. )
  509. <if test="adName != null and adName != ''">and t.nm LIKE '%${adName}%'</if>
  510. <if test="adCode != null and adCode != ''">and t.AD_CODE LIKE '${adCode}%'</if>
  511. </select>
  512. </mapper>