BisInspSdRgstrDao.xml 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472
  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.BisInspSdRgstrDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspSdRgstr" id="bisInspSdRgstrResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="objId" column="OBJ_ID"/>
  7. <result property="sdCode" column="SD_CODE"/>
  8. <result property="sdName" column="SD_NAME"/>
  9. <result property="sdType" column="SD_TYPE"/>
  10. <result property="sdTypeStr" column="SD_TYPE_STR"/>
  11. <result property="conArea" column="CON_AREA"/>
  12. <result property="totCap" column="TOT_CAP"/>
  13. <result property="flcoCap" column="FLCO_CAP"/>
  14. <result property="sdrCap" column="SDR_CAP"/>
  15. <result property="flcoYear" column="FLCO_YEAR"/>
  16. <result property="warpCap" column="WARP_CAP"/>
  17. <result property="damSizeHig" column="DAM_SIZE_HIG"/>
  18. <result property="damTopLen" column="DAM_TOP_LEN"/>
  19. <result property="adCode" column="AD_CODE"/>
  20. <result property="sdLoc" column="SD_LOC"/>
  21. <result property="centerX" column="CENTER_X"/>
  22. <result property="centerY" column="CENTER_Y"/>
  23. <result property="gdX" column="GD_X"/>
  24. <result property="gdY" column="GD_Y"/>
  25. <result property="asinttds" column="ASINTTDS"/>
  26. <result property="noSpway" column="NO_SPWAY"/>
  27. <result property="damTear" column="DAM_TEAR"/>
  28. <result property="damLandSubSide" column="DAM_LAND_SUB_SIDE"/>
  29. <result property="damRsog" column="DAM_RSOG"/>
  30. <result property="damLopc" column="DAM_LOPC"/>
  31. <result property="dsLts" column="DS_LTS"/>
  32. <result property="dsCc" column="DS_CC"/>
  33. <result property="dsOc" column="DS_OC"/>
  34. <result property="frsMar" column="FRS_MAR"/>
  35. <result property="frsTbd" column="FRS_TBD"/>
  36. <result property="frsOth" column="FRS_OTH"/>
  37. <result property="note" column="NOTE"/>
  38. <result property="state" column="STATE"/>
  39. <result property="dataStat" column="DATA_STAT"/>
  40. <result property="persId" column="PERS_ID"/>
  41. <result property="groupId" column="GROUP_ID"/>
  42. <result property="inTm" column="IN_TM"/>
  43. <result property="upTm" column="UP_TM"/>
  44. <result property="adName" column="AD_NAME"/>
  45. <result property="province" column="PROVINCE"/>
  46. </resultMap>
  47. <sql id="table_columns">
  48. ID,
  49. OBJ_ID,
  50. SD_CODE,
  51. SD_NAME,
  52. SD_TYPE,
  53. SD_TYPE_STR,
  54. CON_AREA,
  55. TOT_CAP,
  56. FLCO_CAP,
  57. SDR_CAP,
  58. FLCO_YEAR,
  59. WARP_CAP,
  60. DAM_SIZE_HIG,
  61. DAM_TOP_LEN,
  62. AD_CODE,
  63. SD_LOC,
  64. CENTER_X,
  65. CENTER_Y,
  66. GD_X,
  67. GD_Y,
  68. ASINTTDS,
  69. NO_SPWAY,
  70. DAM_TEAR,
  71. DAM_LAND_SUB_SIDE,
  72. DAM_RSOG,
  73. DAM_LOPC,
  74. DS_LTS,
  75. DS_CC,
  76. DS_OC,
  77. FRS_MAR,
  78. FRS_TBD,
  79. FRS_OTH,
  80. NOTE,
  81. STATE,
  82. DATA_STAT,
  83. PERS_ID,
  84. GROUP_ID,
  85. IN_TM,
  86. UP_TM,
  87. AD_NAME,PROVINCE
  88. </sql>
  89. <sql id="entity_properties">
  90. #{id},
  91. #{objId},
  92. #{sdCode},
  93. #{sdName},
  94. #{sdType},
  95. #{sdTypeStr},
  96. #{conArea},
  97. #{totCap},
  98. #{flcoCap},
  99. #{sdrCap},
  100. #{flcoYear},
  101. #{warpCap},
  102. #{damSizeHig},
  103. #{damTopLen},
  104. #{adCode},
  105. #{sdLoc},
  106. #{centerX},
  107. #{centerY},
  108. #{gdX},
  109. #{gdY},
  110. #{asinttds},
  111. #{noSpway},
  112. #{damTear},
  113. #{damLandSubSide},
  114. #{damRsog},
  115. #{damLopc},
  116. #{dsLts},
  117. #{dsCc},
  118. #{dsOc},
  119. #{frsMar},
  120. #{frsTbd},
  121. #{frsOth},
  122. #{note},
  123. #{state},
  124. #{dataStat},
  125. #{persId},
  126. #{groupId},
  127. #{inTm},
  128. #{upTm},
  129. #{adName},#{province}
  130. </sql>
  131. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  132. <sql id="page_where">
  133. <trim prefix="where" prefixOverrides="and | or ">
  134. <if test="objId != null and objId != ''">and OBJ_ID = #{objId}</if>
  135. <choose>
  136. <when test="province !=null and province !=''">
  137. and province =#{province}
  138. </when>
  139. <otherwise>
  140. and province is null
  141. </otherwise>
  142. </choose>
  143. <if test="sdCode != null and sdCode != ''">and SD_CODE = #{sdCode}</if>
  144. <if test="sdName != null and sdName != ''">and SD_NAME = #{sdName}</if>
  145. <if test="sdType != null and sdType != ''">and SD_TYPE = #{sdType}</if>
  146. <if test="sdTypeStr != null and sdTypeStr != ''">and SD_TYPE_STR = #{sdTypeStr}</if>
  147. <if test="conArea != null and conArea != ''">and CON_AREA = #{conArea}</if>
  148. <if test="totCap != null and totCap != ''">and TOT_CAP = #{totCap}</if>
  149. <if test="flcoCap != null and flcoCap != ''">and FLCO_CAP = #{flcoCap}</if>
  150. <if test="sdrCap != null and sdrCap != ''">and SDR_CAP = #{sdrCap}</if>
  151. <if test="flcoYear != null and flcoYear != ''">and FLCO_YEAR = #{flcoYear}</if>
  152. <if test="warpCap != null and warpCap != ''">and WARP_CAP = #{warpCap}</if>
  153. <if test="damSizeHig != null and damSizeHig != ''">and DAM_SIZE_HIG = #{damSizeHig}</if>
  154. <if test="damTopLen != null and damTopLen != ''">and DAM_TOP_LEN = #{damTopLen}</if>
  155. <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
  156. <if test="sdLoc != null and sdLoc != ''">and SD_LOC = #{sdLoc}</if>
  157. <if test="centerX != null and centerX != ''">and CENTER_X = #{centerX}</if>
  158. <if test="centerY != null and centerY != ''">and CENTER_Y = #{centerY}</if>
  159. <if test="gdX != null and gdX != ''">and GD_X = #{gdX}</if>
  160. <if test="gdY != null and gdY != ''">and GD_Y = #{gdY}</if>
  161. <if test="asinttds != null and asinttds != ''">and ASINTTDS = #{asinttds}</if>
  162. <if test="noSpway != null and noSpway != ''">and NO_SPWAY = #{noSpway}</if>
  163. <if test="damTear != null and damTear != ''">and DAM_TEAR = #{damTear}</if>
  164. <if test="damLandSubSide != null and damLandSubSide != ''">and DAM_LAND_SUB_SIDE = #{damLandSubSide}</if>
  165. <if test="damRsog != null and damRsog != ''">and DAM_RSOG = #{damRsog}</if>
  166. <if test="damLopc != null and damLopc != ''">and DAM_LOPC = #{damLopc}</if>
  167. <if test="dsLts != null and dsLts != ''">and DS_LTS = #{dsLts}</if>
  168. <if test="dsCc != null and dsCc != ''">and DS_CC = #{dsCc}</if>
  169. <if test="dsOc != null and dsOc != ''">and DS_OC = #{dsOc}</if>
  170. <if test="frsMar != null and frsMar != ''">and FRS_MAR = #{frsMar}</if>
  171. <if test="frsTbd != null and frsTbd != ''">and FRS_TBD = #{frsTbd}</if>
  172. <if test="frsOth != null and frsOth != ''">and FRS_OTH = #{frsOth}</if>
  173. <if test="note != null and note != ''">and NOTE = #{note}</if>
  174. <if test="state != null and state != ''">and STATE = #{state}</if>
  175. <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
  176. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  177. <if test="groupId != null and groupId != ''">and GROUP_ID = #{groupId}</if>
  178. <if test="inTm != null">and IN_TM = #{inTm}</if>
  179. <if test="upTm != null">and UP_TM = #{upTm}</if>
  180. <if test="adName != null and adName != ''">and AD_NAME = #{adName}</if>
  181. </trim>
  182. </sql>
  183. <select id="get" resultMap="bisInspSdRgstrResultMap" parameterType="String" >
  184. select <include refid="table_columns" /> from BIS_INSP_SD_RGSTR where ID = #{id}
  185. </select>
  186. <select id="getBy" resultMap="bisInspSdRgstrResultMap">
  187. select <include refid="table_columns" /> from BIS_INSP_SD_RGSTR <include refid="page_where" />
  188. </select>
  189. <select id="findAll" resultMap="bisInspSdRgstrResultMap">
  190. select <include refid="table_columns" /> from BIS_INSP_SD_RGSTR
  191. </select>
  192. <select id="findList" resultMap="bisInspSdRgstrResultMap">
  193. select <include refid="table_columns" /> from BIS_INSP_SD_RGSTR <include refid="page_where" />
  194. </select>
  195. <select id="selectCount" resultType="int" >
  196. select count(ID) from BIS_INSP_SD_RGSTR <include refid="page_where" />
  197. </select>
  198. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspSdRgstr">
  199. insert into BIS_INSP_SD_RGSTR( <include refid="table_columns" /> )
  200. values ( <include refid="entity_properties" /> )
  201. </insert>
  202. <delete id="delete" parameterType="java.lang.String">
  203. delete from BIS_INSP_SD_RGSTR where ID = #{id}
  204. </delete>
  205. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspSdRgstr">
  206. delete from BIS_INSP_SD_RGSTR <include refid="page_where" />
  207. </delete>
  208. <update id="deleteInFlag" parameterType="java.lang.String">
  209. update BIS_INSP_SD_RGSTR set flag_valid = 0 where ID = #{id}
  210. </update>
  211. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspSdRgstr">
  212. update BIS_INSP_SD_RGSTR
  213. <trim prefix="set" suffixOverrides=",">
  214. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  215. <if test="sdCode != null and sdCode != ''">SD_CODE = #{sdCode},</if>
  216. <if test="sdName != null and sdName != ''">SD_NAME = #{sdName},</if>
  217. <if test="sdType != null and sdType != ''">SD_TYPE = #{sdType},</if>
  218. <if test="sdTypeStr != null and sdTypeStr != ''">SD_TYPE_STR = #{sdTypeStr},</if>
  219. <if test="conArea != null and conArea != ''">CON_AREA = #{conArea},</if>
  220. <if test="totCap != null and totCap != ''">TOT_CAP = #{totCap},</if>
  221. <if test="flcoCap != null and flcoCap != ''">FLCO_CAP = #{flcoCap},</if>
  222. <if test="sdrCap != null and sdrCap != ''">SDR_CAP = #{sdrCap},</if>
  223. <if test="flcoYear != null and flcoYear != ''">FLCO_YEAR = #{flcoYear},</if>
  224. <if test="warpCap != null and warpCap != ''">WARP_CAP = #{warpCap},</if>
  225. <if test="damSizeHig != null and damSizeHig != ''">DAM_SIZE_HIG = #{damSizeHig},</if>
  226. <if test="damTopLen != null and damTopLen != ''">DAM_TOP_LEN = #{damTopLen},</if>
  227. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  228. <if test="province != null and province != ''"> PROVINCE = #{province},</if>
  229. <if test="sdLoc != null and sdLoc != ''">SD_LOC = #{sdLoc},</if>
  230. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  231. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  232. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  233. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  234. <if test="asinttds != null and asinttds != ''">ASINTTDS = #{asinttds},</if>
  235. <if test="noSpway != null and noSpway != ''">NO_SPWAY = #{noSpway},</if>
  236. <if test="damTear != null and damTear != ''">DAM_TEAR = #{damTear},</if>
  237. <if test="damLandSubSide != null and damLandSubSide != ''">DAM_LAND_SUB_SIDE = #{damLandSubSide},</if>
  238. <if test="damRsog != null and damRsog != ''">DAM_RSOG = #{damRsog},</if>
  239. <if test="damLopc != null and damLopc != ''">DAM_LOPC = #{damLopc},</if>
  240. <if test="dsLts != null and dsLts != ''">DS_LTS = #{dsLts},</if>
  241. <if test="dsCc != null and dsCc != ''">DS_CC = #{dsCc},</if>
  242. <if test="dsOc != null and dsOc != ''">DS_OC = #{dsOc},</if>
  243. <if test="frsMar != null and frsMar != ''">FRS_MAR = #{frsMar},</if>
  244. <if test="frsTbd != null and frsTbd != ''">FRS_TBD = #{frsTbd},</if>
  245. <if test="frsOth != null and frsOth != ''">FRS_OTH = #{frsOth},</if>
  246. <if test="note != null and note != ''">NOTE = #{note},</if>
  247. <if test="state != null and state != ''">STATE = #{state},</if>
  248. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  249. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  250. <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
  251. <if test="inTm != null">IN_TM = #{inTm},</if>
  252. <if test="upTm != null">UP_TM = #{upTm},</if>
  253. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  254. </trim>
  255. <where>ID = #{id}</where>
  256. </update>
  257. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspSdRgstr">
  258. update BIS_INSP_SD_RGSTR
  259. <trim prefix="set" suffixOverrides=",">
  260. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  261. <if test="sdCode != null and sdCode != ''">SD_CODE = #{sdCode},</if>
  262. <if test="sdName != null and sdName != ''">SD_NAME = #{sdName},</if>
  263. <if test="sdType != null and sdType != ''">SD_TYPE = #{sdType},</if>
  264. <if test="sdTypeStr != null and sdTypeStr != ''">SD_TYPE_STR = #{sdTypeStr},</if>
  265. <if test="conArea != null and conArea != ''">CON_AREA = #{conArea},</if>
  266. <if test="totCap != null and totCap != ''">TOT_CAP = #{totCap},</if>
  267. <if test="province != null and province != ''"> PROVINCE = #{province},</if>
  268. <if test="flcoCap != null and flcoCap != ''">FLCO_CAP = #{flcoCap},</if>
  269. <if test="sdrCap != null and sdrCap != ''">SDR_CAP = #{sdrCap},</if>
  270. <if test="flcoYear != null and flcoYear != ''">FLCO_YEAR = #{flcoYear},</if>
  271. <if test="warpCap != null and warpCap != ''">WARP_CAP = #{warpCap},</if>
  272. <if test="damSizeHig != null and damSizeHig != ''">DAM_SIZE_HIG = #{damSizeHig},</if>
  273. <if test="damTopLen != null and damTopLen != ''">DAM_TOP_LEN = #{damTopLen},</if>
  274. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  275. <if test="sdLoc != null and sdLoc != ''">SD_LOC = #{sdLoc},</if>
  276. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  277. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  278. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  279. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  280. <if test="asinttds != null and asinttds != ''">ASINTTDS = #{asinttds},</if>
  281. <if test="noSpway != null and noSpway != ''">NO_SPWAY = #{noSpway},</if>
  282. <if test="damTear != null and damTear != ''">DAM_TEAR = #{damTear},</if>
  283. <if test="damLandSubSide != null and damLandSubSide != ''">DAM_LAND_SUB_SIDE = #{damLandSubSide},</if>
  284. <if test="damRsog != null and damRsog != ''">DAM_RSOG = #{damRsog},</if>
  285. <if test="damLopc != null and damLopc != ''">DAM_LOPC = #{damLopc},</if>
  286. <if test="dsLts != null and dsLts != ''">DS_LTS = #{dsLts},</if>
  287. <if test="dsCc != null and dsCc != ''">DS_CC = #{dsCc},</if>
  288. <if test="dsOc != null and dsOc != ''">DS_OC = #{dsOc},</if>
  289. <if test="frsMar != null and frsMar != ''">FRS_MAR = #{frsMar},</if>
  290. <if test="frsTbd != null and frsTbd != ''">FRS_TBD = #{frsTbd},</if>
  291. <if test="frsOth != null and frsOth != ''">FRS_OTH = #{frsOth},</if>
  292. <if test="note != null and note != ''">NOTE = #{note},</if>
  293. <if test="state != null and state != ''">STATE = #{state},</if>
  294. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  295. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  296. <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
  297. <if test="inTm != null">IN_TM = #{inTm},</if>
  298. <if test="upTm != null">UP_TM = #{upTm},</if>
  299. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  300. </trim>
  301. <include refid="page_where" />
  302. </update>
  303. <sql id="choseSql">
  304. <choose>
  305. <when test="province !=null and province !=''">
  306. and B.province like '${province}%'
  307. </when>
  308. <otherwise>
  309. and B.province is null
  310. </otherwise>
  311. </choose>
  312. </sql>
  313. <sql id="orgIdSql">
  314. <choose>
  315. <when test="orgId !=null and orgId !=''">
  316. and ORG_ID=#{orgId}
  317. </when>
  318. <otherwise>
  319. and ORG_ID is null
  320. </otherwise>
  321. </choose>
  322. </sql>
  323. <select id="getListByInspGroupIdObjType" resultType="cn.com.goldenwater.dcproj.dto.BisInspSdRgstrDto"
  324. parameterType="cn.com.goldenwater.dcproj.param.PagePersObjParam">
  325. select t.*,C.id groupId,C.PNM groupName,B.obj_id
  326. from att_sd_base t
  327. left join BIS_INSP_ALL_OBJ B
  328. on B.CODE = t.sd_code
  329. LEFT JOIN BIS_INSP_ALL C ON B.ID = C.ID
  330. and B.ptype = #{objType}
  331. where 1 = 1
  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 != ''">
  335. and t.AD_CODE like '${adCode}%'
  336. </if>
  337. <choose>
  338. <when test="province != null and province != ''">
  339. and B.AD_CODE LIKE '${province}%'
  340. </when>
  341. <otherwise>
  342. and B.AD_CODE is null
  343. </otherwise>
  344. </choose>
  345. </select>
  346. <!-- 其他自定义SQL -->
  347. <select id="findPcPage" parameterType="cn.com.goldenwater.dcproj.param.BisInspSdRgstrParam" resultType="cn.com.goldenwater.dcproj.dto.BisInspSdRgstrDto">
  348. select * from (
  349. select A.*,b.id as rgstrId,CASE WHEN B.STATE IS NULL THEN '0' ELSE B.STATE END AS fscState,(case when b.SD_name is
  350. null then to_char(c.SD_name) else b.SD_name end) as name,b.IN_TM,b.UP_TM,B.ad_code,
  351. c.sd_code as baseId,
  352. (case when b.CENTER_X is null then c.CENTER_X else b.CENTER_X end) as centerX,
  353. (case when b.CENTER_Y is null then c.CENTER_Y else b.CENTER_Y end) as centerY,
  354. (case when b.SD_LOC is null then c.SD_LOC else b.SD_LOC end) as location,ia.pnm groupName,ria.pnm
  355. riverName,ad.ad_full_name from BIS_INSP_ALL_OBJ A join BIS_INSP_SD_RGSTR B on A.Obj_Id =
  356. B.Obj_Id left join att_SD_base c on a.code = c.SD_CODE
  357. left join ATT_AD_X_BASE ad on b.ad_code = ad.ad_code LEFT JOIN BIS_INSP_ALL ia on A.ID = ia.id
  358. left join BIS_INSP_ALL ria on substr(A.ID,0,6) = ria.id
  359. where 1 = 1
  360. <if test="tabType =='2'.toString()">
  361. and ia.entm &lt;to_date(#{nowTime},'yyyy-MM-dd')+1
  362. </if>
  363. <if test="tabType =='1'.toString()">
  364. and ia.entm &gt;=to_date(#{nowTime},'yyyy-MM-dd')
  365. </if>
  366. <include refid="choseSql"/>
  367. <if test="adName != null and adName != ''">and ad.AD_FULL_NAME LIKE '%${adName}%'</if>
  368. <if test="groupId != null and groupId != ''">and A.id = #{groupId}</if>
  369. <if test="orgId != null and orgId !=''">and A.id like '${orgId}%'</if>
  370. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  371. AND B.IN_TM &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND B.UP_TM &lt; TO_DATE(#{entm},'YYYY-MM-DD')+1
  372. </if>
  373. and
  374. REGEXP_LIKE(
  375. A.Id,'^('||
  376. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{presId}
  377. <include refid="orgIdSql"/>
  378. )>0 then
  379. (SELECT LISTAGG(id, '|') as
  380. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{presId}
  381. <include refid="orgIdSql"/> group by persid
  382. )
  383. else (select 'non' from dual) end)
  384. ||')')
  385. ) where 1 = 1
  386. <if test="state != null and state != ''">
  387. and fscState in (${state})
  388. </if>
  389. <if test="sdName != null and sdName != ''">
  390. and name like '%${sdName}%'
  391. </if>
  392. <if test="adCode != null and adCode != ''">
  393. and ad_code like '${adCode}%'
  394. </if>
  395. </select>
  396. <select id="findSdPage" parameterType="cn.com.goldenwater.dcproj.param.TypeParam" resultType="cn.com.goldenwater.dcproj.dto.BisInspSdRgstrDto" >
  397. SELECT * FROM (
  398. select A.CODE,A.ID nodeId,
  399. A.NM,
  400. #{pType} PTYPE,
  401. B.sd_type sdType,
  402. B.center_X,
  403. B.center_y,
  404. B.GD_X,
  405. B.GD_y,
  406. A.OBJ_ID,B.ID ID,
  407. (case when b.sd_loc is null then c.sd_loc else b.sd_loc end) as location,
  408. (case when b.State is null then '0' else b.state end)STATE
  409. ,B.IN_TM
  410. from BIS_INSP_ALL_OBJ
  411. A LEFT JOIN BIS_INSP_SD_RGSTR B ON A.OBJ_ID=B.OBJ_ID
  412. LEFT JOIN ATT_SD_BASE C ON A.CODE=C.SD_CODE
  413. LEFT JOIN BIS_INSP_ALL ia on A.id=ia.id
  414. where A.ptype= #{pType}
  415. <if test="tabType =='2'.toString()">
  416. and ia.entm &lt;to_date(#{nowTime},'yyyy-MM-dd')+1
  417. </if>
  418. <if test="tabType =='1'.toString()">
  419. and ia.entm &gt;=to_date(#{nowTime},'yyyy-MM-dd')
  420. </if>
  421. and REGEXP_LIKE(
  422. A.Id,'^('||
  423. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{presId}
  424. <include refid="orgIdSql"/>
  425. )>0 then
  426. (SELECT LISTAGG(id, '|') as
  427. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{presId}
  428. <include refid="orgIdSql"/> group persid
  429. )
  430. else (select 'non' from dual) end)
  431. ||')')
  432. ) A WHERE a.PTYPE=#{pType}
  433. <if test="plnaId !=null and plnaId !=''">
  434. and a.nodeId like '${plnaId}%'
  435. </if>
  436. <if test="state !=null and state !=''">
  437. and STATE=#{state}
  438. </if>
  439. <if test="rsName !=null and rsName !=''">
  440. and a.nm like '%${rsName}%'
  441. </if>
  442. <if test="code !=null and code !=''">
  443. and a.code = #{code}
  444. </if>
  445. order by nodeId asc
  446. <if test="orderBy != null and orderBy != ''">
  447. ,nlssort(nm,'NLS_SORT=SCHINESE_PINYIN_M')
  448. </if>
  449. </select>
  450. </mapper>