BisInspRsvrRgstrDao.xml 31 KB

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