BisInspRsmlRgstrDao.xml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504
  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.BisInspRsmlRgstrDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspRsmlRgstr" id="bisInspRsmlRgstrResultMap">
  5. <result property="damType" column="DAM_TYPE"/>
  6. <result property="totCap" column="TOT_CAP"/>
  7. <result property="damSizeHig" column="DAM_SIZE_HIG"/>
  8. <result property="desFlStag" column="DES_FL_STAG"/>
  9. <result property="flConTopStag" column="FL_CON_TOP_STAG"/>
  10. <result property="impdDt" column="IMPD_DT"/>
  11. <result property="rnfcImpdDt" column="RNFC_IMPD_DT"/>
  12. <result property="resCreateTime" column="RES_CREATE_TIME"/>
  13. <result property="groupLeader" column="GROUP_LEADER"/>
  14. <result property="groupLeaderTel" column="GROUP_LEADER_TEL"/>
  15. <result property="recPersId" column="REC_PERS_ID"/>
  16. <result property="recPers" column="REC_PERS"/>
  17. <result property="recPersTel" column="REC_PERS_TEL"/>
  18. <result property="intm" column="INTM"/>
  19. <result property="uptm" column="UPTM"/>
  20. <result property="note" column="NOTE"/>
  21. <result property="presState" column="PRES_STATE"/>
  22. <result property="runManageState" column="RUN_MANAGE_STATE"/>
  23. <result property="projectState" column="PROJECT_STATE"/>
  24. <result property="state" column="STATE"/>
  25. <result property="id" column="ID"/>
  26. <result property="objId" column="OBJ_ID"/>
  27. <result property="rsCode" column="RS_CODE"/>
  28. <result property="rsName" column="RS_NAME"/>
  29. <result property="hasDamRegCode" column="HAS_DAM_REG_CODE"/>
  30. <result property="damRegCode" column="DAM_REG_CODE"/>
  31. <result property="adCode" column="AD_CODE"/>
  32. <result property="location" column="LOCATION"/>
  33. <result property="hystSite" column="HYST_SITE"/>
  34. <result property="centerX" column="CENTER_X"/>
  35. <result property="centerY" column="CENTER_Y"/>
  36. <result property="gdX" column="GD_X"/>
  37. <result property="gdY" column="GD_Y"/>
  38. <result property="rsAdmCode" column="RS_ADM_CODE"/>
  39. <result property="rsAdmName" column="RS_ADM_NAME"/>
  40. <result property="engScal" column="ENG_SCAL"/>
  41. <result property="rsClass" column="RS_CLASS"/>
  42. <result property="normz" column="NORMZ"/>
  43. <result property="fsltdz" column="FSLTDZ"/>
  44. <result property="fsltdz" column="FSLTDZ"/>
  45. <result property="safeStat" column="SAFE_STAT"/>
  46. <result property="inspType" column="INSP_TYPE"/>
  47. <result property="isAction" column="IS_ACTION"/>
  48. <result property="isSaf" column="IS_SAF"/>
  49. <result property="isSite" column="IS_SITE"/>
  50. </resultMap>
  51. <sql id="table_columns">
  52. NORMZ,
  53. FSLTDZ,
  54. DAM_TYPE,
  55. TOT_CAP,
  56. DAM_SIZE_HIG,
  57. DES_FL_STAG,
  58. FL_CON_TOP_STAG,
  59. IMPD_DT,
  60. RNFC_IMPD_DT,
  61. RES_CREATE_TIME,
  62. GROUP_LEADER,
  63. GROUP_LEADER_TEL,
  64. REC_PERS_ID,
  65. REC_PERS,
  66. REC_PERS_TEL,
  67. INTM,
  68. UPTM,
  69. NOTE,
  70. PRES_STATE,
  71. RUN_MANAGE_STATE,
  72. PROJECT_STATE,
  73. STATE,
  74. ID,
  75. OBJ_ID,
  76. RS_CODE,
  77. RS_NAME,
  78. HAS_DAM_REG_CODE,
  79. DAM_REG_CODE,
  80. AD_CODE,
  81. LOCATION,
  82. HYST_SITE,
  83. CENTER_X,
  84. CENTER_Y,
  85. GD_X,
  86. GD_Y,
  87. RS_ADM_CODE,
  88. RS_ADM_NAME,
  89. ENG_SCAL,SAFE_STAT,
  90. RS_CLASS, INSP_TYPE, IS_ACTION, IS_SAF, IS_SITE
  91. </sql>
  92. <sql id="entity_properties">
  93. #{normz},
  94. #{fsltdz},
  95. #{damType},
  96. #{totCap},
  97. #{damSizeHig},
  98. #{desFlStag},
  99. #{flConTopStag},
  100. #{impdDt},
  101. #{rnfcImpdDt},
  102. #{resCreateTime},
  103. #{groupLeader},
  104. #{groupLeaderTel},
  105. #{recPersId},
  106. #{recPers},
  107. #{recPersTel},
  108. #{intm},
  109. #{uptm},
  110. #{note},
  111. #{presState},
  112. #{runManageState},
  113. #{projectState},
  114. #{state},
  115. #{id},
  116. #{objId},
  117. #{rsCode},
  118. #{rsName},
  119. #{hasDamRegCode},
  120. #{damRegCode},
  121. #{adCode},
  122. #{location},
  123. #{hystSite},
  124. #{centerX},
  125. #{centerY},
  126. #{gdX},
  127. #{gdY},
  128. #{rsAdmCode},
  129. #{rsAdmName},
  130. #{engScal},#{safeStat},
  131. #{rsClass},#{inspType},#{isAction},#{isSaf},#{isSite}
  132. </sql>
  133. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  134. <sql id="page_where">
  135. <trim prefix="where" prefixOverrides="and | or ">
  136. <if test="isSite != null and isSite != ''">and IS_SITE = #{isSite}</if>
  137. <if test="isAction != null and isAction != ''">and IS_ACTION = #{isAction}</if>
  138. <if test="isSaf != null and isSaf != ''">and IS_SAF = #{isSaf}</if>
  139. <if test="inspType != null and inspType != ''">and INSP_TYPE = #{inspType}</if>
  140. <if test="normz != null and normz != ''">and NORMZ = #{normz}</if>
  141. <if test="fsltdz != null and fsltdz != ''">and FSLTDZ = #{fsltdz}</if>
  142. <if test="totCap != null and totCap != ''">and TOT_CAP = #{totCap}</if>
  143. <if test="damSizeHig != null and damSizeHig != ''">and DAM_SIZE_HIG = #{damSizeHig}</if>
  144. <if test="desFlStag != null and desFlStag != ''">and DES_FL_STAG = #{desFlStag}</if>
  145. <if test="flConTopStag != null and flConTopStag != ''">and FL_CON_TOP_STAG = #{flConTopStag}</if>
  146. <if test="impdDt != null">and IMPD_DT = #{impdDt}</if>
  147. <if test="rnfcImpdDt != null">and RNFC_IMPD_DT = #{rnfcImpdDt}</if>
  148. <if test="resCreateTime != null">and RES_CREATE_TIME = #{resCreateTime}</if>
  149. <if test="groupLeader != null and groupLeader != ''">and GROUP_LEADER = #{groupLeader}</if>
  150. <if test="groupLeaderTel != null and groupLeaderTel != ''">and GROUP_LEADER_TEL = #{groupLeaderTel}</if>
  151. <if test="recPersId != null and recPersId != ''">and REC_PERS_ID = #{recPersId}</if>
  152. <if test="recPers != null and recPers != ''">and REC_PERS = #{recPers}</if>
  153. <if test="recPersTel != null and recPersTel != ''">and REC_PERS_TEL = #{recPersTel}</if>
  154. <if test="intm != null">and INTM = #{intm}</if>
  155. <if test="uptm != null">and UPTM = #{uptm}</if>
  156. <if test="note != null and note != ''">and NOTE = #{note}</if>
  157. <if test="presState != null and presState != ''">and PRES_STATE = #{presState}</if>
  158. <if test="runManageState != null and runManageState != ''">and RUN_MANAGE_STATE = #{runManageState}</if>
  159. <if test="projectState != null and projectState != ''">and PROJECT_STATE = #{projectState}</if>
  160. <if test="state != null and state != ''">and STATE = #{state}</if>
  161. <if test="id != null and id != ''">and ID = #{id}</if>
  162. <if test="objId != null and objId != ''">and OBJ_ID = #{objId}</if>
  163. <if test="rsCode != null and rsCode != ''">and RS_CODE = #{rsCode}</if>
  164. <if test="rsName != null and rsName != ''">and RS_NAME = #{rsName}</if>
  165. <if test="hasDamRegCode != null and hasDamRegCode != ''">and HAS_DAM_REG_CODE = #{hasDamRegCode}</if>
  166. <if test="damRegCode != null and damRegCode != ''">and DAM_REG_CODE = #{damRegCode}</if>
  167. <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
  168. <if test="location != null and location != ''">and LOCATION = #{location}</if>
  169. <if test="hystSite != null and hystSite != ''">and HYST_SITE = #{hystSite}</if>
  170. <if test="centerX != null and centerX != ''">and CENTER_X = #{centerX}</if>
  171. <if test="centerY != null and centerY != ''">and CENTER_Y = #{centerY}</if>
  172. <if test="gdX != null and gdX != ''">and GD_X = #{gdX}</if>
  173. <if test="gdY != null and gdY != ''">and GD_Y = #{gdY}</if>
  174. <if test="rsAdmCode != null and rsAdmCode != ''">and RS_ADM_CODE = #{rsAdmCode}</if>
  175. <if test="rsAdmName != null and rsAdmName != ''">and RS_ADM_NAME = #{rsAdmName}</if>
  176. <if test="engScal != null and engScal != ''">and ENG_SCAL = #{engScal}</if>
  177. <if test="rsClass != null and rsClass != ''">and RS_CLASS = #{rsClass}</if>
  178. <if test="safeStat != null and safeStat != ''">and SAFE_STAT = #{safeStat}</if>
  179. </trim>
  180. </sql>
  181. <select id="get" resultMap="bisInspRsmlRgstrResultMap" parameterType="String">
  182. select
  183. <include refid="table_columns"/>
  184. from BIS_INSP_RSML_RGSTR where ID = #{id}
  185. </select>
  186. <select id="getBy" resultMap="bisInspRsmlRgstrResultMap">
  187. select
  188. <include refid="table_columns"/>
  189. from BIS_INSP_RSML_RGSTR
  190. <include refid="page_where"/>
  191. </select>
  192. <select id="findAll" resultMap="bisInspRsmlRgstrResultMap">
  193. select
  194. <include refid="table_columns"/>
  195. from BIS_INSP_RSML_RGSTR
  196. </select>
  197. <select id="findList" resultMap="bisInspRsmlRgstrResultMap">
  198. select
  199. <include refid="table_columns"/>
  200. from BIS_INSP_RSML_RGSTR
  201. <include refid="page_where"/>
  202. </select>
  203. <select id="selectCount" resultType="int">
  204. select count(ID) from BIS_INSP_RSML_RGSTR
  205. <include refid="page_where"/>
  206. </select>
  207. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspRsmlRgstr">
  208. insert into BIS_INSP_RSML_RGSTR(
  209. <include refid="table_columns"/>
  210. )
  211. values (
  212. <include refid="entity_properties"/>
  213. )
  214. </insert>
  215. <delete id="delete" parameterType="java.lang.String">
  216. delete from BIS_INSP_RSML_RGSTR where ID = #{id}
  217. </delete>
  218. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspRsmlRgstr">
  219. delete from BIS_INSP_RSML_RGSTR
  220. <include refid="page_where"/>
  221. </delete>
  222. <update id="deleteInFlag" parameterType="java.lang.String">
  223. update BIS_INSP_RSML_RGSTR set flag_valid = 0 where ID = #{id}
  224. </update>
  225. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspRsmlRgstr">
  226. update BIS_INSP_RSML_RGSTR
  227. <trim prefix="set" suffixOverrides=",">
  228. <if test="isSite != null and isSite != ''">IS_SITE = #{isSite},</if>
  229. <if test="isAction != null and isAction != ''">IS_ACTION = #{isAction},</if>
  230. <if test="isSaf != null and isSaf != ''">IS_SAF = #{isSaf},</if>
  231. <if test="inspType != null and inspType != ''">INSP_TYPE = #{inspType},</if>
  232. <if test="normz != null and normz != ''">NORMZ = #{normz},</if>
  233. <if test="fsltdz != null and fsltdz != ''">FSLTDZ = #{fsltdz},</if>
  234. <if test="totCap != null and totCap != ''">TOT_CAP = #{totCap},</if>
  235. <if test="damSizeHig != null and damSizeHig != ''">DAM_SIZE_HIG = #{damSizeHig},</if>
  236. <if test="desFlStag != null and desFlStag != ''">DES_FL_STAG = #{desFlStag},</if>
  237. <if test="flConTopStag != null and flConTopStag != ''">FL_CON_TOP_STAG = #{flConTopStag},</if>
  238. <if test="impdDt != null">IMPD_DT = #{impdDt},</if>
  239. <if test="rnfcImpdDt != null">RNFC_IMPD_DT = #{rnfcImpdDt},</if>
  240. <if test="resCreateTime != null">RES_CREATE_TIME = #{resCreateTime},</if>
  241. <if test="groupLeader != null and groupLeader != ''">GROUP_LEADER = #{groupLeader},</if>
  242. <if test="groupLeaderTel != null and groupLeaderTel != ''">GROUP_LEADER_TEL = #{groupLeaderTel},</if>
  243. <if test="recPersId != null and recPersId != ''">REC_PERS_ID = #{recPersId},</if>
  244. <if test="recPers != null and recPers != ''">REC_PERS = #{recPers},</if>
  245. <if test="recPersTel != null and recPersTel != ''">REC_PERS_TEL = #{recPersTel},</if>
  246. <if test="intm != null">INTM = #{intm},</if>
  247. <if test="uptm != null">UPTM = #{uptm},</if>
  248. <if test="note != null and note != ''">NOTE = #{note},</if>
  249. <if test="presState != null and presState != ''">PRES_STATE = #{presState},</if>
  250. <if test="runManageState != null and runManageState != ''">RUN_MANAGE_STATE = #{runManageState},</if>
  251. <if test="projectState != null and projectState != ''">PROJECT_STATE = #{projectState},</if>
  252. <if test="state != null and state != ''">STATE = #{state},</if>
  253. <if test="id != null and id != ''">ID = #{id},</if>
  254. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  255. <if test="rsCode != null and rsCode != ''">RS_CODE = #{rsCode},</if>
  256. <if test="rsName != null and rsName != ''">RS_NAME = #{rsName},</if>
  257. <if test="hasDamRegCode != null and hasDamRegCode != ''">HAS_DAM_REG_CODE = #{hasDamRegCode},</if>
  258. <if test="damRegCode != null and damRegCode != ''">DAM_REG_CODE = #{damRegCode},</if>
  259. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  260. <if test="location != null and location != ''">LOCATION = #{location},</if>
  261. <if test="hystSite != null and hystSite != ''">HYST_SITE = #{hystSite},</if>
  262. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  263. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  264. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  265. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  266. <if test="rsAdmCode != null and rsAdmCode != ''">RS_ADM_CODE = #{rsAdmCode},</if>
  267. <if test="rsAdmName != null and rsAdmName != ''">RS_ADM_NAME = #{rsAdmName},</if>
  268. <if test="engScal != null and engScal != ''">ENG_SCAL = #{engScal},</if>
  269. <if test="rsClass != null and rsClass != ''">RS_CLASS = #{rsClass},</if>
  270. <if test="safeStat != null and safeStat != ''">SAFE_STAT = #{safeStat},</if>
  271. </trim>
  272. <where>ID = #{id}</where>
  273. </update>
  274. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspRsmlRgstr">
  275. update BIS_INSP_RSML_RGSTR
  276. <trim prefix="set" suffixOverrides=",">
  277. <if test="isSite != null and isSite != ''">IS_SITE = #{isSite},</if>
  278. <if test="isAction != null and isAction != ''">IS_ACTION = #{isAction},</if>
  279. <if test="isSaf != null and isSaf != ''">IS_SAF = #{isSaf},</if>
  280. <if test="inspType != null and inspType != ''">INSP_TYPE = #{inspType},</if>
  281. <if test="normz != null and normz != ''">NORMZ = #{normz},</if>
  282. <if test="fsltdz != null and fsltdz != ''">FSLTDZ = #{fsltdz},</if>
  283. <if test="totCap != null and totCap != ''">TOT_CAP = #{totCap},</if>
  284. <if test="damSizeHig != null and damSizeHig != ''">DAM_SIZE_HIG = #{damSizeHig},</if>
  285. <if test="desFlStag != null and desFlStag != ''">DES_FL_STAG = #{desFlStag},</if>
  286. <if test="flConTopStag != null and flConTopStag != ''">FL_CON_TOP_STAG = #{flConTopStag},</if>
  287. <if test="impdDt != null">IMPD_DT = #{impdDt},</if>
  288. <if test="rnfcImpdDt != null">RNFC_IMPD_DT = #{rnfcImpdDt},</if>
  289. <if test="resCreateTime != null">RES_CREATE_TIME = #{resCreateTime},</if>
  290. <if test="groupLeader != null and groupLeader != ''">GROUP_LEADER = #{groupLeader},</if>
  291. <if test="groupLeaderTel != null and groupLeaderTel != ''">GROUP_LEADER_TEL = #{groupLeaderTel},</if>
  292. <if test="recPersId != null and recPersId != ''">REC_PERS_ID = #{recPersId},</if>
  293. <if test="recPers != null and recPers != ''">REC_PERS = #{recPers},</if>
  294. <if test="recPersTel != null and recPersTel != ''">REC_PERS_TEL = #{recPersTel},</if>
  295. <if test="intm != null">INTM = #{intm},</if>
  296. <if test="uptm != null">UPTM = #{uptm},</if>
  297. <if test="note != null and note != ''">NOTE = #{note},</if>
  298. <if test="presState != null and presState != ''">PRES_STATE = #{presState},</if>
  299. <if test="runManageState != null and runManageState != ''">RUN_MANAGE_STATE = #{runManageState},</if>
  300. <if test="projectState != null and projectState != ''">PROJECT_STATE = #{projectState},</if>
  301. <if test="state != null and state != ''">STATE = #{state},</if>
  302. <if test="id != null and id != ''">ID = #{id},</if>
  303. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  304. <if test="rsCode != null and rsCode != ''">RS_CODE = #{rsCode},</if>
  305. <if test="rsName != null and rsName != ''">RS_NAME = #{rsName},</if>
  306. <if test="hasDamRegCode != null and hasDamRegCode != ''">HAS_DAM_REG_CODE = #{hasDamRegCode},</if>
  307. <if test="damRegCode != null and damRegCode != ''">DAM_REG_CODE = #{damRegCode},</if>
  308. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  309. <if test="location != null and location != ''">LOCATION = #{location},</if>
  310. <if test="hystSite != null and hystSite != ''">HYST_SITE = #{hystSite},</if>
  311. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  312. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  313. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  314. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  315. <if test="rsAdmCode != null and rsAdmCode != ''">RS_ADM_CODE = #{rsAdmCode},</if>
  316. <if test="rsAdmName != null and rsAdmName != ''">RS_ADM_NAME = #{rsAdmName},</if>
  317. <if test="engScal != null and engScal != ''">ENG_SCAL = #{engScal},</if>
  318. <if test="rsClass != null and rsClass != ''">RS_CLASS = #{rsClass},</if>
  319. <if test="safeStat != null and safeStat != ''">SAFE_STAT = #{safeStat},</if>
  320. </trim>
  321. <include refid="page_where"/>
  322. </update>
  323. <!-- 其他自定义SQL -->
  324. <select id="getListRsmlByInspGroupIdObjType" resultType="cn.com.goldenwater.dcproj.model.BisInspRsmlRgstr"
  325. parameterType="cn.com.goldenwater.dcproj.param.PagePersObjParam">
  326. select t.*, C.id groupId, C.PNM groupName, B.obj_id
  327. FROM ATT_RS_BASE T
  328. JOIN BIS_INSP_ALL_OBJ B ON B.CODE = T.RS_CODE
  329. LEFT JOIN BIS_INSP_ALL C ON B.ID = C.ID AND B.PTYPE = #{objType}
  330. <where>
  331. <if test="wtdstNm !=null and wtdstNm !=''">and b.nm like '%${wtdstNm}%'</if>
  332. <if test='isAll == "0"'>and B.ID = #{inspGroupId}</if>
  333. <if test='isAll == "1"'>and B.ID LIKE '${inspGroupId}%'</if>
  334. <if test="adCode != null and adCode != ''">and t.adm_div like '${adCode}%'</if>
  335. <choose>
  336. <when test="province != null and province != ''">
  337. and B.AD_CODE LIKE '${province}%'
  338. </when>
  339. <otherwise>
  340. and B.AD_CODE is null
  341. </otherwise>
  342. </choose>
  343. </where>
  344. </select>
  345. <select id="getRsmlList" parameterType="cn.com.goldenwater.dcproj.param.BisInspRsmlRgstrParam"
  346. resultType="cn.com.goldenwater.dcproj.dto.BisInspRsmlRgstrDto">
  347. select * from (
  348. select
  349. A.CODE, A.ID, A.NM, A.PTYPE, A.LGTD, A.LTTD,
  350. A.OBJ_ID, A.IS_SET_OBJ, A.LGTDPC, A.LTTDPC,
  351. A.OBJ_INTM, A.ORG_ID, A.OBJ_AD_CODE,
  352. b.id as rgstrId, B.INTM,B.UPTM,B.PRES_STATE,B.PROJECT_STATE,
  353. B.RUN_MANAGE_STATE, B.NORMZ,B.SAFE_STAT,B.AD_CODE, B.FSLTDZ,
  354. B.ENG_SCAL, B.INSP_TYPE, B.IS_ACTION, B.IS_SAF, B.IS_SITE,
  355. B.LOCATION,B.RS_ADM_NAME, B.TOT_CAP,
  356. (case when b.rs_name is null then cast(c.RS_NAME as char) else b.RS_NAME end) as name,
  357. (case when b.HYST_SITE is null then b.location else b.HYST_SITE end) as hystSite,
  358. (case when b.CENTER_X is null then c.CENTER_X else b.CENTER_X end) as centerX,
  359. (case when b.CENTER_Y is null then c.CENTER_Y else b.CENTER_Y end) as centerY,
  360. CASE WHEN B.STATE IS NULL THEN '0' ELSE B.STATE END AS state,
  361. c.RS_CODE as baseId, ia.pnm groupName, ria.pnm riverName, ad.ad_full_name
  362. FROM BIS_INSP_ALL_OBJ A
  363. JOIN BIS_INSP_RSML_RGSTR B ON A.OBJ_ID = B.OBJ_ID
  364. LEFT JOIN ATT_RS_BASE C ON A.CODE = C.RS_CODE
  365. LEFT JOIN ATT_AD_X_BASE AD ON B.AD_CODE = AD.AD_CODE
  366. LEFT JOIN BIS_INSP_ALL IA ON A.ID = IA.ID
  367. LEFT JOIN BIS_INSP_ALL RIA ON SUBSTR(A.ID,1,6) = RIA.ID
  368. where 1 = 1
  369. <if test="tabType =='2'.toString()">
  370. and ia.entm &lt;DATE_ADD(STR_TO_DATE(#{nowTime},'%Y-%m-%d') ,INTERVAL 1 DAY)
  371. </if>
  372. <if test="tabType =='1'.toString()">
  373. and ia.entm &gt;=STR_TO_DATE(#{nowTime},'%Y-%m-%d')
  374. </if>
  375. <include refid="choseSql"/>
  376. <if test="engScal != null and engScal != ''">and b.ENG_SCAL = #{engScal}</if>
  377. <if test="adName != null and adName != ''">and ad.AD_FULL_NAME LIKE '%${adName}%'</if>
  378. <if test="groupId != null and groupId != ''">and A.id = #{groupId}</if>
  379. <if test="adCode != null and adCode !=''">and B.AD_CODE like '${adCode}%'</if>
  380. <if test="orgId != null and orgId !=''">and A.org_id =#{orgId}</if>
  381. <if test="plnaId !=null and plnaId !=''">
  382. and A.id like '${plnaId}%'
  383. </if>
  384. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  385. AND B.INTM &gt;= STR_TO_DATE(#{sttm},'%Y-%m-%d') AND B.UPTM &lt; DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') ,INTERVAL 1 DAY)
  386. </if>
  387. and
  388. REGEXP_LIKE(
  389. A.Id,concat('^(',
  390. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION A WHERE PERSID =#{persId}
  391. <include refid="choseSql"/>
  392. and id like '022%')>0 then
  393. (SELECT group_concat(id separator '|') as
  394. id FROM BIS_INSP_ALL_RLATION A WHERE PERSID =#{persId}
  395. <include refid="choseSql"/>
  396. and id like '022%' GROUP BY PERSID )
  397. else (select 'non' from dual) end)
  398. ,')'))
  399. ) w where 1 = 1
  400. <if test="state != null and state != ''">
  401. and state = #{state}
  402. </if>
  403. <if test="rsName != null and rsName != ''">
  404. and name like '%${rsName}%'
  405. </if>
  406. <if test="orgName != null and orgName != ''">
  407. and riverName like '${orgName}%'
  408. </if>
  409. ORDER BY AD_CODE
  410. </select>
  411. <select id="findRsmlList" parameterType="cn.com.goldenwater.dcproj.param.TypeParam"
  412. resultType="cn.com.goldenwater.dcproj.dto.BisInspRgstrDto">
  413. select * from (
  414. select
  415. A.*,
  416. b.id as rgstrId,CASE WHEN B.STATE IS NULL THEN '0' ELSE B.STATE END AS state,
  417. (case when b.rs_name is null then cast(c.rs_name as char) else b.rs_name end) as name,
  418. b.intm as IN_TM,b.uptm as Up_tm,b.eng_Scal, b.NORMZ, b.FSLTDZ, b.SAFE_STAT, B.INSP_TYPE, B.IS_ACTION, B.IS_SAF, B.IS_SITE,
  419. c.rs_code as baseId,b.location,ia.pnm groupName,
  420. ria.pnm riverName,ad.ad_full_name as ad_name
  421. from BIS_INSP_ALL_OBJ A
  422. join BIS_INSP_RSML_RGSTR B on A.Obj_Id = B.Obj_Id
  423. left join ATT_RS_BASE c on a.code = c.rs_code
  424. left join ATT_AD_X_BASE ad on b.ad_code = ad.ad_code
  425. LEFT JOIN BIS_INSP_ALL ia on A.ID = ia.id
  426. left join BIS_INSP_ALL ria on substr(A.ID,1,6) = ria.id
  427. where 1 = 1
  428. <if test="tabType =='2'.toString()">
  429. and ia.entm &lt;DATE_ADD(STR_TO_DATE(#{nowTime},'%Y-%m-%d') ,INTERVAL 1 DAY)
  430. </if>
  431. <if test="tabType =='1'.toString()">
  432. and ia.entm &gt;=STR_TO_DATE(#{nowTime},'%Y-%m-%d')
  433. </if>
  434. <include refid="choseSql"/>
  435. <if test="adName != null and adName != ''">and ad.AD_FULL_NAME LIKE '%${adName}%'</if>
  436. <if test="groupId != null and groupId != ''">and A.id = #{groupId}</if>
  437. <if test="adCode != null and adCode !=''">and B.AD_CODE like '${adCode}%'</if>
  438. <if test="code != null and code !=''">and B.AD_CODE like '${code}%'</if>
  439. <if test="engScal != null and engScal !=''">and B.eng_Scal in (${engScal})</if>
  440. <if test="plnaId !=null and plnaId !=''">
  441. and A.id like '${plnaId}%'
  442. </if>
  443. <if test="orgId != null and orgId !=''">and A.id like '___${orgId}%'</if>
  444. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  445. AND B.intm &gt;= STR_TO_DATE(#{sttm},'%Y-%m-%d') AND B.uptm &lt; DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d') ,INTERVAL 1 DAY)
  446. </if>
  447. and
  448. REGEXP_LIKE(
  449. A.Id,concat('^(',
  450. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{presId} and id like '022%')>0 then
  451. (SELECT group_concat(id separator '|') as
  452. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{presId} and id like '022%' GROUP BY PERSID )
  453. else (select 'non' from dual) end)
  454. ,')'))
  455. ) w where 1 = 1
  456. <if test="state != null and state != ''">
  457. and state in (${state})
  458. </if>
  459. <if test="name != null and name != ''">
  460. and name like '%${name}%'
  461. </if>
  462. order by state asc
  463. <if test="orderBy != null and orderBy != ''">
  464. ,${orderBy}
  465. </if>
  466. </select>
  467. <sql id="choseSql">
  468. <choose>
  469. <when test="province !=null and province !=''">
  470. and A.AD_Code = '${province}'
  471. </when>
  472. <otherwise>
  473. and A.AD_CODE is null
  474. </otherwise>
  475. </choose>
  476. </sql>
  477. <select id="getRsmlByIdNm" resultType="cn.com.goldenwater.dcproj.model.BisInspRsmlRgstr">
  478. select a.*,b.id rgstrId,b.rs_name from bis_insp_all_obj a left join bis_insp_rsml_rgstr b on a.obj_id=b.obj_id where A.id=#{groupId} and a.nm like '%${nm}%'
  479. </select>
  480. </mapper>