BisInspRsvrRgstrDao.xml 32 KB

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