e3735c3712eb70f8cd57098becf2bcf82d7f6ec9.svn-base 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408
  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.BisInspProSourceProtectDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspProSourceProtect" id="bisInspProSourceProtectResultMap">
  5. <result property="wtsrCd" column="WTSR_CD"/>
  6. <result property="proPlbm" column="PRO_PLBM"/>
  7. <result property="mkPlbm" column="MK_PLBM"/>
  8. <result property="pollPlbm" column="POLL_PLBM"/>
  9. <result property="spPlbm" column="SP_PLBM"/>
  10. <result property="lgtd" column="LGTD"/>
  11. <result property="lttd" column="LTTD"/>
  12. <result property="lgtdpc" column="LGTDPC"/>
  13. <result property="lttdpc" column="LTTDPC"/>
  14. <result property="engSurId" column="ENG_SUR_ID"/>
  15. <result property="engId" column="ENG_ID"/>
  16. <result property="waterSourceNm" column="WATER_SOURCE_NM"/>
  17. <result property="villageNm" column="VILLAGE_NM"/>
  18. <result property="cwsCode" column="CWS_CODE"/>
  19. <result property="planInsAmount" column="PLAN_INS_AMOUNT"/>
  20. <result property="sourceType" column="SOURCE_TYPE"/>
  21. <result property="isProtectArea" column="IS_PROTECT_AREA"/>
  22. <result property="waterQuality" column="WATER_QUALITY"/>
  23. <result property="isProtectMark" column="IS_PROTECT_MARK"/>
  24. <result property="isPollSource" column="IS_POLL_SOURCE"/>
  25. <result property="isSpare" column="IS_SPARE"/>
  26. <result property="visitDate" column="VISIT_DATE"/>
  27. <result property="recPersId" column="REC_PERS_ID"/>
  28. <result property="recPers2" column="REC_PERS2"/>
  29. <result property="recPersTel" column="REC_PERS_TEL"/>
  30. <result property="createTime" column="CREATE_TIME"/>
  31. <result property="updateTime" column="UPDATE_TIME"/>
  32. <result property="status" column="STATUS"/>
  33. <result property="pollNote" column="POLL_NOTE"/>
  34. </resultMap>
  35. <sql id="table_columns">
  36. WTSR_CD ,
  37. PRO_PLBM ,
  38. MK_PLBM ,
  39. POLL_PLBM ,
  40. SP_PLBM ,
  41. LGTD ,
  42. LTTD ,
  43. LGTDPC ,
  44. LTTDPC ,
  45. ENG_SUR_ID ,
  46. ENG_ID ,
  47. WATER_SOURCE_NM ,
  48. VILLAGE_NM ,
  49. CWS_CODE ,
  50. PLAN_INS_AMOUNT ,
  51. SOURCE_TYPE ,
  52. IS_PROTECT_AREA ,
  53. WATER_QUALITY ,
  54. IS_PROTECT_MARK ,
  55. IS_POLL_SOURCE ,
  56. IS_SPARE ,
  57. TO_CHAR(VISIT_DATE,'YYYY-MM-DD') VISIT_DATE,
  58. REC_PERS_ID ,
  59. REC_PERS2 ,
  60. REC_PERS_TEL ,
  61. TO_CHAR(CREATE_TIME,'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
  62. TO_CHAR(UPDATE_TIME,'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
  63. STATUS,
  64. POLL_NOTE
  65. </sql>
  66. <sql id="table_columns2">
  67. WTSR_CD ,
  68. PRO_PLBM ,
  69. MK_PLBM ,
  70. POLL_PLBM ,
  71. SP_PLBM ,
  72. LGTD ,
  73. LTTD ,
  74. LGTDPC ,
  75. LTTDPC ,
  76. ENG_SUR_ID ,
  77. ENG_ID ,
  78. WATER_SOURCE_NM ,
  79. VILLAGE_NM ,
  80. CWS_CODE ,
  81. PLAN_INS_AMOUNT ,
  82. SOURCE_TYPE ,
  83. IS_PROTECT_AREA ,
  84. WATER_QUALITY ,
  85. IS_PROTECT_MARK ,
  86. IS_POLL_SOURCE ,
  87. IS_SPARE ,
  88. VISIT_DATE ,
  89. REC_PERS_ID ,
  90. REC_PERS2 ,
  91. REC_PERS_TEL ,
  92. CREATE_TIME ,
  93. UPDATE_TIME ,
  94. STATUS,
  95. POLL_NOTE
  96. </sql>
  97. <sql id="entity_properties">
  98. #{wtsrCd},
  99. #{proPlbm},
  100. #{mkPlbm},
  101. #{pollPlbm},
  102. #{spPlbm},
  103. #{lgtd},
  104. #{lttd},
  105. #{lgtdpc},
  106. #{lttdpc},
  107. #{engSurId},
  108. #{engId},
  109. #{waterSourceNm},
  110. #{villageNm},
  111. #{cwsCode},
  112. #{planInsAmount},
  113. #{sourceType},
  114. #{isProtectArea},
  115. #{waterQuality},
  116. #{isProtectMark},
  117. #{isPollSource},
  118. #{isSpare},
  119. TO_DATE(#{visitDate},'YYYY-MM-DD'),
  120. #{recPersId},
  121. #{recPers2},
  122. #{recPersTel},
  123. TO_DATE(#{createTime},'YYYY-MM-DD HH24:MI:SS') ,
  124. TO_DATE(#{updateTime},'YYYY-MM-DD HH24:MI:SS') ,
  125. #{status},
  126. #{pollNote}
  127. </sql>
  128. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  129. <sql id="page_where">
  130. <trim prefix="where" prefixOverrides="and | or ">
  131. <if test="wtsrCd != null and wtsrCd != ''">and WTSR_CD = #{wtsrCd}</if>
  132. <if test="proPlbm != null and proPlbm != ''">and PRO_PLBM = #{proPlbm}</if>
  133. <if test="mkPlbm != null and mkPlbm != ''">and MK_PLBM = #{mkPlbm}</if>
  134. <if test="pollPlbm != null and pollPlbm != ''">and POLL_PLBM = #{pollPlbm}</if>
  135. <if test="spPlbm != null and spPlbm != ''">and SP_PLBM = #{spPlbm}</if>
  136. <if test="lgtd != null and lgtd != ''">and LGTD = #{lgtd}</if>
  137. <if test="lttd != null and lttd != ''">and LTTD = #{lttd}</if>
  138. <if test="lgtdpc != null and lgtdpc != ''">and LGTDPC = #{lgtdpc}</if>
  139. <if test="lttdpc != null and lttdpc != ''">and LTTDPC = #{lttdpc}</if>
  140. <if test="engSurId != null and engSurId != ''">and ENG_SUR_ID = #{engSurId}</if>
  141. <if test="engId != null and engId != ''">and ENG_ID = #{engId}</if>
  142. <if test="waterSourceNm != null and waterSourceNm != ''">and WATER_SOURCE_NM LIKE
  143. '%'||#{waterSourceNm}||'%'
  144. </if>
  145. <if test="villageNm != null and villageNm != ''">and VILLAGE_NM LIKE '%'||#{villageNm}||'%'</if>
  146. <if test="cwsCode != null and cwsCode != ''">and CWS_CODE = #{cwsCode}</if>
  147. <if test="planInsAmount != null and planInsAmount != ''">and PLAN_INS_AMOUNT = #{planInsAmount}</if>
  148. <if test="sourceType != null and sourceType != ''">and SOURCE_TYPE = #{sourceType}</if>
  149. <if test="isProtectArea != null and isProtectArea != ''">and IS_PROTECT_AREA = #{isProtectArea}</if>
  150. <if test="waterQuality != null and waterQuality != ''">and WATER_QUALITY = #{waterQuality}</if>
  151. <if test="isProtectMark != null and isProtectMark != ''">and IS_PROTECT_MARK = #{isProtectMark}</if>
  152. <if test="isPollSource != null and isPollSource != ''">and IS_POLL_SOURCE = #{isPollSource}</if>
  153. <if test="isSpare != null and isSpare != ''">and IS_SPARE = #{isSpare}</if>
  154. <if test="visitDate != null and visitDate != ''">and VISIT_DATE = TO_DATE(#{visitDate},'YYYY-MM-DD')</if>
  155. <if test="recPersId != null and recPersId != ''">and REC_PERS_ID = #{recPersId}</if>
  156. <if test="recPers2 != null and recPers2 != ''">and REC_PERS2 = #{recPers2}</if>
  157. <if test="recPersTel != null and recPersTel != ''">and REC_PERS_TEL = #{recPersTel}</if>
  158. <if test="createTime != null and createTime != ''">and CREATE_TIME = TO_DATE(#{createTime},'YYYY-MM-DD
  159. HH24:MI:SS')
  160. </if>
  161. <if test="updateTime != null and updateTime != ''">and UPDATE_TIME = TO_DATE(#{updateTime},'YYYY-MM-DD
  162. HH24:MI:SS')
  163. </if>
  164. <if test="status != null and status != ''">and STATUS = #{status}</if>
  165. <if test="pollNote != null and pollNote != ''">and POLL_NOTE = #{pollNote}</if>
  166. </trim>
  167. </sql>
  168. <select id="get" resultMap="bisInspProSourceProtectResultMap" parameterType="String">
  169. select
  170. <include refid="table_columns"/>
  171. from BIS_INSP_PRO_SOURCE_PROTECT where ENG_SUR_ID = #{id}
  172. </select>
  173. <select id="getBy" resultMap="bisInspProSourceProtectResultMap">
  174. select
  175. <include refid="table_columns"/>
  176. from BIS_INSP_PRO_SOURCE_PROTECT
  177. <include refid="page_where"/>
  178. </select>
  179. <select id="findAll" resultMap="bisInspProSourceProtectResultMap">
  180. select
  181. <include refid="table_columns"/>
  182. from BIS_INSP_PRO_SOURCE_PROTECT
  183. </select>
  184. <select id="findList" resultMap="bisInspProSourceProtectResultMap">
  185. select
  186. <include refid="table_columns"/>
  187. from BIS_INSP_PRO_SOURCE_PROTECT
  188. <include refid="page_where"/>
  189. ORDER BY UPDATE_TIME DESC
  190. </select>
  191. <select id="selectCount" resultType="int">
  192. select count(ENG_SUR_ID) from BIS_INSP_PRO_SOURCE_PROTECT
  193. <include refid="page_where"/>
  194. </select>
  195. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspProSourceProtect">
  196. insert into BIS_INSP_PRO_SOURCE_PROTECT(
  197. <include refid="table_columns2"/>
  198. )
  199. values (
  200. <include refid="entity_properties"/>
  201. )
  202. </insert>
  203. <delete id="delete" parameterType="java.lang.String">
  204. delete from BIS_INSP_PRO_SOURCE_PROTECT where ENG_SUR_ID = #{id}
  205. </delete>
  206. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspProSourceProtect">
  207. delete from BIS_INSP_PRO_SOURCE_PROTECT
  208. <include refid="page_where"/>
  209. </delete>
  210. <update id="deleteInFlag" parameterType="java.lang.String">
  211. update BIS_INSP_PRO_SOURCE_PROTECT set flag_valid = 0 where ENG_SUR_ID = #{id}
  212. </update>
  213. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspProSourceProtect">
  214. update BIS_INSP_PRO_SOURCE_PROTECT
  215. <trim prefix="set" suffixOverrides=",">
  216. <if test="wtsrCd != null and wtsrCd != ''">WTSR_CD = #{wtsrCd},</if>
  217. <if test="proPlbm != null and proPlbm != ''">PRO_PLBM = #{proPlbm},</if>
  218. <if test="mkPlbm != null and mkPlbm != ''">MK_PLBM = #{mkPlbm},</if>
  219. <if test="pollPlbm != null and pollPlbm != ''">POLL_PLBM = #{pollPlbm},</if>
  220. <if test="spPlbm != null and spPlbm != ''">SP_PLBM = #{spPlbm},</if>
  221. <if test="lgtd != null and lgtd != ''">LGTD = #{lgtd},</if>
  222. <if test="lttd != null and lttd != ''">LTTD = #{lttd},</if>
  223. <if test="lgtdpc != null and lgtdpc != ''">LGTDPC = #{lgtdpc},</if>
  224. <if test="lttdpc != null and lttdpc != ''">LTTDPC = #{lttdpc},</if>
  225. <if test="engId != null and engId != ''">ENG_ID = #{engId},</if>
  226. <if test="waterSourceNm != null and waterSourceNm != ''">WATER_SOURCE_NM = #{waterSourceNm},</if>
  227. <if test="villageNm != null and villageNm != ''">VILLAGE_NM = #{villageNm},</if>
  228. <if test="cwsCode != null and cwsCode != ''">CWS_CODE = #{cwsCode},</if>
  229. <if test="planInsAmount != null and planInsAmount != ''">PLAN_INS_AMOUNT = #{planInsAmount},</if>
  230. <if test="sourceType != null and sourceType != ''">SOURCE_TYPE = #{sourceType},</if>
  231. <if test="isProtectArea != null and isProtectArea != ''">IS_PROTECT_AREA = #{isProtectArea},</if>
  232. <if test="waterQuality != null and waterQuality != ''">WATER_QUALITY = #{waterQuality},</if>
  233. <if test="isProtectMark != null and isProtectMark != ''">IS_PROTECT_MARK = #{isProtectMark},</if>
  234. <if test="isPollSource != null and isPollSource != ''">IS_POLL_SOURCE = #{isPollSource},</if>
  235. <if test="isSpare != null and isSpare != ''">IS_SPARE = #{isSpare},</if>
  236. <if test="visitDate != null and visitDate != ''">VISIT_DATE = TO_DATE(#{visitDate},'YYYY-MM-DD'),</if>
  237. <if test="recPersId != null and recPersId != ''">REC_PERS_ID = #{recPersId},</if>
  238. <if test="recPers2 != null and recPers2 != ''">REC_PERS2 = #{recPers2},</if>
  239. <if test="recPersTel != null and recPersTel != ''">REC_PERS_TEL = #{recPersTel},</if>
  240. <if test="createTime != null and createTime != ''">CREATE_TIME = TO_DATE(#{createTime},'YYYY-MM-DD
  241. HH24:MI:SS'),
  242. </if>
  243. <if test="updateTime != null and updateTime != ''">UPDATE_TIME = TO_DATE(#{updateTime},'YYYY-MM-DD
  244. HH24:MI:SS'),
  245. </if>
  246. <if test="status != null and status != ''">STATUS = #{status},</if>
  247. <if test="pollNote != null and pollNote != ''">POLL_NOTE = #{pollNote},</if>
  248. </trim>
  249. <where>ENG_SUR_ID = #{engSurId}</where>
  250. </update>
  251. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspProSourceProtect">
  252. update BIS_INSP_PRO_SOURCE_PROTECT
  253. <trim prefix="set" suffixOverrides=",">
  254. <if test="wtsrCd != null and wtsrCd != ''">WTSR_CD = #{wtsrCd},</if>
  255. <if test="proPlbm != null and proPlbm != ''">PRO_PLBM = #{proPlbm},</if>
  256. <if test="mkPlbm != null and mkPlbm != ''">MK_PLBM = #{mkPlbm},</if>
  257. <if test="pollPlbm != null and pollPlbm != ''">POLL_PLBM = #{pollPlbm},</if>
  258. <if test="spPlbm != null and spPlbm != ''">SP_PLBM = #{spPlbm},</if>
  259. <if test="lgtd != null and lgtd != ''">LGTD = #{lgtd},</if>
  260. <if test="lttd != null and lttd != ''">LTTD = #{lttd},</if>
  261. <if test="lgtdpc != null and lgtdpc != ''">LGTDPC = #{lgtdpc},</if>
  262. <if test="lttdpc != null and lttdpc != ''">LTTDPC = #{lttdpc},</if>
  263. <if test="engId != null and engId != ''">ENG_ID = #{engId},</if>
  264. <if test="waterSourceNm != null and waterSourceNm != ''">WATER_SOURCE_NM = #{waterSourceNm},</if>
  265. <if test="villageNm != null and villageNm != ''">VILLAGE_NM = #{villageNm},</if>
  266. <if test="cwsCode != null and cwsCode != ''">CWS_CODE = #{cwsCode},</if>
  267. <if test="planInsAmount != null and planInsAmount != ''">PLAN_INS_AMOUNT = #{planInsAmount},</if>
  268. <if test="sourceType != null and sourceType != ''">SOURCE_TYPE = #{sourceType},</if>
  269. <if test="isProtectArea != null and isProtectArea != ''">IS_PROTECT_AREA = #{isProtectArea},</if>
  270. <if test="waterQuality != null and waterQuality != ''">WATER_QUALITY = #{waterQuality},</if>
  271. <if test="isProtectMark != null and isProtectMark != ''">IS_PROTECT_MARK = #{isProtectMark},</if>
  272. <if test="isPollSource != null and isPollSource != ''">IS_POLL_SOURCE = #{isPollSource},</if>
  273. <if test="isSpare != null and isSpare != ''">IS_SPARE = #{isSpare},</if>
  274. <if test="visitDate != null and visitDate != ''">VISIT_DATE = TO_DATE(#{visitDate},'YYYY-MM-DD'),</if>
  275. <if test="recPersId != null and recPersId != ''">REC_PERS_ID = #{recPersId},</if>
  276. <if test="recPers2 != null and recPers2 != ''">REC_PERS2 = #{recPers2},</if>
  277. <if test="recPersTel != null and recPersTel != ''">REC_PERS_TEL = #{recPersTel},</if>
  278. <if test="createTime != null and createTime != ''">CREATE_TIME = TO_DATE(#{createTime},'YYYY-MM-DD
  279. HH24:MI:SS'),
  280. </if>
  281. <if test="updateTime != null and updateTime != ''">UPDATE_TIME = TO_DATE(#{updateTime},'YYYY-MM-DD
  282. HH24:MI:SS'),
  283. </if>
  284. <if test="status != null and status != ''">STATUS = #{status},</if>
  285. <if test="pollNote != null and pollNote != ''">POLL_NOTE = #{pollNote},</if>
  286. </trim>
  287. <include refid="page_where"/>
  288. </update>
  289. <!-- 其他自定义SQL -->
  290. <select id="queryListByObjId" resultType="cn.com.goldenwater.dcproj.dto.BisInspProSourceProtectDto"
  291. parameterType="string">
  292. SELECT * FROM ( SELECT sws_cd ws_cd,CASE WHEN B.WATER_SOURCE_NM IS NULL THEN sws_nm ELSE B.WATER_SOURCE_NM END
  293. ws_nm,
  294. B.lgtd,B.lttd,B.lgtdpc,B.lttdpc,CASE WHEN B.SOURCE_TYPE IS NULL THEN 'A' ELSE B.SOURCE_TYPE END TYPE,A.TS TM,
  295. CASE WHEN B.ENG_ID =#{engId} THEN 1 ELSE 0 end STATUS,CASE WHEN B.ENG_SUR_ID IS NULL THEN sws_cd ELSE
  296. B.ENG_SUR_ID END ID FROM WR_SWS_B A
  297. LEFT JOIN BIS_INSP_PRO_SOURCE_PROTECT B ON A.sws_cd = B.WTSR_CD WHERE A.sws_cd like #{objId}||'%'
  298. <if test="name != null and name != ''">AND B.WATER_SOURCE_NM LIKE '%'||#{name}||'%'</if>
  299. union all
  300. SELECT gws_cd ws_cd,CASE WHEN B.WATER_SOURCE_NM IS NULL THEN Gws_nm ELSE B.WATER_SOURCE_NM END ws_nm,
  301. B.lgtd,B.lttd,B.lgtdpc,B.lttdpc,CASE WHEN B.SOURCE_TYPE IS NULL THEN 'B' ELSE B.SOURCE_TYPE END TYPE,A.TS TM,
  302. CASE WHEN B.ENG_ID =#{engId} THEN 1 ELSE 0 end STATUS,CASE WHEN B.ENG_SUR_ID IS NULL THEN gws_cd ELSE
  303. B.ENG_SUR_ID END ID FROM WR_GWS_B A
  304. LEFT JOIN BIS_INSP_PRO_SOURCE_PROTECT B ON A.gws_cd = B.WTSR_CD WHERE A.gws_cd like #{objId}||'%'
  305. <if test="name != null and name != ''">AND B.WATER_SOURCE_NM LIKE '%'||#{name}||'%'</if>
  306. UNION ALL
  307. SELECT A.WTSR_CD WS_CD,A.WATER_SOURCE_NM WS_NM,A.LGTD,A.lttd,A.lgtdpc,A.lttdpc,A.SOURCE_TYPE TYPE,A.UPDATE_TIME
  308. TM,1 STATUS,A.ENG_SUR_ID ID FROM BIS_INSP_PRO_SOURCE_PROTECT A
  309. LEFT JOIN (SELECT sws_cd WS_CD FROM WR_SWS_B WHERE sws_cd like #{objId}||'%' UNION ALL SELECT Gws_cd WS_CD FROM
  310. WR_GWS_B WHERE Gws_cd like #{objId}||'%' ) B on A.WTSR_CD=B.WS_CD
  311. WHERE B.WS_CD IS NULL AND A.ENG_ID=#{engId} <if test="name != null and name != ''">AND A.WATER_SOURCE_NM LIKE
  312. '%'||#{name}||'%'</if>)
  313. ORDER BY STATUS DESC,TM DESC
  314. </select>
  315. <select id="getListByCodeAndPerId" parameterType="cn.com.goldenwater.dcproj.dto.VillRgstrDto"
  316. resultType="cn.com.goldenwater.dcproj.model.BisInspProSourceProtect">
  317. SELECT * FROM BIS_INSP_PRO_SOURCE_PROTECT A LEFT JOIN BIS_INSP_VILL_RGSTR B ON A.ENG_ID = B.ENG_ID
  318. LEFT JOIN BIS_INSP_ALL_OBJ C ON B.OBJ_ID = C.OBJ_ID
  319. WHERE
  320. REGEXP_LIKE(
  321. C.Id,'^('||
  322. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId})>0 then
  323. (SELECT LISTAGG(id, '|') WITHIN GROUP(ORDER BY PERSID) as
  324. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId})
  325. else (select 'non' from dual) end)
  326. ||')')
  327. AND C.CODE LIKE '${adCode}%' AND C.PTYPE = '2'
  328. <if test="adNm != null and adNm != ''">AND A.WATER_SOURCE_NM LIKE '%${adNm}%'</if>
  329. </select>
  330. <select id="getPageByNodeId" parameterType="cn.com.goldenwater.dcproj.param.GetVillPageByNodeIdParam"
  331. resultType="cn.com.goldenwater.dcproj.dto.BisInspProSourceProtectDcdxDto">
  332. select A.WTSR_CD ,
  333. A.PRO_PLBM ,
  334. A.MK_PLBM ,
  335. A.POLL_PLBM ,
  336. A.SP_PLBM ,
  337. A.LGTD ,
  338. A.LTTD ,
  339. A.LGTDPC ,
  340. A.LTTDPC ,
  341. A.ENG_SUR_ID ,
  342. A.ENG_ID ,
  343. A.WATER_SOURCE_NM ,
  344. A.VILLAGE_NM ,
  345. A.CWS_CODE ,
  346. A.PLAN_INS_AMOUNT ,
  347. A.SOURCE_TYPE ,
  348. A.IS_PROTECT_AREA ,
  349. A.WATER_QUALITY ,
  350. A.IS_PROTECT_MARK ,
  351. A.IS_POLL_SOURCE ,
  352. A.IS_SPARE ,
  353. TO_CHAR(A.VISIT_DATE,'YYYY-MM-DD') VISIT_DATE,
  354. A.REC_PERS_ID ,
  355. A.REC_PERS2 ,
  356. A.REC_PERS_TEL ,
  357. TO_CHAR(A.CREATE_TIME,'YYYY-MM-DD HH24:MI:SS') CREATE_TIME,
  358. TO_CHAR(A.UPDATE_TIME,'YYYY-MM-DD HH24:MI:SS') UPDATE_TIME,
  359. A.STATUS,
  360. A.POLL_NOTE,D.PNM GROUP_NM,F.PNM CHKCOM from
  361. BIS_INSP_PRO_SOURCE_PROTECT A LEFT JOIN BIS_INSP_VILL_RGSTR B ON A.ENG_ID=B.ENG_ID LEFT JOIN bis_insp_all_obj C
  362. ON B.OBJ_ID=C.OBJ_ID
  363. LEFT JOIN BIS_INSP_ALL D ON C.ID=D.ID LEFT JOIN BIS_INSP_ALL E ON D.PID=E.ID LEFT JOIN BIS_INSP_ALL F ON
  364. E.PID=F.ID WHERE 1=1
  365. <if test="nodeId != null and nodeId != ''">
  366. and C.ID like #{nodeId}||'%'
  367. </if>
  368. <if test="startDate != null and startDate != ''">
  369. AND A.VISIT_DATE &gt;=TO_DATE(#{startDate},'YYYY-MM-DD')
  370. </if>
  371. <if test="endDate != null and endDate != ''">
  372. AND A.VISIT_DATE &lt;=TO_DATE(#{endDate},'YYYY-MM-DD')+1
  373. </if>
  374. <if test="chkComId != null and chkComId != ''">
  375. AND F.ID =#{chkComId}
  376. </if>
  377. <if test="groupId != null and groupId != ''">
  378. AND D.ID =#{groupId}
  379. </if>
  380. <if test="adNm != null and adNm != ''">
  381. AND A.VILLAGE_NM LIKE '%'||#{adNm}||'%'
  382. </if>
  383. ORDER BY A.UPDATE_TIME DESC,A.VISIT_DATE DESC
  384. </select>
  385. </mapper>