AttJskejianWaterRgstrDao.xml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356
  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.AttJskejianWaterRgstrDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.AttJskejianWaterRgstr" id="attJskejianWaterRgstrResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="objId" column="OBJ_ID"/>
  7. <result property="name" column="NAME"/>
  8. <result property="rvReaLkName" column="RV_REA_LK_NAME"/>
  9. <result property="adCode" column="AD_CODE"/>
  10. <result property="adName" column="AD_NAME"/>
  11. <result property="location" column="LOCATION"/>
  12. <result property="aerialPoint" column="AERIAL_POINT"/>
  13. <result property="centerX" column="CENTER_X"/>
  14. <result property="centerY" column="CENTER_Y"/>
  15. <result property="gdX" column="GD_X"/>
  16. <result property="gdY" column="GD_Y"/>
  17. <result property="pblmType" column="PBLM_TYPE"/>
  18. <result property="pblmDesc" column="PBLM_DESC"/>
  19. <result property="rectConc" column="RECT_CONC"/>
  20. <result property="reviConc" column="REVI_CONC"/>
  21. <result property="reviOpin" column="REVI_OPIN"/>
  22. <result property="persId" column="PERS_ID"/>
  23. <result property="intm" column="INTM"/>
  24. <result property="uptm" column="UPTM"/>
  25. <result property="state" column="STATE"/>
  26. <result property="groupId" column="GROUP_ID"/>
  27. <result property="province" column="PROVINCE"/>
  28. </resultMap>
  29. <sql id="table_columns">
  30. ID,
  31. OBJ_ID,
  32. NAME,
  33. RV_REA_LK_NAME,
  34. AD_CODE,
  35. AD_NAME,
  36. LOCATION,
  37. AERIAL_POINT,
  38. CENTER_X,
  39. CENTER_Y,
  40. GD_X,
  41. GD_Y,
  42. PBLM_TYPE,
  43. PBLM_DESC,
  44. RECT_CONC,
  45. REVI_CONC,
  46. REVI_OPIN,
  47. PERS_ID,
  48. INTM,
  49. UPTM,
  50. STATE,
  51. GROUP_ID,
  52. PROVINCE
  53. </sql>
  54. <sql id="entity_properties">
  55. #{id},
  56. #{objId},
  57. #{name},
  58. #{rvReaLkName},
  59. #{adCode},
  60. #{adName},
  61. #{location},
  62. #{aerialPoint},
  63. #{centerX},
  64. #{centerY},
  65. #{gdX},
  66. #{gdY},
  67. #{pblmType},
  68. #{pblmDesc},
  69. #{rectConc},
  70. #{reviConc},
  71. #{reviOpin},
  72. #{persId},
  73. #{intm},
  74. #{uptm},
  75. #{state},
  76. #{groupId},
  77. #{province}
  78. </sql>
  79. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  80. <sql id="page_where">
  81. <trim prefix="where" prefixOverrides="and | or ">
  82. <if test="objId != null and objId != ''">and OBJ_ID = #{objId}</if>
  83. <if test="name != null and name != ''">and NAME = #{name}</if>
  84. <if test="rvReaLkName != null and rvReaLkName != ''">and RV_REA_LK_NAME = #{rvReaLkName}</if>
  85. <if test="adCode != null and adCode != ''">and AD_CODE like '${adCode}%'</if>
  86. <if test="adName != null and adName != ''">and AD_NAME = #{adName}</if>
  87. <if test="location != null and location != ''">and LOCATION = #{location}</if>
  88. <if test="aerialPoint != null and aerialPoint != ''">and AERIAL_POINT = #{aerialPoint}</if>
  89. <if test="centerX != null and centerX != ''">and CENTER_X = #{centerX}</if>
  90. <if test="centerY != null and centerY != ''">and CENTER_Y = #{centerY}</if>
  91. <if test="gdX != null and gdX != ''">and GD_X = #{gdX}</if>
  92. <if test="gdY != null and gdY != ''">and GD_Y = #{gdY}</if>
  93. <if test="pblmType != null and pblmType != ''">and PBLM_TYPE = #{pblmType}</if>
  94. <if test="pblmDesc != null and pblmDesc != ''">and PBLM_DESC = #{pblmDesc}</if>
  95. <if test="rectConc != null and rectConc != ''">and RECT_CONC = #{rectConc}</if>
  96. <if test="reviConc != null and reviConc != ''">and REVI_CONC = #{reviConc}</if>
  97. <if test="reviOpin != null and reviOpin != ''">and REVI_OPIN = #{reviOpin}</if>
  98. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  99. <if test="intm != null">and INTM = #{intm}</if>
  100. <if test="uptm != null">and UPTM = #{uptm}</if>
  101. <if test="state != null and state != ''">and STATE = #{state}</if>
  102. <if test="groupId != null and groupId != ''">and GROUP_ID = #{groupId}</if>
  103. <if test="province != null and province != ''">and PROVINCE like '%${province}%'</if>
  104. </trim>
  105. </sql>
  106. <select id="get" resultMap="attJskejianWaterRgstrResultMap" parameterType="String" >
  107. select <include refid="table_columns" /> from ATT_JSKEJIAN_WATER_RGSTR where ID = #{id}
  108. </select>
  109. <select id="getBy" resultMap="attJskejianWaterRgstrResultMap">
  110. select <include refid="table_columns" /> from ATT_JSKEJIAN_WATER_RGSTR <include refid="page_where" />
  111. </select>
  112. <select id="findAll" resultMap="attJskejianWaterRgstrResultMap">
  113. select <include refid="table_columns" /> from ATT_JSKEJIAN_WATER_RGSTR
  114. </select>
  115. <select id="findList" resultMap="attJskejianWaterRgstrResultMap">
  116. select <include refid="table_columns" /> from ATT_JSKEJIAN_WATER_RGSTR <include refid="page_where" />
  117. </select>
  118. <select id="selectCount" resultType="int" >
  119. select count(ID) from ATT_JSKEJIAN_WATER_RGSTR <include refid="page_where" />
  120. </select>
  121. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.AttJskejianWaterRgstr">
  122. insert into ATT_JSKEJIAN_WATER_RGSTR( <include refid="table_columns" /> )
  123. values ( <include refid="entity_properties" /> )
  124. </insert>
  125. <delete id="delete" parameterType="java.lang.String">
  126. delete from ATT_JSKEJIAN_WATER_RGSTR where ID = #{id}
  127. </delete>
  128. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.AttJskejianWaterRgstr">
  129. delete from ATT_JSKEJIAN_WATER_RGSTR <include refid="page_where" />
  130. </delete>
  131. <update id="deleteInFlag" parameterType="java.lang.String">
  132. update ATT_JSKEJIAN_WATER_RGSTR set flag_valid = 0 where ID = #{id}
  133. </update>
  134. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.AttJskejianWaterRgstr">
  135. update ATT_JSKEJIAN_WATER_RGSTR
  136. <trim prefix="set" suffixOverrides=",">
  137. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  138. <if test="name != null and name != ''">NAME = #{name},</if>
  139. <if test="rvReaLkName != null and rvReaLkName != ''">RV_REA_LK_NAME = #{rvReaLkName},</if>
  140. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  141. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  142. <if test="location != null and location != ''">LOCATION = #{location},</if>
  143. <if test="aerialPoint != null and aerialPoint != ''">AERIAL_POINT = #{aerialPoint},</if>
  144. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  145. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  146. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  147. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  148. <if test="pblmType != null and pblmType != ''">PBLM_TYPE = #{pblmType},</if>
  149. <if test="pblmDesc != null and pblmDesc != ''">PBLM_DESC = #{pblmDesc},</if>
  150. <if test="rectConc != null and rectConc != ''">RECT_CONC = #{rectConc},</if>
  151. <if test="reviConc != null and reviConc != ''">REVI_CONC = #{reviConc},</if>
  152. <if test="reviOpin != null and reviOpin != ''">REVI_OPIN = #{reviOpin},</if>
  153. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  154. <if test="intm != null">INTM = #{intm},</if>
  155. <if test="uptm != null">UPTM = #{uptm},</if>
  156. <if test="state != null and state != ''">STATE = #{state},</if>
  157. <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
  158. <if test="province != null and province != ''">PROVINCE = #{province},</if>
  159. </trim>
  160. <where>ID = #{id}</where>
  161. </update>
  162. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.AttJskejianWaterRgstr">
  163. update ATT_JSKEJIAN_WATER_RGSTR
  164. <trim prefix="set" suffixOverrides=",">
  165. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  166. <if test="name != null and name != ''">NAME = #{name},</if>
  167. <if test="rvReaLkName != null and rvReaLkName != ''">RV_REA_LK_NAME = #{rvReaLkName},</if>
  168. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  169. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  170. <if test="location != null and location != ''">LOCATION = #{location},</if>
  171. <if test="aerialPoint != null and aerialPoint != ''">AERIAL_POINT = #{aerialPoint},</if>
  172. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  173. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  174. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  175. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  176. <if test="pblmType != null and pblmType != ''">PBLM_TYPE = #{pblmType},</if>
  177. <if test="pblmDesc != null and pblmDesc != ''">PBLM_DESC = #{pblmDesc},</if>
  178. <if test="rectConc != null and rectConc != ''">RECT_CONC = #{rectConc},</if>
  179. <if test="reviConc != null and reviConc != ''">REVI_CONC = #{reviConc},</if>
  180. <if test="reviOpin != null and reviOpin != ''">REVI_OPIN = #{reviOpin},</if>
  181. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  182. <if test="intm != null">INTM = #{intm},</if>
  183. <if test="uptm != null">UPTM = #{uptm},</if>
  184. <if test="state != null and state != ''">STATE = #{state},</if>
  185. <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
  186. <if test="province != null and province != ''">PROVINCE = #{province},</if>
  187. </trim>
  188. <include refid="page_where" />
  189. </update>
  190. <!-- 其他自定义SQL -->
  191. <select id="getListJSWAByInspGroupIdObjType" parameterType="cn.com.goldenwater.dcproj.param.PagePersObjParam"
  192. resultType="cn.com.goldenwater.dcproj.model.AttJskejianWaterRgstr">
  193. select t.*,C.id groupId,C.PNM groupName,B.obj_id
  194. from ATT_JSKEJIAN_WATER_BASE t
  195. left join BIS_INSP_ALL_OBJ B
  196. on B.CODE = t.ID
  197. LEFT JOIN BIS_INSP_ALL C ON B.ID = C.ID
  198. and B.ptype = #{objType}
  199. where 1 = 1
  200. <if test="wtdstNm !=null and wtdstNm !=''">
  201. and b.nm like '%${wtdstNm}%'
  202. </if>
  203. <if test='isAll == "0"'>and B.ID = #{inspGroupId}</if>
  204. <if test='isAll == "1"'>and B.ID LIKE '${inspGroupId}%'</if>
  205. <if test="adCode != null and adCode != ''">
  206. and t.AD_CODE like '${adCode}%'
  207. </if>
  208. <choose>
  209. <when test="province != null and province != ''">
  210. and B.AD_CODE LIKE '${province}%'
  211. </when>
  212. <otherwise>
  213. and B.AD_CODE is null
  214. </otherwise>
  215. </choose>
  216. </select>
  217. <sql id="choseSql">
  218. <choose>
  219. <when test="province !=null and province !=''">
  220. and A.AD_Code like '${province}%'
  221. </when>
  222. <otherwise>
  223. and A.AD_CODE is null
  224. </otherwise>
  225. </choose>
  226. </sql>
  227. <sql id="orgIdSql">
  228. <choose>
  229. <when test="orgId !=null and orgId !=''">
  230. and ORG_ID like '${orgId}%'
  231. </when>
  232. <otherwise>
  233. and ORG_ID is null
  234. </otherwise>
  235. </choose>
  236. </sql>
  237. <select id="findJsWaPage" parameterType="cn.com.goldenwater.dcproj.param.TypeParam" resultType="cn.com.goldenwater.dcproj.dto.BisInspRgstrDto">
  238. select * from (
  239. select A.*,b.id as rgstrId,CASE WHEN B.STATE IS NULL THEN '0' ELSE B.STATE END AS state,(case when b.name is
  240. null then to_char(c.name) else b.name end) as name,b.pblm_type as type,b.intm as IN_TM,b.uptm as Up_tm,
  241. c.id as baseId,b.pblm_desc,
  242. (case when b.rect_conc='1' then '已整改' when b.rect_conc='2' then '未整改' else '' end) as rect_conc,
  243. (case when b.location is null then c.location else b.location end) as location,ia.pnm groupName,ria.pnm
  244. riverName,ad.ad_full_name as ad_name from BIS_INSP_ALL_OBJ A join ATT_JSKEJIAN_WATER_RGSTR B on A.Obj_Id
  245. = B.Obj_Id left join ATT_JSKEJIAN_WATER_BASE c on a.code = c.id
  246. left join ATT_AD_X_BASE ad on b.ad_code = ad.ad_code LEFT JOIN BIS_INSP_ALL ia on A.ID = ia.id
  247. left join BIS_INSP_ALL ria on substr(A.ID,0,6) = ria.id
  248. where 1 = 1
  249. <include refid="choseSql"/>
  250. <if test="adName != null and adName != ''">and ad.AD_FULL_NAME LIKE '%${adName}%'</if>
  251. <if test="groupId != null and groupId != ''">and A.id = #{groupId}</if>
  252. <if test="adCode != null and adCode !=''">and B.AD_CODE like '${adCode}%'</if>
  253. <if test="plnaId !=null and plnaId !=''">
  254. and A.id like '${plnaId}%'
  255. </if>
  256. <if test="orgId != null and orgId !=''">and A.org_id = #{orgId}</if>
  257. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  258. AND B.intm &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND B.uptm &lt; TO_DATE(#{entm},'YYYY-MM-DD')+1
  259. </if>
  260. and
  261. REGEXP_LIKE(
  262. A.Id,'^('||
  263. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{presId}
  264. <include refid="orgIdSql"/>
  265. )>0 then
  266. (SELECT LISTAGG(id, '|') as
  267. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{presId}
  268. <include refid="orgIdSql"/> GROUP BY PERSID
  269. )
  270. else (select 'non' from dual) end)
  271. ||')')
  272. ) where 1 = 1
  273. <if test="state != null and state != ''">
  274. and state in (${state})
  275. </if>
  276. <if test="name != null and name != ''">
  277. and name like '%${name}%'
  278. </if>
  279. </select>
  280. <select id="findPcJsWaPage" resultType="cn.com.goldenwater.dcproj.dto.AttJskejianWaterRgstrDto"
  281. parameterType="cn.com.goldenwater.dcproj.param.AttJskejianWaterRgstrParam">
  282. select * from (
  283. select A.*,b.id as rgstrId,CASE WHEN B.STATE IS NULL THEN '0' ELSE B.STATE END AS state,(case when b.name is
  284. null then to_char(c.name) else b.name end) as name,b.pblm_type ,b.intm,b.uptm,
  285. c.id as baseId,b.pblm_desc,
  286. b.rect_conc,b.revi_conc,
  287. (case when b.CENTER_X is null then c.CENTER_X else b.CENTER_X end) as centerX,
  288. (case when b.CENTER_Y is null then c.CENTER_Y else b.CENTER_Y end) as centerY,
  289. (case when b.location is null then c.location else b.location end) as location,ia.pnm groupName,ria.pnm
  290. riverName,ad.ad_full_name from BIS_INSP_ALL_OBJ A join ATT_JSKEJIAN_WATER_RGSTR B on A.Obj_Id
  291. = B.Obj_Id left join ATT_JSKEJIAN_WATER_BASE c on a.code = c.id
  292. left join ATT_AD_X_BASE ad on b.ad_code = ad.ad_code LEFT JOIN BIS_INSP_ALL ia on A.ID = ia.id
  293. left join BIS_INSP_ALL ria on substr(A.ID,0,6) = ria.id
  294. where 1 = 1
  295. <if test="tabType =='2'.toString()">
  296. and ria.entm &lt;to_date(#{nowTime},'yyyy-MM-dd')+1
  297. </if>
  298. <if test="tabType =='1'.toString()">
  299. and ria.entm &gt;=to_date(#{nowTime},'yyyy-MM-dd')
  300. </if>
  301. <include refid="choseSql"/>
  302. <if test="adName != null and adName != ''">and ad.AD_FULL_NAME LIKE '%${adName}%'</if>
  303. <if test="groupId != null and groupId != ''">and A.id = #{groupId}</if>
  304. <if test="orgId != null and orgId !=''">and A.org_id =#{orgId}</if>
  305. <if test="adCode != null and adCode !=''">and B.AD_CODE like '${adCode}%'</if>
  306. <if test="plnaId !=null and plnaId !=''">
  307. and A.id like '${plnaId}%'
  308. </if>
  309. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  310. AND B.INTM &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND B.UPTM &lt; TO_DATE(#{entm},'YYYY-MM-DD')+1
  311. </if>
  312. and
  313. REGEXP_LIKE(
  314. A.Id,'^('||
  315. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  316. <include refid="orgIdSql"/>
  317. )>0 then
  318. (SELECT LISTAGG(id, '|') as
  319. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  320. <include refid="orgIdSql"/> GROUP BY PERSID
  321. )
  322. else (select 'non' from dual) end)
  323. ||')')
  324. ) where 1 = 1
  325. <if test="state != null and state != ''">
  326. and state in (${state})
  327. </if>
  328. <if test="name != null and name != ''">
  329. and name like '%${name}%'
  330. </if>
  331. </select>
  332. </mapper>