BisInspRsvrRgstrDao.xml 31 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599
  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.BisInspRsvrRgstrDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspRsvrRgstr" id="bisInspRsvrRgstrResultMap">
  5. <result property="rgstrId" column="RGSTR_ID"/>
  6. <result property="objId" column="OBJ_ID"/>
  7. <result property="rsvrNm" column="RSVR_NM"/>
  8. <result property="adCode" column="AD_CODE"/>
  9. <result property="resCreateTime" column="RES_CREATE_TIME"/>
  10. <result property="engScal" column="ENG_SCAL"/>
  11. <result property="hystSite" column="HYST_SITE"/>
  12. <result property="totCap" column="TOT_CAP"/>
  13. <result property="damRegCode" column="DAM_REG_CODE"/>
  14. <result property="damType" column="DAM_TYPE"/>
  15. <result property="hasDamRegCode" column="HAS_DAM_REG_CODE"/>
  16. <result property="resCreateTimeNote" column="RES_CREATE_TIME_NOTE"/>
  17. <result property="engScalNote" column="ENG_SCAL_NOTE"/>
  18. <result property="state" column="STATE"/>
  19. <result property="groupLeader" column="GROUP_LEADER"/>
  20. <result property="groupLeaderTel" column="GROUP_LEADER_TEL"/>
  21. <result property="recPersId" column="REC_PERS_ID"/>
  22. <result property="recPers" column="REC_PERS"/>
  23. <result property="recPersTel" column="REC_PERS_TEL"/>
  24. <result property="uptm" column="UPTM"/>
  25. <result property="intm" column="INTM"/>
  26. <result property="note" column="NOTE"/>
  27. <result property="dataStat" column="DATA_STAT"/>
  28. <result property="dataStat" column="DATA_STAT"/>
  29. <result property="rsvrLong" column="RSVR_LONG"/>
  30. <result property="rsvrLat" column="RSVR_LAT"/>
  31. <result property="baseStat" column="BASE_STAT"/>
  32. <result property="viewStat" column="VIEW_STAT"/>
  33. <result property="presStat" column="PRES_STAT"/>
  34. <result property="benefitStat" column="BENEFIT_STAT"/>
  35. <result property="resRunStat" column="RES_RUN_STAT"/>
  36. <result property="damMaxHigh" column="DAM_MAX_HIGH"/>
  37. <result property="rsCode" column="RS_CODE"/>
  38. <result property="liaisonManTel" column="liaison_Man_Tel"/>
  39. <result property="liaisonMan" column="liaison_Man"/>
  40. <result property="rsvrAdmName" column="rsvr_adm_name"/>
  41. <result property="compDateStr" column="COMP_DATE_STR"/>
  42. <result property="reverStat" column="REVER_STAT"/>
  43. <result property="location" column="location"/>
  44. <result property="rsClass" column="RS_CLASS"/>
  45. <result property="impdDt" column="IMPD_DT"/>
  46. <result property="rnfcImpdDt" column="RNFC_IMPD_DT"/>
  47. <result property="desFlStag" column="DES_FL_STAG"/>
  48. <result property="flConTopStag" column="FL_CON_TOP_STAG"/>
  49. <result property="reinStat" column="REIN_STAT"/>
  50. <result property="damStat" column="DAM_STAT"/>
  51. <result property="safeStat" column="SAFE_STAT"/>
  52. <result property="orgId" column="ORG_ID"/>
  53. <result property="normz" column="NORMZ"/>
  54. <result property="fsltdz" column="FSLTDZ"/>
  55. <result property="chkInfoStat" column="CHK_INFO_STAT"/>
  56. <result property="rectStat" column="RECT_STAT"/>
  57. <result property="inspType" column="INSP_TYPE"/>
  58. <result property="isAction" column="IS_ACTION"/>
  59. <result property="isSaf" column="IS_SAF"/>
  60. <result property="isSite" column="IS_SITE"/>
  61. <result property="dutyDep" column="DUTY_DEP"/>
  62. </resultMap>
  63. <sql id="table_columns">
  64. RGSTR_ID,ORG_ID,
  65. OBJ_ID,
  66. RSVR_NM,
  67. AD_CODE,
  68. RES_CREATE_TIME,
  69. ENG_SCAL,
  70. NORMZ,
  71. FSLTDZ,
  72. HYST_SITE,
  73. TOT_CAP,
  74. DAM_REG_CODE,
  75. DAM_TYPE,
  76. HAS_DAM_REG_CODE,
  77. RES_CREATE_TIME_NOTE,
  78. ENG_SCAL_NOTE,
  79. STATE,
  80. GROUP_LEADER,
  81. GROUP_LEADER_TEL,
  82. REC_PERS_ID,
  83. REC_PERS,
  84. REC_PERS_TEL,
  85. UPTM,
  86. INTM,
  87. NOTE,
  88. DATA_STAT,
  89. RSVR_LONG,
  90. RSVR_LAT,RES_RUN_STAT,PRES_STAT,VIEW_STAT,BASE_STAT,DAM_MAX_HIGH,RS_CODE,liaison_Man_Tel,liaison_Man,rsvr_adm_name,COMP_DATE_STR,REVER_STAT
  91. ,location,BENEFIT_STAT,SAFE_STAT,
  92. RS_CLASS,
  93. IMPD_DT,
  94. RNFC_IMPD_DT,
  95. DES_FL_STAG,
  96. FL_CON_TOP_STAG,
  97. REIN_STAT,
  98. CHK_INFO_STAT,
  99. RECT_STAT,
  100. DAM_STAT, INSP_TYPE, IS_ACTION, IS_SAF, IS_SITE, DUTY_DEP
  101. </sql>
  102. <sql id="entity_properties">
  103. #{rgstrId},#{orgId},
  104. #{objId},
  105. #{rsvrNm},
  106. #{adCode},
  107. #{resCreateTime},
  108. #{engScal},
  109. #{normz},
  110. #{fsltdz},
  111. #{hystSite},
  112. #{totCap},
  113. #{damRegCode},
  114. #{damType},
  115. #{hasDamRegCode},
  116. #{resCreateTimeNote},
  117. #{engScalNote},
  118. #{state},
  119. #{groupLeader},
  120. #{groupLeaderTel},
  121. #{recPersId},
  122. #{recPers},
  123. #{recPersTel},
  124. #{uptm},
  125. #{intm},
  126. #{note},
  127. #{dataStat},
  128. #{rsvrLong},
  129. #{rsvrLat},#{resRunStat},#{presStat},#{viewStat},#{baseStat},#{damMaxHigh},#{rsCode},#{liaisonManTel},#{liaisonMan},#{rsvrAdmName},#{compDateStr}
  130. ,#{reverStat},#{location},#{benefitStat},#{safeStat},
  131. #{rsClass},
  132. #{impdDt},
  133. #{rnfcImpdDt},
  134. #{desFlStag},
  135. #{flConTopStag},
  136. #{reinStat},
  137. #{chkInfoStat},
  138. #{rectStat},
  139. #{damStat},#{inspType},#{isAction},#{isSaf},#{isSite},#{dutyDep}
  140. </sql>
  141. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  142. <sql id="page_where">
  143. <trim prefix="where" prefixOverrides="and | or ">
  144. <if test="dutyDep != null and dutyDep != ''">and DUTY_DEP = #{dutyDep}</if>
  145. <if test="isSite != null and isSite != ''">and IS_SITE = #{isSite}</if>
  146. <if test="isAction != null and isAction != ''">and IS_ACTION = #{isAction}</if>
  147. <if test="isSaf != null and isSaf != ''">and IS_SAF = #{isSaf}</if>
  148. <if test="inspType != null and inspType != ''">and INSP_TYPE = #{inspType}</if>
  149. <if test="objId != null and objId != ''">and OBJ_ID = #{objId}</if>
  150. <if test="damMaxHigh != null and damMaxHigh != ''">and DAM_MAX_HIGH = #{damMaxHigh}</if>
  151. <if test="rsvrNm != null and rsvrNm != ''">and RSVR_NM LIKE '%'||#{rsvrNm}||'%'</if>
  152. <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
  153. <if test="resCreateTime != null">and RES_CREATE_TIME = #{resCreateTime}</if>
  154. <if test="engScal != null and engScal != ''">and ENG_SCAL = #{engScal}</if>
  155. <if test="normz != null and normz != ''">and NORMZ = #{normz}</if>
  156. <if test="fsltdz != null and fsltdz != ''">and FSLTDZ = #{fsltdz}</if>
  157. <if test="hystSite != null and hystSite != ''">and HYST_SITE = #{hystSite}</if>
  158. <if test="totCap != null and totCap != ''">and TOT_CAP = #{totCap}</if>
  159. <if test="damRegCode != null and damRegCode != ''">and DAM_REG_CODE = #{damRegCode}</if>
  160. <if test="damType != null and damType != ''">and DAM_TYPE = #{damType}</if>
  161. <if test="hasDamRegCode != null and hasDamRegCode != ''">and HAS_DAM_REG_CODE = #{hasDamRegCode}</if>
  162. <if test="resCreateTimeNote != null and resCreateTimeNote != ''">and RES_CREATE_TIME_NOTE =
  163. #{resCreateTimeNote}
  164. </if>
  165. <if test="engScalNote != null and engScalNote != ''">and ENG_SCAL_NOTE = #{engScalNote}</if>
  166. <if test="state != null and state != ''">and STATE = #{state}</if>
  167. <if test="groupLeader != null and groupLeader != ''">and GROUP_LEADER = #{groupLeader}</if>
  168. <if test="groupLeaderTel != null and groupLeaderTel != ''">and GROUP_LEADER_TEL = #{groupLeaderTel}</if>
  169. <if test="recPersId != null and recPersId != ''">and REC_PERS_ID = #{recPersId}</if>
  170. <if test="recPers != null and recPers != ''">and REC_PERS = #{recPers}</if>
  171. <if test="recPersTel != null and recPersTel != ''">and REC_PERS_TEL = #{recPersTel}</if>
  172. <if test="uptm != null">and UPTM = #{uptm}</if>
  173. <if test="intm != null">and INTM = #{intm}</if>
  174. <if test="note != null and note != ''">and NOTE = #{note}</if>
  175. <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
  176. <if test="baseStat != null and baseStat != ''">and BASE_STAT = #{baseStat}</if>
  177. <if test="viewStat != null and viewStat != ''">and VIEW_STAT = #{viewStat}</if>
  178. <if test="presStat != null and presStat != ''">and PRES_STAT = #{presStat}</if>
  179. <if test="benefitStat != null and benefitStat != ''">and benefit_Stat = #{benefitStat}</if>
  180. <if test="resRunStat != null and resRunStat != ''">and RES_RUN_STAT = #{resRunStat}</if>
  181. <if test="rsCode != null and rsCode != ''">and RS_CODE = #{rsCode}</if>
  182. <if test="rsvrAdmName != null and rsvrAdmName != ''">and rsvr_Adm_Name = #{rsvrAdmName}</if>
  183. <if test="compDateStr != null and compDateStr != ''">and comp_Date_Str = #{compDateStr}</if>
  184. <if test="reverStat != null and reverStat != ''">and rever_Stat = #{reverStat}</if>
  185. <if test="location != null and location != ''">and location = #{location}</if>
  186. <if test="rgstrId != null and rgstrId != ''">and RGSTR_ID = #{rgstrId}</if>
  187. <if test="rsClass != null">and RS_CLASS = #{rsClass}</if>
  188. <if test="impdDt != null">and IMPD_DT = #{impdDt}</if>
  189. <if test="rnfcImpdDt != null">and RNFC_IMPD_DT = #{rnfcImpdDt}</if>
  190. <if test="desFlStag != null and desFlStag != ''">and DES_FL_STAG = #{desFlStag}</if>
  191. <if test="flConTopStag != null and flConTopStag != ''">and FL_CON_TOP_STAG = #{flConTopStag}</if>
  192. <if test="reinStat != null and reinStat != ''">and REIN_STAT = #{reinStat}</if>
  193. <if test="damStat != null and damStat != ''">and DAM_STAT = #{damStat}</if>
  194. <if test="safeStat != null and safeStat != ''">and SAFE_STAT = #{safeStat}</if>
  195. <if test="rectStat != null and rectStat != ''">and RECT_STAT = #{rectStat}</if>
  196. <if test="chkInfoStat != null and chkInfoStat != ''">and CHK_INFO_STAT = #{chkInfoStat}</if>
  197. </trim>
  198. </sql>
  199. <select id="get" resultMap="bisInspRsvrRgstrResultMap" parameterType="String">
  200. select
  201. <include refid="table_columns"/>
  202. from bis_insp_rsvr_rgstr where RGSTR_ID = #{id}
  203. </select>
  204. <select id="getBy" resultMap="bisInspRsvrRgstrResultMap">
  205. select
  206. <include refid="table_columns"/>
  207. from bis_insp_rsvr_rgstr
  208. <include refid="page_where"/>
  209. </select>
  210. <select id="findAll" resultMap="bisInspRsvrRgstrResultMap">
  211. select
  212. <include refid="table_columns"/>
  213. from bis_insp_rsvr_rgstr
  214. </select>
  215. <select id="findList" resultMap="bisInspRsvrRgstrResultMap">
  216. select r.* from bis_insp_rsvr_rgstr r
  217. <include refid="page_where"/>
  218. </select>
  219. <select id="findPcPage" resultType="cn.com.goldenwater.dcproj.dto.BisInspRsvrRgstrPcDto"
  220. parameterType="cn.com.goldenwater.dcproj.param.TypeParam">
  221. select * from
  222. (
  223. SELECT
  224. A.ID,A.OBJ_ID,A.CODE,A.NM,A.PTYPE,A.LGTD,A.LTTD,A.PROVINCIAL,
  225. B.STATE,B.NORMZ, B.FSLTDZ, B.RES_RUN_STAT,B.VIEW_STAT,B.AD_CODE,B.BASE_STAT,
  226. B.PRES_STAT,B.REVER_STAT,B.BENEFIT_STAT,B.LOCATION,B.HYST_SITE,
  227. B.RES_CREATE_TIME,B.HAS_DAM_REG_CODE,B.DAM_TYPE,B.DATA_STAT,
  228. B.REIN_STAT,B.DAM_STAT,B.SAFE_STAT, B.INSP_TYPE, B.IS_ACTION, B.IS_SAF, B.IS_SITE, B.DUTY_DEP,
  229. B.DAM_REG_CODE,B.RGSTR_ID,B.GROUP_LEADER,B.GROUP_LEADER_TEL,B.FL_CON_TOP_STAG,
  230. B.RS_CLASS, B.IMPD_DT, B.RNFC_IMPD_DT, B.DES_FL_STAG, B.CHK_INFO_STAT, B.RECT_STAT,
  231. B.REC_PERS,B.REC_PERS_ID,B.REC_PERS_TEL,B.NOTE,B.UPTM,B.INTM,B.COMP_DATE_STR,
  232. case when "TO_CHAR"(SYSDATE,'yyyy-MM-dd') = "TO_CHAR"( p.mincolltime,'yyyy-MM-dd') then '1'
  233. when p.mincolltime is null then '1'
  234. else '0' end timeout,
  235. (CASE WHEN B.STATE IS NULL THEN '0' ELSE B.STATE END) AS wtdstState,
  236. (CASE WHEN B.ENG_SCAL IS NULL THEN TO_CHAR(E.ENG_SCAL) ELSE B.ENG_SCAL END) AS ENG_SCAL,
  237. (CASE WHEN B.TOT_CAP IS NULL THEN E.TOT_CAP ELSE B.TOT_CAP END) TOT_CAP,
  238. (CASE WHEN B.RSVR_NM IS NULL THEN TO_CHAR(E.RS_NAME) ELSE B.RSVR_NM END) AS RSVR_NM,
  239. (CASE WHEN B.RSVR_ADM_NAME IS NULL THEN E.RS_ADM_NAME ELSE B.RSVR_ADM_NAME END) RS_ADM_NAME,
  240. AD.AD_FULL_NAME,IA.PNM groupName,ria.pnm riverName,
  241. (select pnm from BIS_INSP_ALL where id = ia.pid)||ia.pnm upGroupName
  242. FROM BIS_INSP_ALL_OBJ A
  243. JOIN BIS_INSP_RSVR_RGSTR B ON A.OBJ_ID = B.OBJ_ID
  244. LEFT JOIN ATT_RS_BASE E ON A.CODE=E.RS_CODE
  245. LEFT JOIN ATT_AD_X_BASE AD ON B.AD_CODE = AD.AD_CODE
  246. 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. left join (select min(coll_time) mincolltime , obj_id from BIS_INSP_PBLM group by obj_id) p on P.OBJ_ID = A.OBJ_ID
  249. <where>
  250. <if test="tabType =='2'.toString()">
  251. AND IA.ENTM &lt; TO_DATE(#{nowTime},'yyyy-MM-dd')+1
  252. </if>
  253. <if test="tabType =='1'.toString()">
  254. AND IA.ENTM &gt;= TO_DATE(#{nowTime},'yyyy-MM-dd')
  255. </if>
  256. <if test=" repeatId ==1 ">
  257. AND B.REPEAT_ID IS NOT NULL
  258. </if>
  259. <if test=" repeatId ==2 ">AND B.REPEAT_ID IS NULL</if>
  260. <choose>
  261. <when test="province !=null and province !=''">
  262. AND A.AD_CODE = #{province}
  263. </when>
  264. <otherwise>
  265. AND A.AD_CODE IS NULL
  266. </otherwise>
  267. </choose>
  268. <if test="adName != null and adName != ''">and ad.AD_FULL_NAME LIKE '%${adName}%'</if>
  269. <if test="engScal != null and engScal != ''">and B.ENG_SCAL = #{engScal}</if>
  270. <if test="riverId != null and riverId != ''">and ria.id = #{riverId}</if>
  271. <if test="groupId != null and groupId != ''">and A.id = #{groupId}</if>
  272. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  273. AND B.INTM &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND B.INTM &lt; TO_DATE(#{entm},'YYYY-MM-DD')+1
  274. </if>
  275. and
  276. REGEXP_LIKE(
  277. A.Id,'^('||
  278. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{presId}
  279. <include refid="orgIdSql"/>
  280. and type=#{pType}
  281. )>0 then
  282. (SELECT LISTAGG(id, '|') WITHIN GROUP(ORDER BY PERSID) as
  283. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{presId} and type=#{pType}
  284. <include refid="orgIdSql"/>
  285. )
  286. else (select 'non' from dual) end)
  287. ||')')
  288. ) a where a.PTYPE=#{pType}
  289. <if test="id !=null and id !=''">
  290. and id like '${id}%'
  291. </if>
  292. <if test="state !=null and state !=''">
  293. <!-- and wtdstState =#{state} -->
  294. AND wtdstState in (${state})
  295. </if>
  296. <if test="code !=null and code !=''">
  297. and code like '${code}%'
  298. </if>
  299. <if test="rsName !=null and rsName !=''">
  300. and rsvr_nm like '%${rsName}%'
  301. </if>
  302. <if test="name !=null and name !=''">
  303. and rsvr_nm like '%${name}%'
  304. </if>
  305. <if test="rsvrAdmName !=null and rsvrAdmName !=''">
  306. and rsvr_adm_name like '%${rsvrAdmName}%'
  307. </if>
  308. </where>
  309. <choose>
  310. <when test="ids !=null and ids !=''">
  311. order by code asc
  312. </when>
  313. <otherwise>
  314. order by wtdstState,code desc
  315. </otherwise>
  316. </choose>
  317. </select>
  318. <select id="findPageByType" resultType="cn.com.goldenwater.dcproj.model.BisInspRsvrRgstrDto"
  319. parameterType="cn.com.goldenwater.dcproj.param.TypeParam">
  320. select * from
  321. (SELECT
  322. A.CODE, A.ID,A.PTYPE,A.OBJ_INTM,A.OBJ_ID,A.IS_SET_OBJ,
  323. (case when b.rsvr_nm is null then A.nm else b.rsvr_nm end) nm,
  324. CASE WHEN B.STATE IS NULL THEN '0' ELSE B.STATE END AS wtdstState,
  325. (case when b.rsvr_adm_name is null then e.rs_adm_name else b.rsvr_adm_name end) as rs_adm_name,
  326. (case when b.eng_scal is null then to_char(e.eng_scal) else b.eng_scal end) eng_scal,
  327. (case when b.hyst_site is null then to_char(e.location) else b.hyst_site end) as hyst_site,
  328. (case when b.location is null then to_char(e.location) else b.location end) location,
  329. B.RSVR_LONG as LGTD,B.RSVR_LAT as LTTD,
  330. B.NORMZ, B.FSLTDZ, b.state, b.res_run_stat,b.view_stat,b.base_stat,b.pres_stat,b.rever_Stat,
  331. b.BENEFIT_STAT,b.REIN_STAT,b.DAM_STAT,b.SAFE_STAT,b.rgstr_id rgstrId,b.rsvr_nm rsvrNm,
  332. b.ad_code adCode, b.res_create_time resCreateTime,b.tot_cap totCap,
  333. b.dam_reg_code damRegCode, b.dam_type damType,b.has_dam_reg_code hasDamRegCode,
  334. b.res_create_time_note resCreateTimeNote, b.eng_scal_note engScalNote,b.group_leader groupLeader,
  335. b.group_leader_tel groupLeaderTel,b.rec_pers_id recPersId, b.rec_pers recPers,
  336. b.comp_Date_Str compDateStr,b.rec_pers_tel recPersTel,b.liaison_man liaisonMan,
  337. b.liaison_man_tel liaisonManTel, b.uptm ,b.intm,b.note,
  338. b.RS_CLASS, b.IMPD_DT, b.RNFC_IMPD_DT, b.DES_FL_STAG, b.CHK_INFO_STAT, b.RECT_STAT,
  339. b.FL_CON_TOP_STAG, B.INSP_TYPE, B.IS_ACTION, B.IS_SAF, B.IS_SITE, B.DUTY_DEP,
  340. F.VIEW_ID viewID
  341. FROM BIS_INSP_ALL_OBJ A
  342. JOIN BIS_INSP_RSVR_RGSTR B ON A.OBJ_ID = B.OBJ_ID
  343. LEFT JOIN ATT_RS_BASE E ON A.CODE=E.RS_CODE
  344. LEFT JOIN BIS_INSP_BASE_VIEW F ON B.RGSTR_ID=F.RGSTR_ID
  345. where
  346. REGEXP_LIKE(
  347. A.Id,'^('||
  348. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{presId} and id like '00%'
  349. <include refid="orgIdSql"/>
  350. )>0 then
  351. (SELECT LISTAGG(id, '|') WITHIN GROUP(ORDER BY PERSID) as
  352. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{presId}
  353. <include refid="orgIdSql"/>
  354. and id like '00%'
  355. )
  356. else (select 'non' from dual) end)
  357. ||')')
  358. ) a where a.PTYPE=#{pType}
  359. <if test="plnaId !=null and plnaId !=''">
  360. and a.id like '${plnaId}%'
  361. </if>
  362. <if test="state !=null and state !=''">
  363. and wtdstState =#{state}
  364. </if>
  365. <if test="engScal !=null and engScal !=''">
  366. and eng_scal in (${engScal})
  367. </if>
  368. <if test="code !=null and code !=''">
  369. and adCode like '${code}%'
  370. </if>
  371. <if test="rsName !=null and rsName !=''">
  372. and rsvrNm like '%${rsName}%'
  373. </if>
  374. <if test="inspType !=null and inspType !=''">
  375. and INSP_TYPE =#{inspType}
  376. </if>
  377. order by code asc
  378. <if test="orderBy != null and orderBy != ''">
  379. ,${orderBy}
  380. </if>
  381. </select>
  382. <!--通过此用户ID下的所有行政编码-->
  383. <select id="selectAdCodeByUserId" resultType="string">
  384. select LISTAGG(code, ',') WITHIN GROUP (ORDER BY code) "code" from (
  385. select distinct substr(code,0,2) code from BIS_INSP_ALL_OBJ A
  386. where
  387. REGEXP_LIKE(
  388. A.Id,'^('||
  389. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{presId}
  390. <include refid="orgIdSql"/>
  391. )>0 then
  392. (SELECT LISTAGG(id, '|') WITHIN GROUP(ORDER BY PERSID) as
  393. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{presId}
  394. <include refid="orgIdSql"/>
  395. )
  396. else (select 'non' from dual) end)
  397. ||')')
  398. and a.PTYPE = #{ptype}
  399. )
  400. </select>
  401. <sql id="orgIdSql">
  402. <choose>
  403. <when test="orgId !=null and orgId !=''">
  404. and ORG_ID=#{orgId}
  405. </when>
  406. <otherwise>
  407. and ORG_ID is null
  408. </otherwise>
  409. </choose>
  410. </sql>
  411. <select id="selectCount" resultType="int">
  412. select count(RGSTR_ID) from bis_insp_rsvr_rgstr
  413. <include refid="page_where"/>
  414. </select>
  415. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspRsvrRgstr">
  416. insert into bis_insp_rsvr_rgstr(
  417. <include refid="table_columns"/>
  418. )
  419. values (
  420. <include refid="entity_properties"/>
  421. )
  422. </insert>
  423. <delete id="delete" parameterType="java.lang.String">
  424. delete from bis_insp_rsvr_rgstr where RGSTR_ID = #{id}
  425. </delete>
  426. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspRsvrRgstr">
  427. delete from bis_insp_rsvr_rgstr
  428. <include refid="page_where"/>
  429. </delete>
  430. <delete id="deleteInFlag" parameterType="java.lang.String">
  431. delete from bis_insp_rsvr_rgstr where RGSTR_ID = #{id}
  432. </delete>
  433. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspRsvrRgstr">
  434. update bis_insp_rsvr_rgstr
  435. <trim prefix="set" suffixOverrides=",">
  436. <if test="dutyDep != null and dutyDep != ''">DUTY_DEP = #{dutyDep},</if>
  437. <if test="isSite != null and isSite != ''">IS_SITE = #{isSite},</if>
  438. <if test="isAction != null and isAction != ''">IS_ACTION = #{isAction},</if>
  439. <if test="isSaf != null and isSaf != ''">IS_SAF = #{isSaf},</if>
  440. <if test="inspType != null and inspType != ''">INSP_TYPE = #{inspType},</if>
  441. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  442. <if test="location != null and location != ''">location = #{location},</if>
  443. <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
  444. <if test="rsvrNm != null and rsvrNm != ''">RSVR_NM = #{rsvrNm},</if>
  445. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  446. <if test="resCreateTime != null">RES_CREATE_TIME = #{resCreateTime},</if>
  447. <if test="engScal != null and engScal != ''">ENG_SCAL = #{engScal},</if>
  448. <if test='normz != null and normz != ""'>NORMZ = #{normz},</if>
  449. FSLTDZ = #{fsltdz},
  450. <if test='hystSite != null and hystSite != ""'>HYST_SITE = #{hystSite},</if>
  451. TOT_CAP = #{totCap},
  452. <if test="damRegCode != null and damRegCode != ''">DAM_REG_CODE = #{damRegCode},</if>
  453. <if test="damType != null and damType != ''">DAM_TYPE = #{damType},</if>
  454. <if test="hasDamRegCode != null and hasDamRegCode != ''">HAS_DAM_REG_CODE = #{hasDamRegCode},</if>
  455. <if test="resCreateTimeNote != null and resCreateTimeNote != ''">RES_CREATE_TIME_NOTE =
  456. #{resCreateTimeNote},
  457. </if>
  458. <if test="engScalNote != null and engScalNote != ''">ENG_SCAL_NOTE = #{engScalNote},</if>
  459. <if test="state != null and state != ''">STATE = #{state},</if>
  460. <if test="groupLeader != null and groupLeader != ''">GROUP_LEADER = #{groupLeader},</if>
  461. <if test="groupLeaderTel != null and groupLeaderTel != ''">GROUP_LEADER_TEL = #{groupLeaderTel},</if>
  462. <if test="recPersId != null and recPersId != ''">REC_PERS_ID = #{recPersId},</if>
  463. <if test="recPers != null and recPers != ''">REC_PERS = #{recPers},</if>
  464. <if test="recPersTel != null and recPersTel != ''">REC_PERS_TEL = #{recPersTel},</if>
  465. <if test="uptm != null">UPTM = #{uptm},</if>
  466. <if test="damMaxHigh != null and damMaxHigh != ''">DAM_MAX_HIGH = #{damMaxHigh},</if>
  467. <if test="intm != null">INTM = #{intm},</if>
  468. <if test="note != null and note != ''">NOTE = #{note},</if>
  469. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  470. <if test="reverStat != null and reverStat != ''">rever_Stat = #{reverStat},</if>
  471. <if test="rsvrLat != null and rsvrLat != ''">RSVR_LAT = #{rsvrLat},</if>
  472. <if test="rsvrLong != null and rsvrLong != ''">RSVR_LONG = #{rsvrLong},</if>
  473. <if test="baseStat != null and baseStat != ''">BASE_STAT = #{baseStat},</if>
  474. <if test="viewStat != null and viewStat != ''">VIEW_STAT = #{viewStat},</if>
  475. <if test="presStat != null and presStat != ''">PRES_STAT = #{presStat},</if>
  476. <if test="benefitStat != null and benefitStat != ''">benefit_Stat = #{benefitStat},</if>
  477. <if test="resRunStat != null and resRunStat != ''">RES_RUN_STAT = #{resRunStat},</if>
  478. <if test="rsCode != null and rsCode != ''">RS_CODE = #{rsCode},</if>
  479. <if test="liaisonManTel != null and liaisonManTel != ''">liaison_Man_Tel = #{liaisonManTel},</if>
  480. <if test="liaisonMan != null and liaisonMan != ''">liaison_Man = #{liaisonMan},</if>
  481. <if test="rsvrAdmName != null and rsvrAdmName != ''">rsvr_Adm_Name = #{rsvrAdmName},</if>
  482. <if test="compDateStr != null">COMP_DATE_STR = #{compDateStr},</if>
  483. <if test="rsClass != null">RS_CLASS = #{rsClass},</if>
  484. <if test="impdDt != null">IMPD_DT = #{impdDt},</if>
  485. <if test="rnfcImpdDt != null">RNFC_IMPD_DT = #{rnfcImpdDt},</if>
  486. <if test="desFlStag != null and desFlStag != ''">DES_FL_STAG = #{desFlStag},</if>
  487. <if test="flConTopStag != null and flConTopStag != ''">FL_CON_TOP_STAG = #{flConTopStag},</if>
  488. <if test="reinStat != null and reinStat != ''">REIN_STAT = #{reinStat},</if>
  489. <if test="damStat != null and damStat != ''">DAM_STAT = #{damStat},</if>
  490. <if test="safeStat != null and safeStat != ''">SAFE_STAT = #{safeStat},</if>
  491. <if test="rectStat != null and rectStat != ''">RECT_STAT = #{rectStat},</if>
  492. <if test="chkInfoStat != null and chkInfoStat != ''">CHK_INFO_STAT = #{chkInfoStat},</if>
  493. </trim>
  494. <where>RGSTR_ID = #{rgstrId}</where>
  495. </update>
  496. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspRsvrRgstr">
  497. update bis_insp_rsvr_rgstr
  498. <trim prefix="set" suffixOverrides=",">
  499. <if test="dutyDep != null and dutyDep != ''">DUTY_DEP = #{dutyDep},</if>
  500. <if test="isSite != null and isSite != ''">IS_SITE = #{isSite},</if>
  501. <if test="isAction != null and isAction != ''">IS_ACTION = #{isAction},</if>
  502. <if test="isSaf != null and isSaf != ''">IS_SAF = #{isSaf},</if>
  503. <if test="inspType != null and inspType != ''">INSP_TYPE = #{inspType},</if>
  504. <if test="liaisonManTel != null and liaisonManTel != ''">liaison_Man_Tel = #{liaisonManTel},</if>
  505. <if test="liaisonMan != null and liaisonMan != ''">liaison_Man = #{liaisonMan},</if>
  506. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  507. <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
  508. <if test="rsvrNm != null and rsvrNm != ''">RSVR_NM = #{rsvrNm},</if>
  509. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  510. <if test="resCreateTime != null">RES_CREATE_TIME = #{resCreateTime},</if>
  511. <if test="engScal != null and engScal != ''">ENG_SCAL = #{engScal},</if>
  512. <if test="normz != null and normz != ''">NORMZ = #{normz},</if>
  513. FSLTDZ = #{fsltdz},
  514. <if test="hystSite != null and hystSite != ''">HYST_SITE = #{hystSite},</if>
  515. TOT_CAP = #{totCap},
  516. <if test="damRegCode != null and damRegCode != ''">DAM_REG_CODE = #{damRegCode},</if>
  517. <if test="damType != null and damType != ''">DAM_TYPE = #{damType},</if>
  518. <if test="hasDamRegCode != null and hasDamRegCode != ''">HAS_DAM_REG_CODE = #{hasDamRegCode},</if>
  519. <if test="resCreateTimeNote != null and resCreateTimeNote != ''">RES_CREATE_TIME_NOTE =
  520. #{resCreateTimeNote},
  521. </if>
  522. <if test="engScalNote != null and engScalNote != ''">ENG_SCAL_NOTE = #{engScalNote},</if>
  523. <if test="state != null and state != ''">STATE = #{state},</if>
  524. <if test="groupLeader != null and groupLeader != ''">GROUP_LEADER = #{groupLeader},</if>
  525. <if test="groupLeaderTel != null and groupLeaderTel != ''">GROUP_LEADER_TEL = #{groupLeaderTel},</if>
  526. <if test="recPersId != null and recPersId != ''">REC_PERS_ID = #{recPersId},</if>
  527. <if test="recPers != null and recPers != ''">REC_PERS = #{recPers},</if>
  528. <if test="reverStat != null and reverStat != ''">rever_Stat = #{reverStat},</if>
  529. <if test="recPersTel != null and recPersTel != ''">REC_PERS_TEL = #{recPersTel},</if>
  530. <if test="uptm != null">UPTM = #{uptm},</if>
  531. <if test="damMaxHigh != null and damMaxHigh != ''">DAM_MAX_HIGH = #{damMaxHigh},</if>
  532. <if test="intm != null">INTM = #{intm},</if>
  533. <if test="note != null and note != ''">NOTE = #{note},</if>
  534. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  535. <if test="rsvrLat != null and rsvrLat != ''">RSVR_LAT = #{rsvrLat},</if>
  536. <if test="rsvrLong != null and rsvrLong != ''">RSVR_LONG = #{rsvrLong},</if>
  537. <if test="baseStat != null and baseStat != ''">BASE_STAT = #{baseStat},</if>
  538. <if test="viewStat != null and viewStat != ''">VIEW_STAT = #{viewStat},</if>
  539. <if test="presStat != null and presStat != ''">PRES_STAT = #{presStat},</if>
  540. <if test="resRunStat != null and resRunStat != ''">RES_RUN_STAT = #{resRunStat},</if>
  541. <if test="rsCode != null and rsCode != ''">RS_CODE = #{rsCode},</if>
  542. <if test="rsvrAdmName != null and rsvrAdmName != ''">rsvr_Adm_Name = #{rsvrAdmName},</if>
  543. <if test="compDateStr != null">COMP_DATE_STR = #{compDateStr},</if>
  544. <if test="rsClass != null">RS_CLASS = #{rsClass},</if>
  545. <if test="impdDt != null">IMPD_DT = #{impdDt},</if>
  546. <if test="rnfcImpdDt != null">RNFC_IMPD_DT = #{rnfcImpdDt},</if>
  547. <if test="desFlStag != null and desFlStag != ''">DES_FL_STAG = #{desFlStag},</if>
  548. <if test="flConTopStag != null and flConTopStag != ''">FL_CON_TOP_STAG = #{flConTopStag},</if>
  549. <if test="reinStat != null and reinStat != ''">REIN_STAT = #{reinStat},</if>
  550. <if test="damStat != null and damStat != ''">DAM_STAT = #{damStat},</if>
  551. <if test="safeStat != null and safeStat != ''">SAFE_STAT = #{safeStat},</if>
  552. <if test="rectStat != null and rectStat != ''">RECT_STAT = #{rectStat},</if>
  553. <if test="chkInfoStat != null and chkInfoStat != ''">CHK_INFO_STAT = #{chkInfoStat},</if>
  554. </trim>
  555. <include refid="page_where"/>
  556. </update>
  557. <select id="getRsvrByIdNm" resultType="cn.com.goldenwater.dcproj.model.BisInspBase">
  558. select * from bis_insp_all_obj a join BIS_INSP_RSVR_RGSTR b on a.obj_id=b.obj_id where id=#{groupId} and a.nm like '%${nm}%'
  559. </select>
  560. <select id="getListByTm" resultType="cn.com.goldenwater.dcproj.dto.BisInspTaskTotal">
  561. select count(*) objSize from bis_insp_rsvr_rgstr t where ad_code like '${adCode}%' and intm &gt;=#{stTm} and intm&lt;#{enTm}
  562. </select>
  563. <select id="getByPblmId" resultMap="bisInspRsvrRgstrResultMap">
  564. select RGSTR_ID, DAM_REG_CODE,OBJ_ID,RS_CODE from bis_insp_rsvr_rgstr where RGSTR_ID in (select REGID from BIS_INSP_PBLM where PBLM_ID = #{pblmId} )
  565. </select>
  566. <update id="updateDamRegCodeByRsCode" parameterType="cn.com.goldenwater.dcproj.model.BisInspRsvrRgstr">
  567. update bis_insp_rsvr_rgstr
  568. set DAM_REG_CODE = #{damRegCode} ,UPTM = #{uptm}
  569. where RS_CODE = #{rsCode}
  570. </update>
  571. </mapper>