BisInspSwhsRgstrDao.xml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433
  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.BisInspSwhsRgstrDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspSwhsRgstr" id="bisInspSwhsRgstrResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="objId" column="OBJ_ID"/>
  7. <result property="swhsId" column="SWHS_ID"/>
  8. <result property="swhsCode" column="SWHS_CODE"/>
  9. <result property="swhsName" column="SWHS_NAME"/>
  10. <result property="insName" column="INS_NAME"/>
  11. <result property="insPers" column="INS_PERS"/>
  12. <result property="insWaterPers" column="INS_WATER_PERS"/>
  13. <result property="adCode" column="AD_CODE"/>
  14. <result property="swhsLoc" column="SWHS_LOC"/>
  15. <result property="centerX" column="CENTER_X"/>
  16. <result property="centerY" column="CENTER_Y"/>
  17. <result property="gdX" column="GD_X"/>
  18. <result property="gdY" column="GD_Y"/>
  19. <result property="wainWasoType" column="WAIN_WASO_TYPE"/>
  20. <result property="watArea" column="WAT_AREA"/>
  21. <result property="wainNum" column="WAIN_NUM"/>
  22. <result property="wainUse" column="WAIN_USE"/>
  23. <result property="wasuObjType" column="WASU_OBJ_TYPE"/>
  24. <result property="desAnnWain" column="DES_ANN_WAIN"/>
  25. <result property="desAnnWasuPop" column="DES_ANN_WASU_POP"/>
  26. <result property="waquGoal" column="WAQU_GOAL"/>
  27. <result property="ifMonWqua" column="IF_MON_WQUA"/>
  28. <result property="wquaCat" column="WQUA_CAT"/>
  29. <result property="ifWquaUptoSta" column="IF_WQUA_UPTO_STA"/>
  30. <result property="note" column="NOTE"/>
  31. <result property="state" column="STATE"/>
  32. <result property="dataStat" column="DATA_STAT"/>
  33. <result property="persId" column="PERS_ID"/>
  34. <result property="groupId" column="GROUP_ID"/>
  35. <result property="inTm" column="IN_TM"/>
  36. <result property="upTm" column="UP_TM"/>
  37. <result property="safetyStat" column="SAFETY_STAT"/>
  38. <result property="measuresStat" column="MEASURES_STAT"/>
  39. <result property="waterStat" column="WATER_STAT"/>
  40. <result property="insTel" column="INS_TEL"/>
  41. <result property="insWaterUnit" column="INS_WATER_UNIT"/>
  42. <result property="insWaterTel" column="INS_WATER_TEL"/>
  43. <result property="province" column="PROVINCE"/>
  44. </resultMap>
  45. <sql id="table_columns">
  46. ID,PROVINCE,
  47. OBJ_ID,
  48. SWHS_ID,
  49. SWHS_CODE,
  50. SWHS_NAME,
  51. INS_NAME,
  52. INS_PERS,
  53. INS_WATER_PERS,
  54. AD_CODE,
  55. SWHS_LOC,
  56. CENTER_X,
  57. CENTER_Y,
  58. GD_X,
  59. GD_Y,
  60. WAIN_WASO_TYPE,
  61. WAT_AREA,
  62. WAIN_NUM,
  63. WAIN_USE,
  64. WASU_OBJ_TYPE,
  65. DES_ANN_WAIN,
  66. DES_ANN_WASU_POP,
  67. WAQU_GOAL,
  68. IF_MON_WQUA,
  69. WQUA_CAT,
  70. IF_WQUA_UPTO_STA,
  71. NOTE,
  72. STATE,
  73. DATA_STAT,
  74. PERS_ID,
  75. GROUP_ID,
  76. IN_TM,
  77. UP_TM,
  78. SAFETY_STAT,
  79. MEASURES_STAT,
  80. WATER_STAT,
  81. INS_TEL,
  82. INS_WATER_UNIT,
  83. INS_WATER_TEL
  84. </sql>
  85. <sql id="entity_properties">
  86. #{id},#{province},
  87. #{objId},
  88. #{swhsId},
  89. #{swhsCode},
  90. #{swhsName},
  91. #{insName},
  92. #{insPers},
  93. #{insWaterPers},
  94. #{adCode},
  95. #{swhsLoc},
  96. #{centerX},
  97. #{centerY},
  98. #{gdX},
  99. #{gdY},
  100. #{wainWasoType},
  101. #{watArea},
  102. #{wainNum},
  103. #{wainUse},
  104. #{wasuObjType},
  105. #{desAnnWain},
  106. #{desAnnWasuPop},
  107. #{waquGoal},
  108. #{ifMonWqua},
  109. #{wquaCat},
  110. #{ifWquaUptoSta},
  111. #{note},
  112. #{state},
  113. #{dataStat},
  114. #{persId},
  115. #{groupId},
  116. #{inTm},
  117. #{upTm},
  118. #{safetyStat},
  119. #{measuresStat},
  120. #{waterStat},
  121. #{insTel},
  122. #{insWaterUnit},
  123. #{insWaterTel}
  124. </sql>
  125. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  126. <sql id="page_where">
  127. <trim prefix="where" prefixOverrides="and | or ">
  128. <if test="objId != null and objId != ''">and OBJ_ID = #{objId}</if>
  129. <if test="swhsId != null and swhsId != ''">and SWHS_ID = #{swhsId}</if>
  130. <if test="swhsCode != null and swhsCode != ''">and SWHS_CODE = #{swhsCode}</if>
  131. <if test="swhsName != null and swhsName != ''">and SWHS_NAME = #{swhsName}</if>
  132. <if test="insName != null and insName != ''">and INS_NAME = #{insName}</if>
  133. <if test="insPers != null and insPers != ''">and INS_PERS = #{insPers}</if>
  134. <if test="insWaterPers != null and insWaterPers != ''">and INS_WATER_PERS = #{insWaterPers}</if>
  135. <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
  136. <if test="swhsLoc != null and swhsLoc != ''">and SWHS_LOC = #{swhsLoc}</if>
  137. <if test="centerX != null and centerX != ''">and CENTER_X = #{centerX}</if>
  138. <if test="centerY != null and centerY != ''">and CENTER_Y = #{centerY}</if>
  139. <if test="gdX != null and gdX != ''">and GD_X = #{gdX}</if>
  140. <if test="gdY != null and gdY != ''">and GD_Y = #{gdY}</if>
  141. <if test="wainWasoType != null and wainWasoType != ''">and WAIN_WASO_TYPE = #{wainWasoType}</if>
  142. <if test="watArea != null and watArea != ''">and WAT_AREA = #{watArea}</if>
  143. <if test="wainNum != null and wainNum != ''">and WAIN_NUM = #{wainNum}</if>
  144. <if test="wainUse != null and wainUse != ''">and WAIN_USE = #{wainUse}</if>
  145. <if test="wasuObjType != null and wasuObjType != ''">and WASU_OBJ_TYPE = #{wasuObjType}</if>
  146. <if test="desAnnWain != null and desAnnWain != ''">and DES_ANN_WAIN = #{desAnnWain}</if>
  147. <if test="desAnnWasuPop != null and desAnnWasuPop != ''">and DES_ANN_WASU_POP = #{desAnnWasuPop}</if>
  148. <if test="waquGoal != null and waquGoal != ''">and WAQU_GOAL = #{waquGoal}</if>
  149. <if test="ifMonWqua != null and ifMonWqua != ''">and IF_MON_WQUA = #{ifMonWqua}</if>
  150. <if test="wquaCat != null and wquaCat != ''">and WQUA_CAT = #{wquaCat}</if>
  151. <if test="ifWquaUptoSta != null and ifWquaUptoSta != ''">and IF_WQUA_UPTO_STA = #{ifWquaUptoSta}</if>
  152. <if test="note != null and note != ''">and NOTE = #{note}</if>
  153. <if test="state != null and state != ''">and STATE = #{state}</if>
  154. <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
  155. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  156. <if test="groupId != null and groupId != ''">and GROUP_ID = #{groupId}</if>
  157. <if test="inTm != null">and IN_TM = #{inTm}</if>
  158. <if test="upTm != null">and UP_TM = #{upTm}</if>
  159. <if test="safetyStat != null and safetyStat != ''">and SAFETY_STAT = #{safetyStat}</if>
  160. <if test="measuresStat != null and measuresStat != ''">and MEASURES_STAT = #{measuresStat}</if>
  161. <if test="waterStat != null and waterStat != ''">and WATER_STAT = #{waterStat}</if>
  162. <if test="insTel != null and insTel != ''">and INS_TEL = #{insTel}</if>
  163. <if test="insWaterUnit != null and insWaterUnit != ''">and INS_WATER_UNIT = #{insWaterUnit}</if>
  164. <if test="insWaterTel != null and insWaterTel != ''">and INS_WATER_TEL = #{insWaterTel}</if>
  165. <choose>
  166. <when test="province != null and province != ''">and PROVINCE = #{province}</when>
  167. <otherwise>
  168. and province is null
  169. </otherwise>
  170. </choose>
  171. </trim>
  172. </sql>
  173. <select id="get" resultMap="bisInspSwhsRgstrResultMap" parameterType="String" >
  174. select <include refid="table_columns" /> from BIS_INSP_SWHS_RGSTR where ID = #{id}
  175. </select>
  176. <select id="getBy" resultMap="bisInspSwhsRgstrResultMap">
  177. select <include refid="table_columns" /> from BIS_INSP_SWHS_RGSTR <include refid="page_where" />
  178. </select>
  179. <select id="findAll" resultMap="bisInspSwhsRgstrResultMap">
  180. select <include refid="table_columns" /> from BIS_INSP_SWHS_RGSTR
  181. </select>
  182. <select id="findList" resultMap="bisInspSwhsRgstrResultMap">
  183. select <include refid="table_columns" /> from BIS_INSP_SWHS_RGSTR <include refid="page_where" />
  184. </select>
  185. <select id="selectCount" resultType="int" >
  186. select count(ID) from BIS_INSP_SWHS_RGSTR <include refid="page_where" />
  187. </select>
  188. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspSwhsRgstr">
  189. insert into BIS_INSP_SWHS_RGSTR( <include refid="table_columns" /> )
  190. values ( <include refid="entity_properties" /> )
  191. </insert>
  192. <delete id="delete" parameterType="java.lang.String">
  193. delete from BIS_INSP_SWHS_RGSTR where ID = #{id}
  194. </delete>
  195. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspSwhsRgstr">
  196. delete from BIS_INSP_SWHS_RGSTR <include refid="page_where" />
  197. </delete>
  198. <update id="deleteInFlag" parameterType="java.lang.String">
  199. update BIS_INSP_SWHS_RGSTR set flag_valid = 0 where ID = #{id}
  200. </update>
  201. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspSwhsRgstr">
  202. update BIS_INSP_SWHS_RGSTR
  203. <trim prefix="set" suffixOverrides=",">
  204. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  205. <if test="swhsId != null and swhsId != ''">SWHS_ID = #{swhsId},</if>
  206. <if test="swhsCode != null and swhsCode != ''">SWHS_CODE = #{swhsCode},</if>
  207. <if test="swhsName != null and swhsName != ''">SWHS_NAME = #{swhsName},</if>
  208. <if test="province != null and province != ''"> PROVINCE = #{province},</if>
  209. <if test="insName != null and insName != ''">INS_NAME = #{insName},</if>
  210. <if test="insPers != null and insPers != ''">INS_PERS = #{insPers},</if>
  211. <if test="insWaterPers != null and insWaterPers != ''">INS_WATER_PERS = #{insWaterPers},</if>
  212. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  213. <if test="swhsLoc != null and swhsLoc != ''">SWHS_LOC = #{swhsLoc},</if>
  214. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  215. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  216. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  217. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  218. <if test="wainWasoType != null and wainWasoType != ''">WAIN_WASO_TYPE = #{wainWasoType},</if>
  219. <if test="watArea != null and watArea != ''">WAT_AREA = #{watArea},</if>
  220. <if test="wainNum != null and wainNum != ''">WAIN_NUM = #{wainNum},</if>
  221. <if test="wainUse != null and wainUse != ''">WAIN_USE = #{wainUse},</if>
  222. <if test="wasuObjType != null and wasuObjType != ''">WASU_OBJ_TYPE = #{wasuObjType},</if>
  223. <if test="desAnnWain != null and desAnnWain != ''">DES_ANN_WAIN = #{desAnnWain},</if>
  224. <if test="desAnnWasuPop != null and desAnnWasuPop != ''">DES_ANN_WASU_POP = #{desAnnWasuPop},</if>
  225. <if test="waquGoal != null and waquGoal != ''">WAQU_GOAL = #{waquGoal},</if>
  226. <if test="ifMonWqua != null and ifMonWqua != ''">IF_MON_WQUA = #{ifMonWqua},</if>
  227. <if test="wquaCat != null and wquaCat != ''">WQUA_CAT = #{wquaCat},</if>
  228. <if test="ifWquaUptoSta != null and ifWquaUptoSta != ''">IF_WQUA_UPTO_STA = #{ifWquaUptoSta},</if>
  229. <if test="note != null and note != ''">NOTE = #{note},</if>
  230. <if test="state != null and state != ''">STATE = #{state},</if>
  231. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  232. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  233. <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
  234. <if test="inTm != null">IN_TM = #{inTm},</if>
  235. <if test="upTm != null">UP_TM = #{upTm},</if>
  236. <if test="safetyStat != null and safetyStat != ''">SAFETY_STAT = #{safetyStat},</if>
  237. <if test="measuresStat != null and measuresStat != ''">MEASURES_STAT = #{measuresStat},</if>
  238. <if test="waterStat != null and waterStat != ''">WATER_STAT = #{waterStat},</if>
  239. <if test="insTel != null and insTel != ''">INS_TEL = #{insTel},</if>
  240. <if test="insWaterUnit != null and insWaterUnit != ''">INS_WATER_UNIT = #{insWaterUnit},</if>
  241. <if test="insWaterTel != null and insWaterTel != ''">INS_WATER_TEL = #{insWaterTel},</if>
  242. </trim>
  243. <where>ID = #{id}</where>
  244. </update>
  245. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspSwhsRgstr">
  246. update BIS_INSP_SWHS_RGSTR
  247. <trim prefix="set" suffixOverrides=",">
  248. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  249. <if test="swhsId != null and swhsId != ''">SWHS_ID = #{swhsId},</if>
  250. <if test="swhsCode != null and swhsCode != ''">SWHS_CODE = #{swhsCode},</if>
  251. <if test="swhsName != null and swhsName != ''">SWHS_NAME = #{swhsName},</if>
  252. <if test="insName != null and insName != ''">INS_NAME = #{insName},</if>
  253. <if test="insPers != null and insPers != ''">INS_PERS = #{insPers},</if>
  254. <if test="insWaterPers != null and insWaterPers != ''">INS_WATER_PERS = #{insWaterPers},</if>
  255. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  256. <if test="swhsLoc != null and swhsLoc != ''">SWHS_LOC = #{swhsLoc},</if>
  257. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  258. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  259. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  260. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  261. <if test="wainWasoType != null and wainWasoType != ''">WAIN_WASO_TYPE = #{wainWasoType},</if>
  262. <if test="province != null and province != ''"> PROVINCE = #{province},</if>
  263. <if test="watArea != null and watArea != ''">WAT_AREA = #{watArea},</if>
  264. <if test="wainNum != null and wainNum != ''">WAIN_NUM = #{wainNum},</if>
  265. <if test="wainUse != null and wainUse != ''">WAIN_USE = #{wainUse},</if>
  266. <if test="wasuObjType != null and wasuObjType != ''">WASU_OBJ_TYPE = #{wasuObjType},</if>
  267. <if test="desAnnWain != null and desAnnWain != ''">DES_ANN_WAIN = #{desAnnWain},</if>
  268. <if test="desAnnWasuPop != null and desAnnWasuPop != ''">DES_ANN_WASU_POP = #{desAnnWasuPop},</if>
  269. <if test="waquGoal != null and waquGoal != ''">WAQU_GOAL = #{waquGoal},</if>
  270. <if test="ifMonWqua != null and ifMonWqua != ''">IF_MON_WQUA = #{ifMonWqua},</if>
  271. <if test="wquaCat != null and wquaCat != ''">WQUA_CAT = #{wquaCat},</if>
  272. <if test="ifWquaUptoSta != null and ifWquaUptoSta != ''">IF_WQUA_UPTO_STA = #{ifWquaUptoSta},</if>
  273. <if test="note != null and note != ''">NOTE = #{note},</if>
  274. <if test="state != null and state != ''">STATE = #{state},</if>
  275. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  276. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  277. <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
  278. <if test="inTm != null">IN_TM = #{inTm},</if>
  279. <if test="upTm != null">UP_TM = #{upTm},</if>
  280. <if test="safetyStat != null and safetyStat != ''">SAFETY_STAT = #{safetyStat},</if>
  281. <if test="measuresStat != null and measuresStat != ''">MEASURES_STAT = #{measuresStat},</if>
  282. <if test="waterStat != null and waterStat != ''">WATER_STAT = #{waterStat},</if>
  283. <if test="insTel != null and insTel != ''">INS_TEL = #{insTel},</if>
  284. <if test="insWaterUnit != null and insWaterUnit != ''">INS_WATER_UNIT = #{insWaterUnit},</if>
  285. <if test="insWaterTel != null and insWaterTel != ''">INS_WATER_TEL = #{insWaterTel},</if>
  286. </trim>
  287. <include refid="page_where" />
  288. </update>
  289. <sql id="choseSql">
  290. <choose>
  291. <when test="province !=null and province !=''">
  292. and B.province like '${province}%'
  293. </when>
  294. <otherwise>
  295. and B.province is null
  296. </otherwise>
  297. </choose>
  298. </sql>
  299. <sql id="orgIdSql">
  300. <choose>
  301. <when test="orgId !=null and orgId !=''">
  302. and ORG_ID=#{orgId}
  303. </when>
  304. <otherwise>
  305. and ORG_ID is null
  306. </otherwise>
  307. </choose>
  308. </sql>
  309. <select id="getListByInspGroupIdObjType" resultType="cn.com.goldenwater.dcproj.model.BisInspSwhsRgstr"
  310. parameterType="cn.com.goldenwater.dcproj.param.PagePersObjParam">
  311. select t.*,C.id groupId,C.PNM groupName,B.obj_id
  312. from att_swhs_base t
  313. left join BIS_INSP_ALL_OBJ B
  314. on B.CODE = t.ID
  315. LEFT JOIN BIS_INSP_ALL C ON B.ID = C.ID
  316. and B.ptype = #{objType}
  317. where 1 = 1
  318. <if test='isAll == "0"'>and B.ID = #{inspGroupId}</if>
  319. <if test='isAll == "1"'>and B.ID LIKE '${inspGroupId}%'</if>
  320. <if test="adCode != null and adCode != ''">
  321. and t.AD_CODE like '${adCode}%'
  322. </if>
  323. <choose>
  324. <when test="province != null and province != ''">
  325. and B.AD_CODE LIKE '${province}%'
  326. </when>
  327. <otherwise>
  328. and B.AD_CODE is null
  329. </otherwise>
  330. </choose>
  331. </select>
  332. <!-- 其他自定义SQL -->
  333. <select id="findSwhsPage" parameterType="cn.com.goldenwater.dcproj.param.TypeParam" resultType="cn.com.goldenwater.dcproj.dto.BisInspRgstrDto">
  334. SELECT * FROM (
  335. select A.CODE,A.ID nodeId,
  336. A.NM,
  337. #{pType} PTYPE,
  338. B.center_X,
  339. B.center_y,
  340. B.GD_X as lgtd,
  341. B.GD_Y as lttd,
  342. B.GD_X,
  343. B.GD_y,
  344. A.OBJ_ID,B.ID ID,B.ID AS RGSTRID,
  345. (case when b.SWHS_LOC is null then c.SWHS_LOC else b.SWHS_LOC end) as location,
  346. (case when b.State is null then '0' else b.state end)STATE
  347. ,B.IN_TM,
  348. x.ad_full_name as adName,
  349. B.SAFETY_STAT,
  350. B.MEASURES_STAT,
  351. B.WATER_STAT,
  352. B.WAIN_WASO_TYPE as type,
  353. B.ad_code,
  354. ia.pnm groupName,
  355. (select pnm from BIS_INSP_ALL where id = ia.pid)||ia.pnm upGroupName,
  356. (case when b.INS_NAME is null then c.INS_NAME else b.INS_NAME end) as insName,
  357. C.swhs_code as objCode
  358. from BIS_INSP_ALL_OBJ
  359. A LEFT JOIN BIS_INSP_SWHS_RGSTR B ON A.OBJ_ID=B.OBJ_ID
  360. LEFT JOIN ATT_SWHS_BASE C ON A.CODE=C.ID
  361. left JOin ATT_AD_X_BASE x on B.ad_code = x.ad_code
  362. LEFT JOIN BIS_INSP_ALL ia on A.ID = ia.id
  363. where A.ptype= #{pType}
  364. <if test="tabType =='2'.toString()">
  365. and ia.entm &lt;to_date(#{nowTime},'yyyy-MM-dd')+1
  366. </if>
  367. <if test="tabType =='1'.toString()">
  368. and ia.entm &gt;=to_date(#{nowTime},'yyyy-MM-dd')
  369. </if>
  370. <include refid="choseSql"/>
  371. and REGEXP_LIKE(
  372. A.Id,'^('||
  373. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{presId}
  374. <include refid="orgIdSql"/>
  375. )>0 then
  376. (SELECT LISTAGG(id, '|') as
  377. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{presId}
  378. <include refid="orgIdSql"/> group by persid
  379. )
  380. else (select 'non' from dual) end)
  381. ||')')
  382. ) A WHERE a.PTYPE=#{pType}
  383. <if test="adCode != null and adCode != ''">
  384. and a.ad_code like '${adCode}%'
  385. </if>
  386. <if test="adName != null and adName != ''">
  387. and a.adName like '%${adName}%'
  388. </if>
  389. <if test="plnaId !=null and plnaId !=''">
  390. and a.nodeId like '${plnaId}%'
  391. </if>
  392. <if test="groupId != null and groupId != ''">
  393. AND a.nodeId like '${groupId}%'
  394. </if>
  395. <if test="state !=null and state !=''">
  396. and STATE in (${state})
  397. </if>
  398. <if test="rsName !=null and rsName !=''">
  399. and a.nm like '%${rsName}%'
  400. </if>
  401. <if test="code !=null and code !=''">
  402. and a.code = #{code}
  403. </if>
  404. <if test="sttm != null and sttm != ''">and a.IN_TM&gt;= TO_DATE(#{sttm},'YYYY-MM-DD')</if>
  405. <if test="entm != null and entm != ''">and a.IN_TM &lt;= To_DATE(#{entm},'yyyy-MM-dd') + 1</if>
  406. order by nodeId asc
  407. <if test="orderBy != null and orderBy != ''">
  408. ,nlssort(nm,'NLS_SORT=SCHINESE_PINYIN_M')
  409. </if>
  410. </select>
  411. </mapper>