9e8e05fc0d0b6a421cfe14b5a2f39ffeac7673de.svn-base 30 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737
  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,concat('^(',
  181. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  182. <include refid="orgIdSql"/>
  183. )>0 then
  184. (SELECT group_concat(id separator '|') as
  185. id FROM BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  186. <include refid="orgIdSql"/>
  187. GROUP BY PERSID
  188. )
  189. else (select 'non' from dual) end)
  190. ,')'))
  191. <if test="adCode != null and adCode != ''">and A.AD_CODE LIKE '${adCode}%'</if>
  192. <if test="maxLgtd != null and maxLgtd != '' and minLgtd != null and minLgtd != ''">and A.SWHS_LONG BETWEEN
  193. #{minLgtd} AND #{maxLgtd}
  194. </if>
  195. <if test="maxLttd != null and maxLttd != '' and minLttd != null and minLttd != ''">and A.SWHS_LAT BETWEEN
  196. #{minLttd} AND #{maxLttd}
  197. </if>
  198. <if test="maxcenterXGd != null and maxcenterXGd != '' and mincenterXGd != null and mincenterXGd != ''">and
  199. A.SWHS_LONG_GD BETWEEN #{mincenterXGd} AND #{maxcenterXGd}
  200. </if>
  201. <if test="maxcenterYGd != null and maxcenterYGd != '' and mincenterYGd != null and mincenterYGd != ''">and
  202. A.SWHS_LAT_GD BETWEEN #{mincenterYGd} AND #{maxcenterYGd}
  203. </if>
  204. </select>
  205. <select id="getWiuObjByPersId" resultType="cn.com.goldenwater.dcproj.dto.BisInspObjDto"
  206. parameterType="cn.com.goldenwater.dcproj.param.PersObjParam">
  207. SELECT A.ID AS CODE,A.WIU_CODE AS OBJCODE,A.WIU_NAME AS NM,A.WINT_CODE as wintCode,
  208. A.WIU_LONG AS CENTERX,
  209. A.WIU_LAT AS CENTERY,
  210. A.GD_X AS LGTD,
  211. A.GD_Y AS LTTD,
  212. R.WIU_LOC AS LOCATION,
  213. R.AD_CODE,
  214. B.OBJ_ID,
  215. R.STATE,
  216. R.ID AS RGSTRID
  217. FROM ATT_WIU_BASE A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.ID = B.CODE
  218. LEFT JOIN BIS_INSP_WIU_RGSTR R ON B.OBJ_ID = R.OBJ_ID
  219. WHERE 1 = 1 AND B.PTYPE = #{objType}
  220. <include refid="choseSql"/>
  221. AND
  222. REGEXP_LIKE(
  223. B.Id,concat('^(',
  224. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  225. <include refid="orgIdSql"/>
  226. )>0 then
  227. (SELECT group_concat(id separator '|') as
  228. id FROM BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  229. <include refid="orgIdSql"/>
  230. GROUP BY PERSID
  231. )
  232. else (select 'non' from dual) end)
  233. ,')'))
  234. <if test="adCode != null and adCode != ''">and R.AD_CODE LIKE '${adCode}%'</if>
  235. <if test="maxLgtd != null and maxLgtd != '' and minLgtd != null and minLgtd != ''">and A.WIU_LONG BETWEEN
  236. #{minLgtd} AND #{maxLgtd}
  237. </if>
  238. <if test="maxLttd != null and maxLttd != '' and minLttd != null and minLttd != ''">and A.WIU_LAT BETWEEN
  239. #{minLttd} AND #{maxLttd}
  240. </if>
  241. <if test="maxcenterXGd != null and maxcenterXGd != '' and mincenterXGd != null and mincenterXGd != ''">and
  242. A.GD_X BETWEEN #{mincenterXGd} AND #{maxcenterXGd}
  243. </if>
  244. <if test="maxcenterYGd != null and maxcenterYGd != '' and mincenterYGd != null and mincenterYGd != ''">and
  245. A.GD_Y BETWEEN #{mincenterYGd} AND #{maxcenterYGd}
  246. </if>
  247. </select>
  248. <select id="getWintObjByPersId" resultType="cn.com.goldenwater.dcproj.dto.BisInspObjDto"
  249. parameterType="cn.com.goldenwater.dcproj.param.PersObjParam">
  250. SELECT A.ID AS CODE,A.WINT_CODE AS OBJCODE,A.WINT_NAME AS NM,
  251. A.WAIN_LONG AS CENTERX,
  252. A.WAIN_LAT AS CENTERY,
  253. A.GD_X AS LGTD,
  254. A.GD_Y AS LTTD,
  255. A.WINT_POS AS LOCATION,
  256. A.AD_CODE,
  257. A.WAIN_TYPE as type
  258. FROM ATT_WINT_BASE_B A
  259. WHERE 1 = 1
  260. <if test="rsName != null and rsName != ''">and A.WINT_NAME like '%${rsName}%'</if>
  261. <if test="adCode != null and adCode != ''">and A.AD_CODE LIKE '${adCode}%'</if>
  262. <if test="maxLgtd != null and maxLgtd != '' and minLgtd != null and minLgtd != ''">and A.WAIN_LONG BETWEEN
  263. #{minLgtd} AND #{maxLgtd}
  264. </if>
  265. <if test="maxLttd != null and maxLttd != '' and minLttd != null and minLttd != ''">and A.WAIN_LAT BETWEEN
  266. #{minLttd} AND #{maxLttd}
  267. </if>
  268. <if test="maxcenterXGd != null and maxcenterXGd != '' and mincenterXGd != null and mincenterXGd != ''">and
  269. A.GD_X BETWEEN #{mincenterXGd} AND #{maxcenterXGd}
  270. </if>
  271. <if test="maxcenterYGd != null and maxcenterYGd != '' and mincenterYGd != null and mincenterYGd != ''">and
  272. A.GD_Y BETWEEN #{mincenterYGd} AND #{maxcenterYGd}
  273. </if>
  274. </select>
  275. <select id="getJSWAObjByPersId" resultType="cn.com.goldenwater.dcproj.dto.BisInspObjDto"
  276. parameterType="cn.com.goldenwater.dcproj.param.PersObjParam">
  277. SELECT A.id as code,A.name AS NM,
  278. A.CENTER_X AS CENTERX,
  279. A.CENTER_Y AS CENTERY,
  280. A.GD_X AS LGTD,
  281. A.GD_Y AS LTTD,
  282. R.LOCATION ,
  283. R.AD_CODE,
  284. B.OBJ_ID,
  285. R.STATE,
  286. R.ID AS RGSTRID
  287. FROM ATT_JSKEJIAN_WATER_BASE A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.id = B.CODE
  288. LEFT JOIN ATT_JSKEJIAN_WATER_RGSTR R ON B.OBJ_ID = R.OBJ_ID
  289. WHERE 1 = 1 AND B.PTYPE = #{objType}
  290. <include refid="choseSql"/>
  291. AND
  292. REGEXP_LIKE(
  293. B.Id,concat('^(',
  294. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  295. <include refid="orgIdSql"/>
  296. )>0 then
  297. (SELECT group_concat(id separator '|') as
  298. id FROM BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  299. <include refid="orgIdSql"/>
  300. GROUP BY PERSID
  301. )
  302. else (select 'non' from dual) end)
  303. ,')'))
  304. <if test="adCode != null and adCode != ''">and R.AD_CODE LIKE '${adCode}%'</if>
  305. <if test="maxLgtd != null and maxLgtd != '' and minLgtd != null and minLgtd != ''">and A.CENTER_X BETWEEN
  306. #{minLgtd} AND #{maxLgtd}
  307. </if>
  308. <if test="maxLttd != null and maxLttd != '' and minLttd != null and minLttd != ''">and A.CENTER_Y BETWEEN
  309. #{minLttd} AND #{maxLttd}
  310. </if>
  311. <if test="maxcenterXGd != null and maxcenterXGd != '' and mincenterXGd != null and mincenterXGd != ''">and
  312. A.GD_X BETWEEN #{mincenterXGd} AND #{maxcenterXGd}
  313. </if>
  314. <if test="maxcenterYGd != null and maxcenterYGd != '' and mincenterYGd != null and mincenterYGd != ''">and
  315. A.GD_Y BETWEEN #{mincenterYGd} AND #{maxcenterYGd}
  316. </if>
  317. </select>
  318. <select id="getJSFLObjByPersId" resultType="cn.com.goldenwater.dcproj.dto.BisInspObjDto"
  319. parameterType="cn.com.goldenwater.dcproj.param.PersObjParam">
  320. SELECT A.id as code,A.name AS NM,
  321. A.CENTER_X AS CENTERX,
  322. A.CENTER_Y AS CENTERY,
  323. A.GD_X AS LGTD,
  324. A.GD_Y AS LTTD,
  325. R.LOCATION ,
  326. R.AD_CODE,
  327. B.OBJ_ID,
  328. R.STATE,
  329. R.ID AS RGSTRID
  330. FROM ATT_JSKEJIAN_FLKDIS_BASE A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.id = B.CODE
  331. LEFT JOIN ATT_JSKEJIAN_FLKDIS_RGSTR R ON B.OBJ_ID = R.OBJ_ID
  332. WHERE 1 = 1 AND B.PTYPE = #{objType}
  333. <include refid="choseSql"/>
  334. AND
  335. REGEXP_LIKE(
  336. B.Id,concat('^(',
  337. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  338. <include refid="orgIdSql"/>
  339. )>0 then
  340. (SELECT group_concat(id separator '|') as
  341. id FROM BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  342. <include refid="orgIdSql"/>
  343. GROUP BY PERSID
  344. )
  345. else (select 'non' from dual) end)
  346. ,')'))
  347. <if test="adCode != null and adCode != ''">and R.AD_CODE LIKE '${adCode}%'</if>
  348. <if test="maxLgtd != null and maxLgtd != '' and minLgtd != null and minLgtd != ''">and A.CENTER_X BETWEEN
  349. #{minLgtd} AND #{maxLgtd}
  350. </if>
  351. <if test="maxLttd != null and maxLttd != '' and minLttd != null and minLttd != ''">and A.CENTER_Y BETWEEN
  352. #{minLttd} AND #{maxLttd}
  353. </if>
  354. <if test="maxcenterXGd != null and maxcenterXGd != '' and mincenterXGd != null and mincenterXGd != ''">and
  355. A.GD_X BETWEEN #{mincenterXGd} AND #{maxcenterXGd}
  356. </if>
  357. <if test="maxcenterYGd != null and maxcenterYGd != '' and mincenterYGd != null and mincenterYGd != ''">and
  358. A.GD_Y BETWEEN #{mincenterYGd} AND #{maxcenterYGd}
  359. </if>
  360. </select>
  361. <select id="getPrdObjByPersId" resultType="cn.com.goldenwater.dcproj.dto.BisInspObjDto"
  362. parameterType="cn.com.goldenwater.dcproj.param.PersObjParam">
  363. SELECT A.id as code,A.code AS OBJCODE,A.name AS NM,
  364. A.CENTER_X AS CENTERX,
  365. A.CENTER_Y AS CENTERY,
  366. A.GD_X AS LGTD,
  367. A.GD_Y AS LTTD,
  368. R.LOCATION ,
  369. R.AD_CODE,
  370. B.OBJ_ID,
  371. R.STATE,
  372. R.ID AS RGSTRID
  373. FROM ATT_PRD_CSTR_PROJ_BASE A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.id = B.CODE
  374. LEFT JOIN BIS_INSP_OPRD_CSTR_PROJ_RGSTR R ON B.OBJ_ID = R.OBJ_ID
  375. WHERE 1 = 1 AND B.PTYPE = #{objType}
  376. <include refid="choseSql"/>
  377. AND
  378. REGEXP_LIKE(
  379. B.Id,concat('^(',
  380. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  381. <include refid="orgIdSql"/>
  382. )>0 then
  383. (SELECT group_concat(id separator '|') as
  384. id FROM BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  385. <include refid="orgIdSql"/>
  386. GROUP BY PERSID
  387. )
  388. else (select 'non' from dual) end)
  389. ')'))
  390. <if test="adCode != null and adCode != ''">and R.AD_CODE LIKE '${adCode}%'</if>
  391. <if test="maxLgtd != null and maxLgtd != '' and minLgtd != null and minLgtd != ''">and A.CENTER_X BETWEEN
  392. #{minLgtd} AND #{maxLgtd}
  393. </if>
  394. <if test="maxLttd != null and maxLttd != '' and minLttd != null and minLttd != ''">and A.CENTER_Y BETWEEN
  395. #{minLttd} AND #{maxLttd}
  396. </if>
  397. <if test="maxcenterXGd != null and maxcenterXGd != '' and mincenterXGd != null and mincenterXGd != ''">and
  398. A.GD_X BETWEEN #{mincenterXGd} AND #{maxcenterXGd}
  399. </if>
  400. <if test="maxcenterYGd != null and maxcenterYGd != '' and mincenterYGd != null and mincenterYGd != ''">and
  401. A.GD_Y BETWEEN #{mincenterYGd} AND #{maxcenterYGd}
  402. </if>
  403. </select>
  404. <sql id="orgIdSql">
  405. <choose>
  406. <when test="orgId !=null and orgId !=''">
  407. and ORG_ID=#{orgId}
  408. </when>
  409. <otherwise>
  410. and ORG_ID is null
  411. </otherwise>
  412. </choose>
  413. </sql>
  414. <select id="getSdObjByPersId" resultType="cn.com.goldenwater.dcproj.dto.BisInspObjDto"
  415. parameterType="cn.com.goldenwater.dcproj.param.PersObjParam">
  416. SELECT A.SD_CODE AS CODE,A.SD_CODE AS OBJCODE,A.SD_NAME AS NM,
  417. A.CENTER_X AS CENTERX,
  418. A.CENTER_Y AS CENTERY,
  419. A.GD_X AS LGTD,
  420. A.GD_Y AS LTTD,
  421. R.SD_LOC AS LOCATION,
  422. R.AD_CODE,
  423. B.OBJ_ID,
  424. R.STATE,
  425. R.ID AS RGSTRID
  426. FROM ATT_SD_BASE A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.SD_CODE = B.CODE
  427. LEFT JOIN BIS_INSP_SD_RGSTR R ON B.OBJ_ID = R.OBJ_ID
  428. WHERE 1 = 1 AND B.PTYPE = #{objType}
  429. <include refid="choseSql"/>
  430. AND
  431. REGEXP_LIKE(
  432. B.Id,concat('^(',
  433. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  434. <include refid="orgIdSql"/>
  435. )>0 then
  436. (SELECT group_concat(id separator '|') as
  437. id FROM BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  438. <include refid="orgIdSql"/>
  439. GROUP BY PERSID
  440. )
  441. else (select 'non' from dual) end)
  442. ,')'))
  443. <if test="adCode != null and adCode != ''">and R.AD_CODE LIKE '${adCode}%'</if>
  444. <if test="maxLgtd != null and maxLgtd != '' and minLgtd != null and minLgtd != ''">and A.CENTER_X BETWEEN
  445. #{minLgtd} AND #{maxLgtd}
  446. </if>
  447. <if test="maxLttd != null and maxLttd != '' and minLttd != null and minLttd != ''">and A.CENTER_Y BETWEEN
  448. #{minLttd} AND #{maxLttd}
  449. </if>
  450. <if test="maxcenterXGd != null and maxcenterXGd != '' and mincenterXGd != null and mincenterXGd != ''">and
  451. A.GD_X BETWEEN #{mincenterXGd} AND #{maxcenterXGd}
  452. </if>
  453. <if test="maxcenterYGd != null and maxcenterYGd != '' and mincenterYGd != null and mincenterYGd != ''">and
  454. A.GD_Y BETWEEN #{mincenterYGd} AND #{maxcenterYGd}
  455. </if>
  456. </select>
  457. <select id="getSvwtObjByPersId" resultType="cn.com.goldenwater.dcproj.dto.BisInspObjDto"
  458. parameterType="cn.com.goldenwater.dcproj.param.PersObjParam">
  459. SELECT A.AD_CODE AS CODE,A.AD_CODE AS OBJCODE,A.AD_Name AS NM,
  460. case when r.pc_x is null then A.LGTDPC else r.pc_x end AS CENTERX,
  461. case when r.pc_y is null then a.lttdpc else r.pc_y end AS CENTERY,
  462. case when r.gd_x is null then A.LGTD else r.gd_x end AS LGTD,
  463. case when r.gd_y is null then a.LtTD else r.gd_y end as LTTD,
  464. case when R.loc is null then a.AD_FULL_NAME else r.loc end AS LOCATION,
  465. R.AD_CODE,
  466. B.OBJ_ID,
  467. R.STATE,
  468. R.ID AS RGSTRID
  469. FROM ATT_AD_X_BASE A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.AD_CODe = B.CODE
  470. LEFT JOIN BIS_INSP_SVWT_AREA_RGSTR R ON B.OBJ_ID = R.OBJ_ID
  471. WHERE 1 = 1 AND B.PTYPE = #{objType}
  472. <include refid="choseSql"/>
  473. AND
  474. REGEXP_LIKE(
  475. B.Id,concat('^(',
  476. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  477. <include refid="orgIdSql"/>
  478. )>0 then
  479. (SELECT group_concat(id separator '|') as
  480. id FROM BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  481. <include refid="orgIdSql"/>
  482. GROUP BY PERSID
  483. )
  484. else (select 'non' from dual) end)
  485. ,')'))
  486. <if test="adCode != null and adCode != ''">and R.AD_CODE LIKE '${adCode}%'</if>
  487. <if test="maxLgtd != null and maxLgtd != '' and minLgtd != null and minLgtd != ''">and A.LGTDPC BETWEEN
  488. #{minLgtd} AND #{maxLgtd}
  489. </if>
  490. <if test="maxLttd != null and maxLttd != '' and minLttd != null and minLttd != ''">and A.lttdpc BETWEEN
  491. #{minLttd} AND #{maxLttd}
  492. </if>
  493. <if test="maxcenterXGd != null and maxcenterXGd != '' and mincenterXGd != null and mincenterXGd != ''">and
  494. A.LGTD BETWEEN #{mincenterXGd} AND #{maxcenterXGd}
  495. </if>
  496. <if test="maxcenterYGd != null and maxcenterYGd != '' and mincenterYGd != null and mincenterYGd != ''">and
  497. A.LtTD BETWEEN #{mincenterYGd} AND #{maxcenterYGd}
  498. </if>
  499. <if test="state != null and state != ''">
  500. and r.state = #{state}
  501. </if>
  502. </select>
  503. <select id="getWuntObjByPersId" resultType="cn.com.goldenwater.dcproj.dto.BisInspObjDto"
  504. parameterType="cn.com.goldenwater.dcproj.param.PersObjParam">
  505. SELECT A.id AS CODE,A.UT_CODE AS OBJCODE,A.UT_NAME AS NM,
  506. case when r.pc_x is null then A.pc_x else r.pc_x end AS CENTERX,
  507. case when r.pc_y is null then a.pc_y else r.pc_y end AS CENTERY,
  508. case when r.gd_x is null then A.gd_x else r.gd_x end AS LGTD,
  509. case when r.gd_y is null then a.gd_y else r.gd_y end as LTTD,
  510. case when R.UT_ADDR is null then a.UT_ADDR else r.UT_ADDR end AS LOCATION,
  511. R.AD_CODE,
  512. B.OBJ_ID,
  513. R.STATE,
  514. R.ID AS RGSTRID,
  515. R.UT_PPT as type
  516. FROM ATT_WUNT_BASE A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.ID = B.CODE
  517. LEFT JOIN BIS_INSP_SVWT_WUNT_RGSTR R ON B.OBJ_ID = R.OBJ_ID
  518. WHERE 1 = 1 AND B.PTYPE = #{objType}
  519. <include refid="choseSql"/>
  520. AND
  521. REGEXP_LIKE(
  522. B.Id,concat('^(',
  523. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  524. <include refid="orgIdSql"/>
  525. )>0 then
  526. (SELECT group_concat(id separator '|') as
  527. id FROM BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  528. <include refid="orgIdSql"/>
  529. GROUP BY PERSID
  530. )
  531. else (select 'non' from dual) end)
  532. ,')'))
  533. <if test="adCode != null and adCode != ''">and R.AD_CODE LIKE '${adCode}%'</if>
  534. <if test="rsName != null and rsName != ''">and a.UT_NAME like '%${rsName}%'</if>
  535. <if test="maxLgtd != null and maxLgtd != '' and minLgtd != null and minLgtd != ''">and A.pc_x BETWEEN
  536. #{minLgtd} AND #{maxLgtd}
  537. </if>
  538. <if test="maxLttd != null and maxLttd != '' and minLttd != null and minLttd != ''">and A.pc_y BETWEEN
  539. #{minLttd} AND #{maxLttd}
  540. </if>
  541. <if test="maxcenterXGd != null and maxcenterXGd != '' and mincenterXGd != null and mincenterXGd != ''">and
  542. A.gd_x BETWEEN #{mincenterXGd} AND #{maxcenterXGd}
  543. </if>
  544. <if test="maxcenterYGd != null and maxcenterYGd != '' and mincenterYGd != null and mincenterYGd != ''">and
  545. A.gd_y BETWEEN #{mincenterYGd} AND #{maxcenterYGd}
  546. </if>
  547. <if test="state != null and state != ''">
  548. and r.state = #{state}
  549. </if>
  550. </select>
  551. <select id="getIrrObjByPersId" resultType="cn.com.goldenwater.dcproj.dto.BisInspObjDto"
  552. parameterType="cn.com.goldenwater.dcproj.param.PersObjParam">
  553. SELECT A.id as code,A.Irr_Name AS NM,
  554. A.CENTER_X AS CENTERX,
  555. A.CENTER_Y AS CENTERY,
  556. A.GD_X AS LGTD,
  557. A.GD_Y AS LTTD,
  558. R.Ad_Full_Name as LOCATION ,
  559. R.AD_CODE,
  560. B.OBJ_ID,
  561. R.STATE,
  562. R.ID AS RGSTRID
  563. FROM att_irr_base A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.id = B.CODE
  564. LEFT JOIN bis_insp_irr_rgstr R ON B.OBJ_ID = R.OBJ_ID
  565. WHERE 1 = 1 and B.PTYPE = #{objType}
  566. <include refid="choseSql"/>
  567. AND
  568. REGEXP_LIKE(
  569. B.Id,concat('^(',
  570. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  571. <include refid="orgIdSql"/>
  572. )>0 then
  573. (SELECT group_concat(id separator '|') as
  574. id FROM BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  575. <include refid="orgIdSql"/>
  576. GROUP BY PERSID
  577. )
  578. else (select 'non' from dual) end)
  579. ,')'))
  580. <if test="adCode != null and adCode != ''">and R.AD_CODE LIKE '${adCode}%'</if>
  581. <if test="maxLgtd != null and maxLgtd != '' and minLgtd != null and minLgtd != ''">and A.CENTER_X BETWEEN
  582. #{minLgtd} AND #{maxLgtd}
  583. </if>
  584. <if test="maxLttd != null and maxLttd != '' and minLttd != null and minLttd != ''">and A.CENTER_Y BETWEEN
  585. #{minLttd} AND #{maxLttd}
  586. </if>
  587. <if test="maxcenterXGd != null and maxcenterXGd != '' and mincenterXGd != null and mincenterXGd != ''">and
  588. A.GD_X BETWEEN #{mincenterXGd} AND #{maxcenterXGd}
  589. </if>
  590. <if test="maxcenterYGd != null and maxcenterYGd != '' and mincenterYGd != null and mincenterYGd != ''">and
  591. A.GD_Y BETWEEN #{mincenterYGd} AND #{maxcenterYGd}
  592. </if>
  593. </select>
  594. <select id="getSapObjByPersId" resultType="cn.com.goldenwater.dcproj.dto.AttWagaSapBaseDto"
  595. parameterType="cn.com.goldenwater.dcproj.param.PersObjParam">
  596. SELECT
  597. A.id as code,
  598. A.Sap_Name AS NM,
  599. A.ID,
  600. A.SAP_NAME,
  601. A.BAS_CODE,
  602. A.DISK_NAME,
  603. A.AD_CODE,
  604. A.AD_NAME,
  605. A.START_LOC,
  606. A.END_LOC,
  607. A.CENTER_X,
  608. A.CENTER_Y,
  609. A.GD_X,
  610. A.GD_Y,
  611. A.RIVER_BANK,
  612. A.LAKE,
  613. A.COAST,
  614. A.DIKE_GRAD,
  615. A.SAP_LEN,
  616. A.SAP_TYPE,
  617. A.CHK_STATE,
  618. A.MAMPU,
  619. A.MAMPU_ATTN,
  620. A.MAMPU_ATTN_TEL,
  621. A.COMP_UNIT_ATTN,
  622. A.COMP_UNIT_ATTN_TEL,
  623. A.GVMT_FLD_WHO,
  624. A.GVMT_FLD_WHO_TEL,
  625. A.GD_X AS LGTD,
  626. A.GD_Y AS LTTD,
  627. R.START_LOC as location,
  628. B.OBJ_ID,
  629. R.STATE,
  630. R.ID AS RGSTR_ID
  631. FROM att_waga_sap_base A
  632. LEFT JOIN BIS_INSP_ALL_OBJ B ON A.id = B.CODE
  633. LEFT JOIN bis_insp_waga_sap_rgstr R ON B.OBJ_ID = R.OBJ_ID
  634. WHERE B.PTYPE = #{objType}
  635. <include refid="choseSql"/>
  636. AND REGEXP_LIKE(
  637. B.Id,concat('^(',
  638. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  639. <include refid="orgIdSql"/>
  640. )>0 then
  641. (SELECT group_concat(id separator '|') as id FROM BIS_INSP_ALL_RLATION WHERE PERSID = #{persGuid}
  642. <include refid="orgIdSql"/>
  643. GROUP BY PERSID
  644. )
  645. else (select 'non' from dual) end)
  646. ,')'))
  647. <if test="adCode != null and adCode != ''">and R.AD_CODE LIKE '${adCode}%'</if>
  648. <if test="maxLgtd != null and maxLgtd != '' and minLgtd != null and minLgtd != ''">
  649. and A.CENTER_X BETWEEN #{minLgtd} AND #{maxLgtd}
  650. </if>
  651. <if test="maxLttd != null and maxLttd != '' and minLttd != null and minLttd != ''">
  652. and A.CENTER_Y BETWEEN #{minLttd} AND #{maxLttd}
  653. </if>
  654. <if test="maxcenterXGd != null and maxcenterXGd != '' and mincenterXGd != null and mincenterXGd != ''">
  655. and A.GD_X BETWEEN #{mincenterXGd} AND #{maxcenterXGd}
  656. </if>
  657. <if test="maxcenterYGd != null and maxcenterYGd != '' and mincenterYGd != null and mincenterYGd != ''">
  658. and A.GD_Y BETWEEN #{mincenterYGd} AND #{maxcenterYGd}
  659. </if>
  660. </select>
  661. <select id="getSapBaseList" resultType="cn.com.goldenwater.dcproj.dto.BisInspObjDto"
  662. parameterType="cn.com.goldenwater.dcproj.param.PersObjParam">
  663. SELECT B.ID AS CODE, B.ID AS OBJCODE, B.SAP_NAME AS NM,
  664. B.CENTER_X, B.CENTER_Y, B.GD_X, B.GD_Y,
  665. B.GD_X AS LGTD, B.GD_Y AS LTTD,
  666. B.ad_CODE,
  667. B.SAP_TYPE engScal,
  668. B.START_LOC location,
  669. IFNULL(A.state, 0) as state
  670. FROM ATT_WAGA_SAP_BASE B
  671. LEFT JOIN (
  672. SELECT a.ID, '1' as state
  673. FROM ATT_WAGA_SAP_BASE a
  674. WHERE Exists (select code FROM BIS_INSP_ALL_OBJ o where o.code = a.id and o.ptype = '29')
  675. ) A ON A.ID = B.ID
  676. <where>
  677. <include refid="choseSql"/>
  678. <if test="rsName != null and rsName != ''">
  679. AND B.SAP_NAME like concat('%',concat(#{rsName},'%'))
  680. </if>
  681. <if test="adCode != null and adCode != ''">and B.AD_CODE LIKE '${adCode}%'</if>
  682. <if test="maxLgtd != null and maxLgtd != '' and minLgtd != null and minLgtd != ''">and B.CENTER_X BETWEEN
  683. #{minLgtd} AND #{maxLgtd}
  684. </if>
  685. <if test="maxLttd != null and maxLttd != '' and minLttd != null and minLttd != ''">and B.CENTER_Y BETWEEN
  686. #{minLttd} AND #{maxLttd}
  687. </if>
  688. <if test="maxcenterXGd != null and maxcenterXGd != '' and mincenterXGd != null and mincenterXGd != ''">and
  689. B.GD_X BETWEEN #{mincenterXGd} AND #{maxcenterXGd}
  690. </if>
  691. <if test="maxcenterYGd != null and maxcenterYGd != '' and mincenterYGd != null and mincenterYGd != ''">and
  692. B.GD_Y BETWEEN #{mincenterYGd} AND #{maxcenterYGd}
  693. </if>
  694. <if test="engScal != null and engScal != ''">
  695. AND B.SAP_TYPE = #{engScal}
  696. </if>
  697. </where>
  698. </select>
  699. </mapper>