9e83bad92be6b7e19fca2601824b7bfddb29d260.svn-base 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397
  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.BisInspOtherPblmDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspOtherPblm" id="bisInspOtherPblmResultMap">
  5. <result property="name" column="NAME"/>
  6. <result property="type" column="TYPE"/>
  7. <result property="admOrg" column="ADM_ORG"/>
  8. <result property="basName" column="BAS_NAME"/>
  9. <result property="province" column="PROVINCE"/>
  10. <result property="city" column="CITY"/>
  11. <result property="country" column="COUNTRY"/>
  12. <result property="groupName" column="GROUP_NAME"/>
  13. <result property="persId" column="PERS_ID"/>
  14. <result property="persName" column="PERS_NAME"/>
  15. <result property="groupId" column="GROUP_ID"/>
  16. <result property="inTm" column="IN_TM"/>
  17. <result property="upTm" column="UP_TM"/>
  18. <result property="id" column="ID"/>
  19. <result property="rgstrId" column="RGSTR_ID"/>
  20. <result property="aUnit" column="A_UNIT"/>
  21. <result property="pblmNum" column="PBLM_NUM"/>
  22. <result property="pblmIsTrue" column="PBLM_IS_TRUE"/>
  23. <result property="rectConc" column="RECT_CONC"/>
  24. <result property="rectMeas" column="RECT_MEAS"/>
  25. <result property="fdTm" column="FD_TM"/>
  26. <result property="rectLead" column="RECT_LEAD"/>
  27. <result property="rectMemb" column="RECT_MEMB"/>
  28. <result property="rectTm" column="RECT_TM"/>
  29. <result property="note" column="NOTE"/>
  30. <result property="dataStat" column="DATA_STAT"/>
  31. </resultMap>
  32. <sql id="table_columns">
  33. PERS_ID,
  34. GROUP_ID,
  35. IN_TM,
  36. UP_TM,
  37. ID,
  38. RGSTR_ID,
  39. A_UNIT,
  40. PBLM_NUM,
  41. PBLM_IS_TRUE,
  42. RECT_CONC,
  43. RECT_MEAS,
  44. FD_TM,
  45. RECT_LEAD,
  46. RECT_MEMB,
  47. RECT_TM,
  48. NOTE,
  49. DATA_STAT
  50. </sql>
  51. <sql id="entity_properties">
  52. #{persId},
  53. #{groupId},
  54. #{inTm},
  55. #{upTm},
  56. #{id},
  57. #{rgstrId},
  58. #{aUnit},
  59. #{pblmNum},
  60. #{pblmIsTrue},
  61. #{rectConc},
  62. #{rectMeas},
  63. #{fdTm},
  64. #{rectLead},
  65. #{rectMemb},
  66. #{rectTm},
  67. #{note},
  68. #{dataStat}
  69. </sql>
  70. <sql id="entity_properties_item">
  71. #{item.persId},
  72. #{item.groupId},
  73. #{item.inTm},
  74. #{item.upTm},
  75. #{item.id},
  76. #{item.rgstrId},
  77. #{item.aUnit},
  78. #{item.pblmNum},
  79. #{item.pblmIsTrue},
  80. #{item.rectConc},
  81. #{item.rectMeas},
  82. #{item.fdTm},
  83. #{item.rectLead},
  84. #{item.rectMemb},
  85. #{item.rectTm},
  86. #{item.note},
  87. #{item.dataStat}
  88. </sql>
  89. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  90. <sql id="page_where">
  91. <trim prefix="where" prefixOverrides="and | or ">
  92. <if test="groupId != null and groupId != ''">and GROUP_ID = #{groupId}</if>
  93. <if test="inTm != null">and IN_TM = #{inTm}</if>
  94. <if test="upTm != null">and UP_TM = #{upTm}</if>
  95. <if test="id != null and id != ''">and ID = #{id}</if>
  96. <if test="rgstrId != null and rgstrId != ''">and RGSTR_ID = #{rgstrId}</if>
  97. <if test="aUnit != null and aUnit != ''">and A_UNIT = #{aUnit}</if>
  98. <if test="pblmNum != null and pblmNum != ''">and PBLM_NUM = #{pblmNum}</if>
  99. <if test="pblmIsTrue != null and pblmIsTrue != ''">and PBLM_IS_TRUE = #{pblmIsTrue}</if>
  100. <if test="rectConc != null and rectConc != ''">and RECT_CONC = #{rectConc}</if>
  101. <if test="rectMeas != null and rectMeas != ''">and RECT_MEAS = #{rectMeas}</if>
  102. <if test="fdTm != null">and FD_TM = #{fdTm}</if>
  103. <if test="rectLead != null and rectLead != ''">and RECT_LEAD = #{rectLead}</if>
  104. <if test="rectMemb != null and rectMemb != ''">and RECT_MEMB = #{rectMemb}</if>
  105. <if test="rectTm != null">and RECT_TM = #{rectTm}</if>
  106. <if test="note != null and note != ''">and NOTE = #{note}</if>
  107. <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
  108. </trim>
  109. </sql>
  110. <select id="get" resultMap="bisInspOtherPblmResultMap" parameterType="String">
  111. select
  112. <include refid="table_columns"/>
  113. from BIS_INSP_OTHER_PBLM where ID = #{id}
  114. </select>
  115. <select id="getBy" resultMap="bisInspOtherPblmResultMap">
  116. select
  117. <include refid="table_columns"/>
  118. from BIS_INSP_OTHER_PBLM
  119. <include refid="page_where"/>
  120. </select>
  121. <select id="findAll" resultMap="bisInspOtherPblmResultMap">
  122. select
  123. <include refid="table_columns"/>
  124. from BIS_INSP_OTHER_PBLM
  125. </select>
  126. <select id="findList" resultMap="bisInspOtherPblmResultMap">
  127. select
  128. <include refid="table_columns"/>
  129. from BIS_INSP_OTHER_PBLM
  130. <include refid="page_where"/>
  131. </select>
  132. <select id="selectCount" resultType="int">
  133. select count(ID) from BIS_INSP_OTHER_PBLM
  134. <include refid="page_where"/>
  135. </select>
  136. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspOtherPblm">
  137. insert into BIS_INSP_OTHER_PBLM(
  138. <include refid="table_columns"/>
  139. )
  140. values (
  141. <include refid="entity_properties"/>
  142. )
  143. </insert>
  144. <delete id="delete" parameterType="java.lang.String">
  145. delete from BIS_INSP_OTHER_PBLM where ID = #{id}
  146. </delete>
  147. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspOtherPblm">
  148. delete from BIS_INSP_OTHER_PBLM
  149. <include refid="page_where"/>
  150. </delete>
  151. <update id="deleteInFlag" parameterType="java.lang.String">
  152. update BIS_INSP_OTHER_PBLM set flag_valid = 0 where ID = #{id}
  153. </update>
  154. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspOtherPblm">
  155. update BIS_INSP_OTHER_PBLM
  156. <trim prefix="set" suffixOverrides=",">
  157. <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
  158. <if test="inTm != null">IN_TM = #{inTm},</if>
  159. <if test="upTm != null">UP_TM = #{upTm},</if>
  160. <if test="id != null and id != ''">ID = #{id},</if>
  161. <if test="rgstrId != null and rgstrId != ''">RGSTR_ID = #{rgstrId},</if>
  162. <if test="aUnit != null and aUnit != ''">A_UNIT = #{aUnit},</if>
  163. <if test="pblmNum != null and pblmNum != ''">PBLM_NUM = #{pblmNum},</if>
  164. <if test="pblmIsTrue != null and pblmIsTrue != ''">PBLM_IS_TRUE = #{pblmIsTrue},</if>
  165. <if test="rectConc != null and rectConc != ''">RECT_CONC = #{rectConc},</if>
  166. <if test="rectMeas != null and rectMeas != ''">RECT_MEAS = #{rectMeas},</if>
  167. <if test="fdTm != null">FD_TM = #{fdTm},</if>
  168. <if test="rectLead != null and rectLead != ''">RECT_LEAD = #{rectLead},</if>
  169. <if test="rectMemb != null and rectMemb != ''">RECT_MEMB = #{rectMemb},</if>
  170. <if test="rectTm != null">RECT_TM = #{rectTm},</if>
  171. <if test="note != null and note != ''">NOTE = #{note},</if>
  172. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  173. </trim>
  174. <where>ID = #{id}</where>
  175. </update>
  176. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspOtherPblm">
  177. update BIS_INSP_OTHER_PBLM
  178. <trim prefix="set" suffixOverrides=",">
  179. <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
  180. <if test="inTm != null">IN_TM = #{inTm},</if>
  181. <if test="upTm != null">UP_TM = #{upTm},</if>
  182. <if test="id != null and id != ''">ID = #{id},</if>
  183. <if test="rgstrId != null and rgstrId != ''">RGSTR_ID = #{rgstrId},</if>
  184. <if test="aUnit != null and aUnit != ''">A_UNIT = #{aUnit},</if>
  185. <if test="pblmNum != null and pblmNum != ''">PBLM_NUM = #{pblmNum},</if>
  186. <if test="pblmIsTrue != null and pblmIsTrue != ''">PBLM_IS_TRUE = #{pblmIsTrue},</if>
  187. <if test="rectConc != null and rectConc != ''">RECT_CONC = #{rectConc},</if>
  188. <if test="rectMeas != null and rectMeas != ''">RECT_MEAS = #{rectMeas},</if>
  189. <if test="fdTm != null">FD_TM = #{fdTm},</if>
  190. <if test="rectLead != null and rectLead != ''">RECT_LEAD = #{rectLead},</if>
  191. <if test="rectMemb != null and rectMemb != ''">RECT_MEMB = #{rectMemb},</if>
  192. <if test="rectTm != null">RECT_TM = #{rectTm},</if>
  193. <if test="note != null and note != ''">NOTE = #{note},</if>
  194. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  195. </trim>
  196. <include refid="page_where"/>
  197. </update>
  198. <!-- 其他自定义SQL -->
  199. <insert id="insertList" parameterType="java.util.List" useGeneratedKeys="false">
  200. insert into BIS_INSP_OTHER_PBLM(
  201. <include refid="table_columns"/>
  202. )
  203. select t.* from (
  204. <foreach collection="list" item="item" index="index" separator="union all">
  205. select
  206. <include refid="entity_properties_item"/>
  207. from dual
  208. </foreach>
  209. ) t
  210. </insert>
  211. <sql id="choseSql">
  212. <choose>
  213. <when test="province !=null and province !=''">
  214. and ad_code like '${province}%'
  215. </when>
  216. <otherwise>
  217. and ad_code is null
  218. </otherwise>
  219. </choose>
  220. </sql>
  221. <select id="findPblmList" parameterType="cn.com.goldenwater.dcproj.param.FileParam"
  222. resultType="cn.com.goldenwater.dcproj.dto.BisInspOtherPblmDto">
  223. select x.id as groupObjId,x.name,x.ad_full_name,x.riverName,x.type,x.adm_org org,p.* from (
  224. select * from (
  225. select A.*,b.id as rgstrId,CASE WHEN B.STATE IS NULL THEN '0' ELSE B.STATE END AS fscState,(case when b.name is
  226. null then to_char(c.name) else b.name end) as name,b.type,b.IN_TM,b.UP_TM,
  227. c.id as baseId,b.adm_org,
  228. (case when b.location is null then c.location else b.location end) as location,ia.pnm groupName,ria.pnm
  229. riverName,ad.ad_full_name from BIS_INSP_ALL_OBJ A
  230. join BIS_INSP_Other_RGSTR B on A.Obj_Id = B.Obj_Id left join
  231. att_other_base c on a.code = c.id
  232. 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
  233. left join BIS_INSP_ALL ria on substr(A.ID,0,6) = ria.id
  234. where 1 = 1
  235. <if test="adName != null and adName != ''">and ad.AD_FULL_NAME LIKE '%${adName}%'</if>
  236. <if test="groupId != null and groupId != ''">and A.id = #{groupId}</if>
  237. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  238. AND B.IN_TM &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND B.UP_TM &lt; TO_DATE(#{entm},'YYYY-MM-DD')+1
  239. </if>
  240. and
  241. REGEXP_LIKE(
  242. A.Id,'^('||
  243. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId} AND ID LIKE '010%'
  244. <include refid="choseSql"/>
  245. )>0 then
  246. (SELECT LISTAGG(id, '|') as
  247. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId} AND ID LIKE '010%'
  248. <include refid="choseSql"/> GROUP BY PERSID
  249. )
  250. else (select 'non' from dual) end)
  251. ||')')
  252. ) where 1 = 1
  253. <if test="state != null and state != ''">
  254. and fscState in (${state})
  255. </if>
  256. <if test="name != null and name != ''">
  257. and name like '%${name}%'
  258. </if>
  259. ) x left join BIS_INSP_Other_PBLM p on x.rgstrId = p.rgstr_id
  260. </select>
  261. <select id="findPageList" resultMap="bisInspOtherPblmResultMap">
  262. SELECT B.NAME,
  263. B.TYPE,
  264. B.ADM_ORG,
  265. H.BAS_NAME,
  266. G.AD_NAME AS PROVINCE,
  267. F.AD_NAME AS CITY,
  268. E.AD_NAME AS COUNTRY,
  269. D.ID AS GROUP_ID,
  270. D.PNM AS GROUP_NAME,
  271. J.PERS_NAME,
  272. A.PERS_ID,
  273. A.IN_TM,
  274. A.UP_TM,
  275. A.ID,
  276. A.RGSTR_ID,
  277. A.A_UNIT,
  278. A.PBLM_NUM,
  279. A.PBLM_IS_TRUE,
  280. A.RECT_CONC,
  281. A.RECT_MEAS,
  282. A.FD_TM,
  283. A.RECT_LEAD,
  284. A.RECT_MEMB,
  285. A.RECT_TM,
  286. A.NOTE,
  287. A.DATA_STAT
  288. FROM BIS_INSP_OTHER_PBLM A
  289. LEFT JOIN BIS_INSP_OTHER_RGSTR B
  290. ON A.RGSTR_ID = B.ID
  291. LEFT JOIN BIS_INSP_ALL_OBJ C
  292. ON B.OBJ_ID = C.OBJ_ID
  293. LEFT JOIN BIS_INSP_ALL D
  294. ON C.ID = D.ID
  295. LEFT JOIN ATT_AD_X_BASE E
  296. ON B.AD_CODE = E.AD_CODE
  297. AND E.AD_GRAD = '4'
  298. LEFT JOIN ATT_AD_X_BASE F
  299. ON CONCAT(SUBSTR(B.AD_CODE, 0, 4), '00000000') = F.AD_CODE
  300. AND F.AD_GRAD = '3'
  301. LEFT JOIN ATT_AD_X_BASE G
  302. ON CONCAT(SUBSTR(B.AD_CODE, 0, 2), '0000000000') = G.AD_CODE
  303. AND G.AD_GRAD = '2'
  304. LEFT JOIN ATT_BAS_BASE H
  305. ON B.ADM_ORG = H.BAS_CODE
  306. LEFT JOIN BIS_INSP_ALL_RLATION_PERS J
  307. ON A.PERS_ID = J.GUID
  308. <trim prefix="where" prefixOverrides="and | or ">
  309. 1=1
  310. <if test="inTm != null">and A.IN_TM = #{inTm}</if>
  311. <if test="upTm != null">and A.UP_TM = #{upTm}</if>
  312. <if test="id != null and id != ''">and A.ID = #{id}</if>
  313. <if test="rgstrId != null and rgstrId != ''">and A.RGSTR_ID = #{rgstrId}</if>
  314. <if test="aUnit != null and aUnit != ''">and A.A_UNIT LIKE CONCAT('%',CONCAT(#{aUnit},'%')) </if>
  315. <if test="pblmNum != null and pblmNum != ''">and A.PBLM_NUM = #{pblmNum}</if>
  316. <if test="pblmIsTrue != null and pblmIsTrue != ''">and A.PBLM_IS_TRUE = #{pblmIsTrue}</if>
  317. <if test="rectConc != null and rectConc != ''">and A.RECT_CONC LIKE CONCAT('%',CONCAT(#{rectConc},'%')) </if>
  318. <if test="rectMeas != null and rectMeas != ''">and A.RECT_MEAS LIKE CONCAT('%',CONCAT(#{rectMeas},'%')) </if>
  319. <if test="fdTm != null">and A.FD_TM = #{fdTm}</if>
  320. <if test="rectLead != null and rectLead != ''">and A.RECT_LEAD LIKE CONCAT('%',CONCAT(#{rectLead},'%')) </if>
  321. <if test="rectMemb != null and rectMemb != ''">and A.RECT_MEMB LIKE CONCAT('%',CONCAT(#{rectMemb},'%')) </if>
  322. <if test="rectTm != null">and A.RECT_TM = #{rectTm}</if>
  323. <if test="note != null and note != ''">and A.NOTE = #{note}</if>
  324. <if test="dataStat != null and dataStat != ''">and A.DATA_STAT = #{dataStat}</if>
  325. <if test="groupId != null and groupId != ''">and D.ID = #{groupId}</if>
  326. <if test="orgIds != null and orgIds != ''">and D.ID IN
  327. <foreach item="item" index="index" collection="orgIds.split(',')" open="(" separator="," close=")">
  328. '${item}'
  329. </foreach>
  330. </if>
  331. <if test="adCode != null and adCode != ''">and B.AD_CODE LIKE CONCAT(#{adCode},'%')</if>
  332. <if test="adName != null and adName != ''">and E.AD_FULL_NAME LIKE CONCAT('%',CONCAT(#{adName},'%'))</if>
  333. <if test="startTime != null">
  334. <if test='tmType =="1" or tmType =="" or tmType ==null'>
  335. and A.FD_TM &gt;= #{startTime}
  336. </if>
  337. <if test='tmType =="2"'>
  338. and A.RECT_TM &gt;= #{startTime}
  339. </if>
  340. </if>
  341. <if test="endTime != null">
  342. <if test='tmType =="1" or tmType =="" or tmType ==null'>
  343. and A.FD_TM &lt;= #{endTime}
  344. </if>
  345. <if test='tmType =="2"'>
  346. and A.RECT_TM &lt;= #{endTime}
  347. </if>
  348. </if>
  349. <if test="persId != null and persId != ''">and
  350. REGEXP_LIKE(
  351. D.Id,'^('||
  352. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  353. AND ID LIKE '010%'
  354. <include refid="choseSql"/>
  355. )>0 then
  356. (SELECT LISTAGG(id, '|') as
  357. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  358. AND ID LIKE '010%'
  359. <include refid="choseSql"/> GROUP BY PERSID
  360. )
  361. else (select 'non' from dual) end)
  362. ||')')
  363. </if>
  364. <if test="persName != null and persName != ''">
  365. AND J.PERS_NAME LIKE CONCAT('%',CONCAT(#{persName},'%'))
  366. </if>
  367. <if test="name != null and name != ''">and B.NAME LIKE CONCAT('%',CONCAT(#{name},'%'))</if>
  368. <if test="groupName != null and groupName != ''">and D.PNM LIKE CONCAT('%',CONCAT(#{groupName},'%'))</if>
  369. </trim>
  370. </select>
  371. </mapper>