BisInspObjDao.xml 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729
  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.BisInspObjDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspObj" id="bisInspObjResultMap">
  5. <result property="objId" column="OBJ_ID"/>
  6. <result property="objType" column="OBJ_TYPE"/>
  7. <result property="inspGroupId" column="INSP_GROUP_ID"/>
  8. <result property="plnaId" column="PLNA_ID"/>
  9. <result property="objName" column="OBJ_NAME"/>
  10. <result property="guid" column="GUID"/>
  11. </resultMap>
  12. <sql id="table_columns">
  13. OBJ_ID,
  14. OBJ_TYPE,
  15. INSP_GROUP_ID,
  16. PLNA_ID,
  17. GUID
  18. </sql>
  19. <sql id="entity_properties">
  20. #{objId},
  21. #{objType},
  22. #{inspGroupId},
  23. #{plnaId},
  24. #{guid}
  25. </sql>
  26. <sql id="table_columnsNew">
  27. OBJ_ID,
  28. CODE,
  29. ID,
  30. NM,
  31. ptype,
  32. lgtd,
  33. lttd
  34. </sql>
  35. <sql id="entity_propertiesNew">
  36. #{objId},
  37. #{objType},
  38. #{inspGroupId},
  39. #{plnaId},
  40. #{guid}
  41. </sql>
  42. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  43. <sql id="page_where">
  44. <trim prefix="where" prefixOverrides="and | or ">
  45. <if test="objType != null and objType != ''">and OBJ_TYPE = #{objType}</if>
  46. <if test="inspGroupId != null and inspGroupId != ''">and INSP_GROUP_ID = #{inspGroupId}</if>
  47. <if test="guid != null and guid != ''">and GUID = #{guid}</if>
  48. <if test="plnaId != null and plnaId != ''">and PLNA_ID = #{plnaId}</if>
  49. </trim>
  50. </sql>
  51. <select id="get" resultMap="bisInspObjResultMap" parameterType="String">
  52. select
  53. <include refid="table_columns"/>
  54. from bis_insp_obj where OBJ_ID = #{id}
  55. </select>
  56. <select id="getBy" resultMap="bisInspObjResultMap">
  57. select
  58. <include refid="table_columns"/>
  59. from bis_insp_obj
  60. <include refid="page_where"/>
  61. </select>
  62. <select id="findAll" resultMap="bisInspObjResultMap">
  63. select
  64. <include refid="table_columns"/>
  65. from bis_insp_obj
  66. </select>
  67. <select id="findList" resultMap="bisInspObjResultMap">
  68. select
  69. <include refid="table_columns"/>
  70. from bis_insp_obj
  71. <include refid="page_where"/>
  72. </select>
  73. <select id="selectCount" resultType="int">
  74. select count(ID) from bis_insp_obj
  75. <include refid="page_where"/>
  76. </select>
  77. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspObj">
  78. insert into bis_insp_obj(
  79. <include refid="table_columns"/>
  80. )
  81. values (
  82. <include refid="entity_properties"/>
  83. )
  84. </insert>
  85. <delete id="delete" parameterType="java.lang.String">
  86. delete from bis_insp_obj where ID = #{id}
  87. </delete>
  88. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspObj">
  89. delete from bis_insp_obj
  90. <include refid="page_where"/>
  91. </delete>
  92. <update id="deleteInFlag" parameterType="java.lang.String">
  93. update bis_insp_obj set flag_valid = 0 where OBJ_ID = #{id}
  94. </update>
  95. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspObj">
  96. update bis_insp_obj
  97. <trim prefix="set" suffixOverrides=",">
  98. <if test="objType != null and objType != ''">OBJ_TYPE = #{objType},</if>
  99. <if test="inspGroupId != null and inspGroupId != ''">INSP_GROUP_ID = #{inspGroupId},</if>
  100. <if test="guid != null and guid != ''">GUID = #{guid},</if>
  101. <if test="plnaId != null and plnaId != ''">PLNA_ID = #{plnaId},</if>
  102. </trim>
  103. <where>OBJ_ID = #{objId}</where>
  104. </update>
  105. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspObj">
  106. update bis_insp_obj
  107. <trim prefix="set" suffixOverrides=",">
  108. <if test="objType != null and objType != ''">OBJ_TYPE = #{objType},</if>
  109. <if test="inspGroupId != null and inspGroupId != ''">INSP_GROUP_ID = #{inspGroupId},</if>
  110. <if test="guid != null and guid != ''">GUID = #{guid},</if>
  111. <if test="plnaId != null and plnaId != ''">PLNA_ID = #{plnaId},</if>
  112. </trim>
  113. <include refid="page_where"/>
  114. </update>
  115. <!-- 其他自定义SQL -->
  116. <delete id="deleteInspObj">
  117. DELETE FROM BIS_INSP_OBJ WHERE OBJ_ID = #{objId} AND OBJ_TYPE = #{objType} AND INSP_GROUP_ID = #{inspGroupId}
  118. </delete>
  119. <select id="findListByGroupIdAndPlanId" resultMap="bisInspObjResultMap">
  120. select t1.obj_id,t1.obj_type,
  121. CASE WHEN t1.obj_type='1' THEN t4.rsvr_nm
  122. WHEN t1.OBJ_TYPE='2' THEN t5.regs_nm
  123. WHEN t1.OBJ_TYPE='3' THEN t2.obj_nm
  124. WHEN t1.OBJ_TYPE='4' THEN t3.group_leader
  125. END AS OBJ_NAME
  126. from BIS_INSP_OBJ t1
  127. left join BIS_INSP_WTDST_TRACK t2 on t1.OBJ_ID= t2.obj_id and t1.obj_type=3
  128. left join BIS_INSP_KEY_REGISTER t3 on t1.OBJ_ID= t3.obj_id and t1.obj_type=4
  129. left join BIS_INSP_RSVR_RGSTR t4 on t1.OBJ_ID= t4.obj_id and t1.obj_type=1
  130. left join BIS_INSP_VILL_RGSTR t5 on t1.OBJ_ID= t5.obj_id and t1.obj_type=2
  131. where t1.insp_group_id= #{inspGroupId} and t1.plna_id= #{plnaId}
  132. </select>
  133. <select id="getPersByOrg" resultType="String">
  134. SELECT GUID FROM BIS_INSP_ALL_RLATION_PERS WHERE ORG_ID = #{orgId}
  135. </select>
  136. <delete id="deleteAll" parameterType="String">
  137. DELETE FROM BIS_INSP_ALL_OBJ WHERE ID LIKE '${id}%'
  138. </delete>
  139. <!--根据节点获取obj_id-->
  140. <select id="getObjIdList" resultType="cn.com.goldenwater.dcproj.dto.VillRgstrEngIdDto">
  141. SELECT OBJ_ID FROM BIS_INSP_ALL_OBJ WHERE ID LIKE '${id}%'
  142. </select>
  143. <!--根据obj_id删除问题表-->
  144. <delete id="deleteAllPblm">
  145. DELETE FROM BIS_INSP_PBLM WHERE OBJ_ID = #{s}
  146. </delete>
  147. <select id="getBisInspSelAreaList" resultType="cn.com.goldenwater.dcproj.model.BisInspSelArea">
  148. SELECT * FROM BIS_INSP_SEL_AREA WHERE ID = #{inspGroupId}
  149. </select>
  150. <sql id="choseSql">
  151. <choose>
  152. <when test="province !=null and province !=''">
  153. and B.AD_CODE LIKE CONCAT(#{province}, '%')
  154. </when>
  155. <otherwise>
  156. and B.AD_CODE is null
  157. </otherwise>
  158. </choose>
  159. </sql>
  160. <select id="getKeySwhsObjByPersId" resultType="cn.com.goldenwater.dcproj.dto.BisInspObjDto"
  161. parameterType="cn.com.goldenwater.dcproj.param.PersObjParam">
  162. SELECT A.ID AS CODE,A.SWHS_CODE AS OBJCODE,A.SWHS_NAME AS NM,
  163. A.WAIN_WASO_TYPE AS TYPE,
  164. A.SWHS_LONG AS CENTERX,
  165. A.SWHS_LAT AS CENTERY,
  166. A.SWHS_LONG_GD AS LGTD,
  167. A.SWHS_LAT_GD AS LTTD,
  168. A.SWHS_LOC AS LOCATION,
  169. A.NOTE,
  170. A.AD_CODE,
  171. B.OBJ_ID,
  172. R.STATE,
  173. R.ID AS RGSTRID
  174. FROM ATT_SWHS_BASE A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.ID = B.CODE
  175. LEFT JOIN BIS_INSP_SWHS_RGSTR R ON B.OBJ_ID = R.OBJ_ID
  176. WHERE 1 = 1 AND B.PTYPE = #{objType}
  177. <include refid="choseSql"/>
  178. AND
  179. REGEXP_LIKE(
  180. B.Id,'^('||
  181. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  182. <include refid="orgIdSql"/>
  183. )>0 then
  184. (SELECT LISTAGG(id, '|') as
  185. id FROM BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  186. <include refid="orgIdSql"/> GROUP BY PERSID
  187. )
  188. else (select 'non' from dual) end)
  189. ||')')
  190. <if test="adCode != null and adCode != ''">and A.AD_CODE LIKE '${adCode}%'</if>
  191. <if test="maxLgtd != null and maxLgtd != '' and minLgtd != null and minLgtd != ''">and A.SWHS_LONG BETWEEN
  192. #{minLgtd} AND #{maxLgtd}
  193. </if>
  194. <if test="maxLttd != null and maxLttd != '' and minLttd != null and minLttd != ''">and A.SWHS_LAT BETWEEN
  195. #{minLttd} AND #{maxLttd}
  196. </if>
  197. <if test="maxcenterXGd != null and maxcenterXGd != '' and mincenterXGd != null and mincenterXGd != ''">and
  198. A.SWHS_LONG_GD BETWEEN #{mincenterXGd} AND #{maxcenterXGd}
  199. </if>
  200. <if test="maxcenterYGd != null and maxcenterYGd != '' and mincenterYGd != null and mincenterYGd != ''">and
  201. A.SWHS_LAT_GD BETWEEN #{mincenterYGd} AND #{maxcenterYGd}
  202. </if>
  203. </select>
  204. <select id="getWiuObjByPersId" resultType="cn.com.goldenwater.dcproj.dto.BisInspObjDto"
  205. parameterType="cn.com.goldenwater.dcproj.param.PersObjParam">
  206. SELECT A.ID AS CODE,A.WIU_CODE AS OBJCODE,A.WIU_NAME AS NM,A.WINT_CODE as wintCode,
  207. A.WIU_LONG AS CENTERX,
  208. A.WIU_LAT AS CENTERY,
  209. A.GD_X AS LGTD,
  210. A.GD_Y AS LTTD,
  211. R.WIU_LOC AS LOCATION,
  212. R.AD_CODE,
  213. B.OBJ_ID,
  214. R.STATE,
  215. R.ID AS RGSTRID
  216. FROM ATT_WIU_BASE A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.ID = B.CODE
  217. LEFT JOIN BIS_INSP_WIU_RGSTR R ON B.OBJ_ID = R.OBJ_ID
  218. WHERE 1 = 1 AND B.PTYPE = #{objType}
  219. <include refid="choseSql"/>
  220. AND
  221. REGEXP_LIKE(
  222. B.Id,'^('||
  223. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  224. <include refid="orgIdSql"/>
  225. )>0 then
  226. (SELECT LISTAGG(id, '|') as
  227. id FROM BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  228. <include refid="orgIdSql"/> GROUP BY PERSID
  229. )
  230. else (select 'non' from dual) end)
  231. ||')')
  232. <if test="adCode != null and adCode != ''">and R.AD_CODE LIKE '${adCode}%'</if>
  233. <if test="maxLgtd != null and maxLgtd != '' and minLgtd != null and minLgtd != ''">and A.WIU_LONG BETWEEN
  234. #{minLgtd} AND #{maxLgtd}
  235. </if>
  236. <if test="maxLttd != null and maxLttd != '' and minLttd != null and minLttd != ''">and A.WIU_LAT BETWEEN
  237. #{minLttd} AND #{maxLttd}
  238. </if>
  239. <if test="maxcenterXGd != null and maxcenterXGd != '' and mincenterXGd != null and mincenterXGd != ''">and
  240. A.GD_X BETWEEN #{mincenterXGd} AND #{maxcenterXGd}
  241. </if>
  242. <if test="maxcenterYGd != null and maxcenterYGd != '' and mincenterYGd != null and mincenterYGd != ''">and
  243. A.GD_Y BETWEEN #{mincenterYGd} AND #{maxcenterYGd}
  244. </if>
  245. </select>
  246. <select id="getWintObjByPersId" resultType="cn.com.goldenwater.dcproj.dto.BisInspObjDto"
  247. parameterType="cn.com.goldenwater.dcproj.param.PersObjParam">
  248. SELECT A.ID AS CODE,A.WINT_CODE AS OBJCODE,A.WINT_NAME AS NM,
  249. A.WAIN_LONG AS CENTERX,
  250. A.WAIN_LAT AS CENTERY,
  251. A.GD_X AS LGTD,
  252. A.GD_Y AS LTTD,
  253. A.WINT_POS AS LOCATION,
  254. A.AD_CODE,
  255. A.WAIN_TYPE as type
  256. FROM ATT_WINT_BASE_B A
  257. WHERE 1 = 1
  258. <if test="rsName != null and rsName != ''">and A.WINT_NAME like '%${rsName}%'</if>
  259. <if test="adCode != null and adCode != ''">and A.AD_CODE LIKE '${adCode}%'</if>
  260. <if test="maxLgtd != null and maxLgtd != '' and minLgtd != null and minLgtd != ''">and A.WAIN_LONG BETWEEN
  261. #{minLgtd} AND #{maxLgtd}
  262. </if>
  263. <if test="maxLttd != null and maxLttd != '' and minLttd != null and minLttd != ''">and A.WAIN_LAT BETWEEN
  264. #{minLttd} AND #{maxLttd}
  265. </if>
  266. <if test="maxcenterXGd != null and maxcenterXGd != '' and mincenterXGd != null and mincenterXGd != ''">and
  267. A.GD_X BETWEEN #{mincenterXGd} AND #{maxcenterXGd}
  268. </if>
  269. <if test="maxcenterYGd != null and maxcenterYGd != '' and mincenterYGd != null and mincenterYGd != ''">and
  270. A.GD_Y BETWEEN #{mincenterYGd} AND #{maxcenterYGd}
  271. </if>
  272. </select>
  273. <select id="getJSWAObjByPersId" resultType="cn.com.goldenwater.dcproj.dto.BisInspObjDto"
  274. parameterType="cn.com.goldenwater.dcproj.param.PersObjParam">
  275. SELECT A.id as code,A.name AS NM,
  276. A.CENTER_X AS CENTERX,
  277. A.CENTER_Y AS CENTERY,
  278. A.GD_X AS LGTD,
  279. A.GD_Y AS LTTD,
  280. R.LOCATION ,
  281. R.AD_CODE,
  282. B.OBJ_ID,
  283. R.STATE,
  284. R.ID AS RGSTRID
  285. FROM ATT_JSKEJIAN_WATER_BASE A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.id = B.CODE
  286. LEFT JOIN ATT_JSKEJIAN_WATER_RGSTR R ON B.OBJ_ID = R.OBJ_ID
  287. WHERE 1 = 1 AND B.PTYPE = #{objType}
  288. <include refid="choseSql"/>
  289. AND
  290. REGEXP_LIKE(
  291. B.Id,'^('||
  292. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  293. <include refid="orgIdSql"/>
  294. )>0 then
  295. (SELECT LISTAGG(id, '|') as
  296. id FROM BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  297. <include refid="orgIdSql"/> GROUP BY PERSID
  298. )
  299. else (select 'non' from dual) end)
  300. ||')')
  301. <if test="adCode != null and adCode != ''">and R.AD_CODE LIKE '${adCode}%'</if>
  302. <if test="maxLgtd != null and maxLgtd != '' and minLgtd != null and minLgtd != ''">and A.CENTER_X BETWEEN
  303. #{minLgtd} AND #{maxLgtd}
  304. </if>
  305. <if test="maxLttd != null and maxLttd != '' and minLttd != null and minLttd != ''">and A.CENTER_Y BETWEEN
  306. #{minLttd} AND #{maxLttd}
  307. </if>
  308. <if test="maxcenterXGd != null and maxcenterXGd != '' and mincenterXGd != null and mincenterXGd != ''">and
  309. A.GD_X BETWEEN #{mincenterXGd} AND #{maxcenterXGd}
  310. </if>
  311. <if test="maxcenterYGd != null and maxcenterYGd != '' and mincenterYGd != null and mincenterYGd != ''">and
  312. A.GD_Y BETWEEN #{mincenterYGd} AND #{maxcenterYGd}
  313. </if>
  314. </select>
  315. <select id="getJSFLObjByPersId" resultType="cn.com.goldenwater.dcproj.dto.BisInspObjDto"
  316. parameterType="cn.com.goldenwater.dcproj.param.PersObjParam">
  317. SELECT A.id as code,A.name AS NM,
  318. A.CENTER_X AS CENTERX,
  319. A.CENTER_Y AS CENTERY,
  320. A.GD_X AS LGTD,
  321. A.GD_Y AS LTTD,
  322. R.LOCATION ,
  323. R.AD_CODE,
  324. B.OBJ_ID,
  325. R.STATE,
  326. R.ID AS RGSTRID
  327. FROM ATT_JSKEJIAN_FLKDIS_BASE A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.id = B.CODE
  328. LEFT JOIN ATT_JSKEJIAN_FLKDIS_RGSTR R ON B.OBJ_ID = R.OBJ_ID
  329. WHERE 1 = 1 AND B.PTYPE = #{objType}
  330. <include refid="choseSql"/>
  331. AND
  332. REGEXP_LIKE(
  333. B.Id,'^('||
  334. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  335. <include refid="orgIdSql"/>
  336. )>0 then
  337. (SELECT LISTAGG(id, '|') as
  338. id FROM BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  339. <include refid="orgIdSql"/> GROUP BY PERSID
  340. )
  341. else (select 'non' from dual) end)
  342. ||')')
  343. <if test="adCode != null and adCode != ''">and R.AD_CODE LIKE '${adCode}%'</if>
  344. <if test="maxLgtd != null and maxLgtd != '' and minLgtd != null and minLgtd != ''">and A.CENTER_X BETWEEN
  345. #{minLgtd} AND #{maxLgtd}
  346. </if>
  347. <if test="maxLttd != null and maxLttd != '' and minLttd != null and minLttd != ''">and A.CENTER_Y BETWEEN
  348. #{minLttd} AND #{maxLttd}
  349. </if>
  350. <if test="maxcenterXGd != null and maxcenterXGd != '' and mincenterXGd != null and mincenterXGd != ''">and
  351. A.GD_X BETWEEN #{mincenterXGd} AND #{maxcenterXGd}
  352. </if>
  353. <if test="maxcenterYGd != null and maxcenterYGd != '' and mincenterYGd != null and mincenterYGd != ''">and
  354. A.GD_Y BETWEEN #{mincenterYGd} AND #{maxcenterYGd}
  355. </if>
  356. </select>
  357. <select id="getPrdObjByPersId" resultType="cn.com.goldenwater.dcproj.dto.BisInspObjDto"
  358. parameterType="cn.com.goldenwater.dcproj.param.PersObjParam">
  359. SELECT A.id as code,A.code AS OBJCODE,A.name AS NM,
  360. A.CENTER_X AS CENTERX,
  361. A.CENTER_Y AS CENTERY,
  362. A.GD_X AS LGTD,
  363. A.GD_Y AS LTTD,
  364. R.LOCATION ,
  365. R.AD_CODE,
  366. B.OBJ_ID,
  367. R.STATE,
  368. R.ID AS RGSTRID
  369. FROM ATT_PRD_CSTR_PROJ_BASE A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.id = B.CODE
  370. LEFT JOIN BIS_INSP_OPRD_CSTR_PROJ_RGSTR R ON B.OBJ_ID = R.OBJ_ID
  371. WHERE 1 = 1 AND B.PTYPE = #{objType}
  372. <include refid="choseSql"/>
  373. AND
  374. REGEXP_LIKE(
  375. B.Id,'^('||
  376. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  377. <include refid="orgIdSql"/>
  378. )>0 then
  379. (SELECT LISTAGG(id, '|') as
  380. id FROM BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  381. <include refid="orgIdSql"/> GROUP BY PERSID
  382. )
  383. else (select 'non' from dual) end)
  384. ||')')
  385. <if test="adCode != null and adCode != ''">and R.AD_CODE LIKE '${adCode}%'</if>
  386. <if test="maxLgtd != null and maxLgtd != '' and minLgtd != null and minLgtd != ''">and A.CENTER_X BETWEEN
  387. #{minLgtd} AND #{maxLgtd}
  388. </if>
  389. <if test="maxLttd != null and maxLttd != '' and minLttd != null and minLttd != ''">and A.CENTER_Y BETWEEN
  390. #{minLttd} AND #{maxLttd}
  391. </if>
  392. <if test="maxcenterXGd != null and maxcenterXGd != '' and mincenterXGd != null and mincenterXGd != ''">and
  393. A.GD_X BETWEEN #{mincenterXGd} AND #{maxcenterXGd}
  394. </if>
  395. <if test="maxcenterYGd != null and maxcenterYGd != '' and mincenterYGd != null and mincenterYGd != ''">and
  396. A.GD_Y BETWEEN #{mincenterYGd} AND #{maxcenterYGd}
  397. </if>
  398. </select>
  399. <sql id="orgIdSql">
  400. <choose>
  401. <when test="orgId !=null and orgId !=''">
  402. and ORG_ID=#{orgId}
  403. </when>
  404. <otherwise>
  405. and ORG_ID is null
  406. </otherwise>
  407. </choose>
  408. </sql>
  409. <select id="getSdObjByPersId" resultType="cn.com.goldenwater.dcproj.dto.BisInspObjDto"
  410. parameterType="cn.com.goldenwater.dcproj.param.PersObjParam">
  411. SELECT A.SD_CODE AS CODE,A.SD_CODE AS OBJCODE,A.SD_NAME AS NM,
  412. A.CENTER_X AS CENTERX,
  413. A.CENTER_Y AS CENTERY,
  414. A.GD_X AS LGTD,
  415. A.GD_Y AS LTTD,
  416. R.SD_LOC AS LOCATION,
  417. R.AD_CODE,
  418. B.OBJ_ID,
  419. R.STATE,
  420. R.ID AS RGSTRID
  421. FROM ATT_SD_BASE A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.SD_CODE = B.CODE
  422. LEFT JOIN BIS_INSP_SD_RGSTR R ON B.OBJ_ID = R.OBJ_ID
  423. WHERE 1 = 1 AND B.PTYPE = #{objType}
  424. <include refid="choseSql"/>
  425. AND
  426. REGEXP_LIKE(
  427. B.Id,'^('||
  428. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  429. <include refid="orgIdSql"/>
  430. )>0 then
  431. (SELECT LISTAGG(id, '|') as
  432. id FROM BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  433. <include refid="orgIdSql"/> GROUP BY PERSID
  434. )
  435. else (select 'non' from dual) end)
  436. ||')')
  437. <if test="adCode != null and adCode != ''">and R.AD_CODE LIKE '${adCode}%'</if>
  438. <if test="maxLgtd != null and maxLgtd != '' and minLgtd != null and minLgtd != ''">and A.CENTER_X BETWEEN
  439. #{minLgtd} AND #{maxLgtd}
  440. </if>
  441. <if test="maxLttd != null and maxLttd != '' and minLttd != null and minLttd != ''">and A.CENTER_Y BETWEEN
  442. #{minLttd} AND #{maxLttd}
  443. </if>
  444. <if test="maxcenterXGd != null and maxcenterXGd != '' and mincenterXGd != null and mincenterXGd != ''">and
  445. A.GD_X BETWEEN #{mincenterXGd} AND #{maxcenterXGd}
  446. </if>
  447. <if test="maxcenterYGd != null and maxcenterYGd != '' and mincenterYGd != null and mincenterYGd != ''">and
  448. A.GD_Y BETWEEN #{mincenterYGd} AND #{maxcenterYGd}
  449. </if>
  450. </select>
  451. <select id="getSvwtObjByPersId" resultType="cn.com.goldenwater.dcproj.dto.BisInspObjDto"
  452. parameterType="cn.com.goldenwater.dcproj.param.PersObjParam">
  453. SELECT A.AD_CODE AS CODE,A.AD_CODE AS OBJCODE,A.AD_Name AS NM,
  454. case when r.pc_x is null then A.LGTDPC else r.pc_x end AS CENTERX,
  455. case when r.pc_y is null then a.lttdpc else r.pc_y end AS CENTERY,
  456. case when r.gd_x is null then A.LGTD else r.gd_x end AS LGTD,
  457. case when r.gd_y is null then a.LtTD else r.gd_y end as LTTD,
  458. case when R.loc is null then a.AD_FULL_NAME else r.loc end AS LOCATION,
  459. R.AD_CODE,
  460. B.OBJ_ID,
  461. R.STATE,
  462. R.ID AS RGSTRID
  463. FROM ATT_AD_X_BASE A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.AD_CODe = B.CODE
  464. LEFT JOIN BIS_INSP_SVWT_AREA_RGSTR R ON B.OBJ_ID = R.OBJ_ID
  465. WHERE 1 = 1 AND B.PTYPE = #{objType}
  466. <include refid="choseSql"/>
  467. AND
  468. REGEXP_LIKE(
  469. B.Id,'^('||
  470. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  471. <include refid="orgIdSql"/>
  472. )>0 then
  473. (SELECT LISTAGG(id, '|') as
  474. id FROM BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  475. <include refid="orgIdSql"/> GROUP BY PERSID
  476. )
  477. else (select 'non' from dual) end)
  478. ||')')
  479. <if test="adCode != null and adCode != ''">and R.AD_CODE LIKE '${adCode}%'</if>
  480. <if test="maxLgtd != null and maxLgtd != '' and minLgtd != null and minLgtd != ''">and A.LGTDPC BETWEEN
  481. #{minLgtd} AND #{maxLgtd}
  482. </if>
  483. <if test="maxLttd != null and maxLttd != '' and minLttd != null and minLttd != ''">and A.lttdpc BETWEEN
  484. #{minLttd} AND #{maxLttd}
  485. </if>
  486. <if test="maxcenterXGd != null and maxcenterXGd != '' and mincenterXGd != null and mincenterXGd != ''">and
  487. A.LGTD BETWEEN #{mincenterXGd} AND #{maxcenterXGd}
  488. </if>
  489. <if test="maxcenterYGd != null and maxcenterYGd != '' and mincenterYGd != null and mincenterYGd != ''">and
  490. A.LtTD BETWEEN #{mincenterYGd} AND #{maxcenterYGd}
  491. </if>
  492. <if test="state != null and state != ''">
  493. and r.state = #{state}
  494. </if>
  495. </select>
  496. <select id="getWuntObjByPersId" resultType="cn.com.goldenwater.dcproj.dto.BisInspObjDto"
  497. parameterType="cn.com.goldenwater.dcproj.param.PersObjParam">
  498. SELECT A.id AS CODE,A.UT_CODE AS OBJCODE,A.UT_NAME AS NM,
  499. case when r.pc_x is null then A.pc_x else r.pc_x end AS CENTERX,
  500. case when r.pc_y is null then a.pc_y else r.pc_y end AS CENTERY,
  501. case when r.gd_x is null then A.gd_x else r.gd_x end AS LGTD,
  502. case when r.gd_y is null then a.gd_y else r.gd_y end as LTTD,
  503. case when R.UT_ADDR is null then a.UT_ADDR else r.UT_ADDR end AS LOCATION,
  504. R.AD_CODE,
  505. B.OBJ_ID,
  506. R.STATE,
  507. R.ID AS RGSTRID,
  508. R.UT_PPT as type
  509. FROM ATT_WUNT_BASE A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.ID = B.CODE
  510. LEFT JOIN BIS_INSP_SVWT_WUNT_RGSTR R ON B.OBJ_ID = R.OBJ_ID
  511. WHERE 1 = 1 AND B.PTYPE = #{objType}
  512. <include refid="choseSql"/>
  513. AND
  514. REGEXP_LIKE(
  515. B.Id,'^('||
  516. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  517. <include refid="orgIdSql"/>
  518. )>0 then
  519. (SELECT LISTAGG(id, '|') as
  520. id FROM BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  521. <include refid="orgIdSql"/> GROUP BY PERSID
  522. )
  523. else (select 'non' from dual) end)
  524. ||')')
  525. <if test="adCode != null and adCode != ''">and R.AD_CODE LIKE '${adCode}%'</if>
  526. <if test="rsName != null and rsName != ''">and a.UT_NAME like '%${rsName}%'</if>
  527. <if test="maxLgtd != null and maxLgtd != '' and minLgtd != null and minLgtd != ''">and A.pc_x BETWEEN
  528. #{minLgtd} AND #{maxLgtd}
  529. </if>
  530. <if test="maxLttd != null and maxLttd != '' and minLttd != null and minLttd != ''">and A.pc_y BETWEEN
  531. #{minLttd} AND #{maxLttd}
  532. </if>
  533. <if test="maxcenterXGd != null and maxcenterXGd != '' and mincenterXGd != null and mincenterXGd != ''">and
  534. A.gd_x BETWEEN #{mincenterXGd} AND #{maxcenterXGd}
  535. </if>
  536. <if test="maxcenterYGd != null and maxcenterYGd != '' and mincenterYGd != null and mincenterYGd != ''">and
  537. A.gd_y BETWEEN #{mincenterYGd} AND #{maxcenterYGd}
  538. </if>
  539. <if test="state != null and state != ''">
  540. and r.state = #{state}
  541. </if>
  542. </select>
  543. <select id="getIrrObjByPersId" resultType="cn.com.goldenwater.dcproj.dto.BisInspObjDto"
  544. parameterType="cn.com.goldenwater.dcproj.param.PersObjParam">
  545. SELECT A.id as code,A.Irr_Name AS NM,
  546. A.CENTER_X AS CENTERX,
  547. A.CENTER_Y AS CENTERY,
  548. A.GD_X AS LGTD,
  549. A.GD_Y AS LTTD,
  550. R.Ad_Full_Name as LOCATION ,
  551. R.AD_CODE,
  552. B.OBJ_ID,
  553. R.STATE,
  554. R.ID AS RGSTRID
  555. FROM att_irr_base A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.id = B.CODE
  556. LEFT JOIN bis_insp_irr_rgstr R ON B.OBJ_ID = R.OBJ_ID
  557. WHERE 1 = 1 and B.PTYPE = #{objType}
  558. <include refid="choseSql"/>
  559. AND
  560. REGEXP_LIKE(
  561. B.Id,'^('||
  562. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  563. <include refid="orgIdSql"/>
  564. )>0 then
  565. (SELECT LISTAGG(id, '|') as
  566. id FROM BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  567. <include refid="orgIdSql"/> GROUP BY PERSID
  568. )
  569. else (select 'non' from dual) end)
  570. ||')')
  571. <if test="adCode != null and adCode != ''">and R.AD_CODE LIKE '${adCode}%'</if>
  572. <if test="maxLgtd != null and maxLgtd != '' and minLgtd != null and minLgtd != ''">and A.CENTER_X BETWEEN
  573. #{minLgtd} AND #{maxLgtd}
  574. </if>
  575. <if test="maxLttd != null and maxLttd != '' and minLttd != null and minLttd != ''">and A.CENTER_Y BETWEEN
  576. #{minLttd} AND #{maxLttd}
  577. </if>
  578. <if test="maxcenterXGd != null and maxcenterXGd != '' and mincenterXGd != null and mincenterXGd != ''">and
  579. A.GD_X BETWEEN #{mincenterXGd} AND #{maxcenterXGd}
  580. </if>
  581. <if test="maxcenterYGd != null and maxcenterYGd != '' and mincenterYGd != null and mincenterYGd != ''">and
  582. A.GD_Y BETWEEN #{mincenterYGd} AND #{maxcenterYGd}
  583. </if>
  584. </select>
  585. <select id="getSapObjByPersId" resultType="cn.com.goldenwater.dcproj.dto.AttWagaSapBaseDto"
  586. parameterType="cn.com.goldenwater.dcproj.param.PersObjParam">
  587. SELECT
  588. A.id as code,
  589. A.Sap_Name AS NM,
  590. A.ID,
  591. A.SAP_NAME,
  592. A.BAS_CODE,
  593. A.DISK_NAME,
  594. A.AD_CODE,
  595. A.AD_NAME,
  596. A.START_LOC,
  597. A.END_LOC,
  598. A.CENTER_X,
  599. A.CENTER_Y,
  600. A.GD_X,
  601. A.GD_Y,
  602. A.RIVER_BANK,
  603. A.LAKE,
  604. A.COAST,
  605. A.DIKE_GRAD,
  606. A.SAP_LEN,
  607. A.SAP_TYPE,
  608. A.CHK_STATE,
  609. A.MAMPU,
  610. A.MAMPU_ATTN,
  611. A.MAMPU_ATTN_TEL,
  612. A.COMP_UNIT_ATTN,
  613. A.COMP_UNIT_ATTN_TEL,
  614. A.GVMT_FLD_WHO,
  615. A.GVMT_FLD_WHO_TEL,
  616. A.GD_X AS LGTD,
  617. A.GD_Y AS LTTD,
  618. R.START_LOC as location,
  619. B.OBJ_ID,
  620. R.STATE,
  621. R.ID AS RGSTR_ID
  622. FROM att_waga_sap_base A
  623. LEFT JOIN BIS_INSP_ALL_OBJ B ON A.id = B.CODE
  624. LEFT JOIN bis_insp_waga_sap_rgstr R ON B.OBJ_ID = R.OBJ_ID
  625. WHERE B.PTYPE = #{objType}
  626. <include refid="choseSql"/>
  627. AND REGEXP_LIKE(
  628. B.Id,'^('||
  629. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  630. <include refid="orgIdSql"/>
  631. )>0 then
  632. (SELECT LISTAGG(id, '|') as id FROM BIS_INSP_ALL_RLATION WHERE PERSID =
  633. #{persGuid}
  634. <include refid="orgIdSql"/> GROUP BY PERSID
  635. )
  636. else (select 'non' from dual) end)
  637. ||')')
  638. <if test="adCode != null and adCode != ''">and R.AD_CODE LIKE '${adCode}%'</if>
  639. <if test="maxLgtd != null and maxLgtd != '' and minLgtd != null and minLgtd != ''">
  640. and A.CENTER_X BETWEEN #{minLgtd} AND #{maxLgtd}
  641. </if>
  642. <if test="maxLttd != null and maxLttd != '' and minLttd != null and minLttd != ''">
  643. and A.CENTER_Y BETWEEN #{minLttd} AND #{maxLttd}
  644. </if>
  645. <if test="maxcenterXGd != null and maxcenterXGd != '' and mincenterXGd != null and mincenterXGd != ''">
  646. and A.GD_X BETWEEN #{mincenterXGd} AND #{maxcenterXGd}
  647. </if>
  648. <if test="maxcenterYGd != null and maxcenterYGd != '' and mincenterYGd != null and mincenterYGd != ''">
  649. and A.GD_Y BETWEEN #{mincenterYGd} AND #{maxcenterYGd}
  650. </if>
  651. </select>
  652. <select id="getSapBaseList" resultType="cn.com.goldenwater.dcproj.dto.BisInspObjDto"
  653. parameterType="cn.com.goldenwater.dcproj.param.PersObjParam">
  654. SELECT B.ID AS CODE, B.ID AS OBJCODE, B.SAP_NAME AS NM,
  655. B.CENTER_X, B.CENTER_Y, B.GD_X, B.GD_Y,
  656. B.GD_X AS LGTD, B.GD_Y AS LTTD,
  657. B.ad_CODE,
  658. B.SAP_TYPE engScal,
  659. B.START_LOC location,
  660. NVL(A.state, 0) as state
  661. FROM ATT_WAGA_SAP_BASE B
  662. LEFT JOIN (
  663. SELECT a.ID, '1' as state
  664. FROM ATT_WAGA_SAP_BASE a
  665. WHERE Exists (select code FROM BIS_INSP_ALL_OBJ o where o.code = a.id and o.ptype = '29')
  666. ) A ON A.ID = B.ID
  667. <where>
  668. <include refid="choseSql"/>
  669. <if test="rsName != null and rsName != ''">
  670. AND B.SAP_NAME like concat('%',concat(#{rsName},'%'))
  671. </if>
  672. <if test="adCode != null and adCode != ''">and B.AD_CODE LIKE '${adCode}%'</if>
  673. <if test="maxLgtd != null and maxLgtd != '' and minLgtd != null and minLgtd != ''">and B.CENTER_X BETWEEN
  674. #{minLgtd} AND #{maxLgtd}
  675. </if>
  676. <if test="maxLttd != null and maxLttd != '' and minLttd != null and minLttd != ''">and B.CENTER_Y BETWEEN
  677. #{minLttd} AND #{maxLttd}
  678. </if>
  679. <if test="maxcenterXGd != null and maxcenterXGd != '' and mincenterXGd != null and mincenterXGd != ''">and
  680. B.GD_X BETWEEN #{mincenterXGd} AND #{maxcenterXGd}
  681. </if>
  682. <if test="maxcenterYGd != null and maxcenterYGd != '' and mincenterYGd != null and mincenterYGd != ''">and
  683. B.GD_Y BETWEEN #{mincenterYGd} AND #{maxcenterYGd}
  684. </if>
  685. <if test="engScal != null and engScal != ''">
  686. AND B.SAP_TYPE = #{engScal}
  687. </if>
  688. </where>
  689. </select>
  690. </mapper>