BisInspProSourceProtectDao.xml 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396
  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. DATE_FORMAT(VISIT_DATE,'%Y-%m-%d') VISIT_DATE,
  58. REC_PERS_ID ,
  59. REC_PERS2 ,
  60. REC_PERS_TEL ,
  61. DATE_FORMAT(CREATE_TIME,'%Y-%m-%d %T') CREATE_TIME,
  62. DATE_FORMAT(UPDATE_TIME,'%Y-%m-%d %T') 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. STR_TO_DATE(#{visitDate},'%Y-%m-%d'),
  120. #{recPersId},
  121. #{recPers2},
  122. #{recPersTel},
  123. STR_TO_DATE(#{createTime},'%Y-%m-%d %T') ,
  124. STR_TO_DATE(#{updateTime},'%Y-%m-%d %T') ,
  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. CONCAT('%', #{waterSourceNm}, '%')
  144. </if>
  145. <if test="villageNm != null and villageNm != ''">and VILLAGE_NM LIKE CONCAT('%', #{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 = STR_TO_DATE(#{visitDate},'%Y-%m-%d')</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 = STR_TO_DATE(#{createTime},'%Y-%m-%d %T')
  159. </if>
  160. <if test="updateTime != null and updateTime != ''">and UPDATE_TIME = STR_TO_DATE(#{updateTime},'%Y-%m-%d %T')
  161. </if>
  162. <if test="status != null and status != ''">and STATUS = #{status}</if>
  163. <if test="pollNote != null and pollNote != ''">and POLL_NOTE = #{pollNote}</if>
  164. </trim>
  165. </sql>
  166. <select id="get" resultMap="bisInspProSourceProtectResultMap" parameterType="String">
  167. select
  168. <include refid="table_columns"/>
  169. from BIS_INSP_PRO_SOURCE_PROTECT where ENG_SUR_ID = #{id}
  170. </select>
  171. <select id="getBy" resultMap="bisInspProSourceProtectResultMap">
  172. select
  173. <include refid="table_columns"/>
  174. from BIS_INSP_PRO_SOURCE_PROTECT
  175. <include refid="page_where"/>
  176. </select>
  177. <select id="findAll" resultMap="bisInspProSourceProtectResultMap">
  178. select
  179. <include refid="table_columns"/>
  180. from BIS_INSP_PRO_SOURCE_PROTECT
  181. </select>
  182. <select id="findList" resultMap="bisInspProSourceProtectResultMap">
  183. select
  184. <include refid="table_columns"/>
  185. from BIS_INSP_PRO_SOURCE_PROTECT
  186. <include refid="page_where"/>
  187. ORDER BY UPDATE_TIME DESC
  188. </select>
  189. <select id="selectCount" resultType="int">
  190. select count(ENG_SUR_ID) from BIS_INSP_PRO_SOURCE_PROTECT
  191. <include refid="page_where"/>
  192. </select>
  193. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspProSourceProtect">
  194. insert into BIS_INSP_PRO_SOURCE_PROTECT(
  195. <include refid="table_columns2"/>
  196. )
  197. values (
  198. <include refid="entity_properties"/>
  199. )
  200. </insert>
  201. <delete id="delete" parameterType="java.lang.String">
  202. delete from BIS_INSP_PRO_SOURCE_PROTECT where ENG_SUR_ID = #{id}
  203. </delete>
  204. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspProSourceProtect">
  205. delete from BIS_INSP_PRO_SOURCE_PROTECT
  206. <include refid="page_where"/>
  207. </delete>
  208. <update id="deleteInFlag" parameterType="java.lang.String">
  209. update BIS_INSP_PRO_SOURCE_PROTECT set flag_valid = 0 where ENG_SUR_ID = #{id}
  210. </update>
  211. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspProSourceProtect">
  212. update BIS_INSP_PRO_SOURCE_PROTECT
  213. <trim prefix="set" suffixOverrides=",">
  214. <if test="wtsrCd != null and wtsrCd != ''">WTSR_CD = #{wtsrCd},</if>
  215. <if test="proPlbm != null and proPlbm != ''">PRO_PLBM = #{proPlbm},</if>
  216. <if test="mkPlbm != null and mkPlbm != ''">MK_PLBM = #{mkPlbm},</if>
  217. <if test="pollPlbm != null and pollPlbm != ''">POLL_PLBM = #{pollPlbm},</if>
  218. <if test="spPlbm != null and spPlbm != ''">SP_PLBM = #{spPlbm},</if>
  219. <if test="lgtd != null and lgtd != ''">LGTD = #{lgtd},</if>
  220. <if test="lttd != null and lttd != ''">LTTD = #{lttd},</if>
  221. <if test="lgtdpc != null and lgtdpc != ''">LGTDPC = #{lgtdpc},</if>
  222. <if test="lttdpc != null and lttdpc != ''">LTTDPC = #{lttdpc},</if>
  223. <if test="engId != null and engId != ''">ENG_ID = #{engId},</if>
  224. <if test="waterSourceNm != null and waterSourceNm != ''">WATER_SOURCE_NM = #{waterSourceNm},</if>
  225. <if test="villageNm != null and villageNm != ''">VILLAGE_NM = #{villageNm},</if>
  226. <if test="cwsCode != null and cwsCode != ''">CWS_CODE = #{cwsCode},</if>
  227. <if test="planInsAmount != null and planInsAmount != ''">PLAN_INS_AMOUNT = #{planInsAmount},</if>
  228. <if test="sourceType != null and sourceType != ''">SOURCE_TYPE = #{sourceType},</if>
  229. <if test="isProtectArea != null and isProtectArea != ''">IS_PROTECT_AREA = #{isProtectArea},</if>
  230. <if test="waterQuality != null and waterQuality != ''">WATER_QUALITY = #{waterQuality},</if>
  231. <if test="isProtectMark != null and isProtectMark != ''">IS_PROTECT_MARK = #{isProtectMark},</if>
  232. <if test="isPollSource != null and isPollSource != ''">IS_POLL_SOURCE = #{isPollSource},</if>
  233. <if test="isSpare != null and isSpare != ''">IS_SPARE = #{isSpare},</if>
  234. <if test="visitDate != null and visitDate != ''">VISIT_DATE = STR_TO_DATE(#{visitDate},'%Y-%m-%d'),</if>
  235. <if test="recPersId != null and recPersId != ''">REC_PERS_ID = #{recPersId},</if>
  236. <if test="recPers2 != null and recPers2 != ''">REC_PERS2 = #{recPers2},</if>
  237. <if test="recPersTel != null and recPersTel != ''">REC_PERS_TEL = #{recPersTel},</if>
  238. <if test="createTime != null and createTime != ''">CREATE_TIME = STR_TO_DATE(#{createTime},'%Y-%m-%d %T'),
  239. </if>
  240. <if test="updateTime != null and updateTime != ''">UPDATE_TIME = STR_TO_DATE(#{updateTime},'%Y-%m-%d %T'),
  241. </if>
  242. <if test="status != null and status != ''">STATUS = #{status},</if>
  243. <if test="pollNote != null and pollNote != ''">POLL_NOTE = #{pollNote},</if>
  244. </trim>
  245. <where>ENG_SUR_ID = #{engSurId}</where>
  246. </update>
  247. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspProSourceProtect">
  248. update BIS_INSP_PRO_SOURCE_PROTECT
  249. <trim prefix="set" suffixOverrides=",">
  250. <if test="wtsrCd != null and wtsrCd != ''">WTSR_CD = #{wtsrCd},</if>
  251. <if test="proPlbm != null and proPlbm != ''">PRO_PLBM = #{proPlbm},</if>
  252. <if test="mkPlbm != null and mkPlbm != ''">MK_PLBM = #{mkPlbm},</if>
  253. <if test="pollPlbm != null and pollPlbm != ''">POLL_PLBM = #{pollPlbm},</if>
  254. <if test="spPlbm != null and spPlbm != ''">SP_PLBM = #{spPlbm},</if>
  255. <if test="lgtd != null and lgtd != ''">LGTD = #{lgtd},</if>
  256. <if test="lttd != null and lttd != ''">LTTD = #{lttd},</if>
  257. <if test="lgtdpc != null and lgtdpc != ''">LGTDPC = #{lgtdpc},</if>
  258. <if test="lttdpc != null and lttdpc != ''">LTTDPC = #{lttdpc},</if>
  259. <if test="engId != null and engId != ''">ENG_ID = #{engId},</if>
  260. <if test="waterSourceNm != null and waterSourceNm != ''">WATER_SOURCE_NM = #{waterSourceNm},</if>
  261. <if test="villageNm != null and villageNm != ''">VILLAGE_NM = #{villageNm},</if>
  262. <if test="cwsCode != null and cwsCode != ''">CWS_CODE = #{cwsCode},</if>
  263. <if test="planInsAmount != null and planInsAmount != ''">PLAN_INS_AMOUNT = #{planInsAmount},</if>
  264. <if test="sourceType != null and sourceType != ''">SOURCE_TYPE = #{sourceType},</if>
  265. <if test="isProtectArea != null and isProtectArea != ''">IS_PROTECT_AREA = #{isProtectArea},</if>
  266. <if test="waterQuality != null and waterQuality != ''">WATER_QUALITY = #{waterQuality},</if>
  267. <if test="isProtectMark != null and isProtectMark != ''">IS_PROTECT_MARK = #{isProtectMark},</if>
  268. <if test="isPollSource != null and isPollSource != ''">IS_POLL_SOURCE = #{isPollSource},</if>
  269. <if test="isSpare != null and isSpare != ''">IS_SPARE = #{isSpare},</if>
  270. <if test="visitDate != null and visitDate != ''">VISIT_DATE = STR_TO_DATE(#{visitDate},'%Y-%m-%d'),</if>
  271. <if test="recPersId != null and recPersId != ''">REC_PERS_ID = #{recPersId},</if>
  272. <if test="recPers2 != null and recPers2 != ''">REC_PERS2 = #{recPers2},</if>
  273. <if test="recPersTel != null and recPersTel != ''">REC_PERS_TEL = #{recPersTel},</if>
  274. <if test="createTime != null and createTime != ''">CREATE_TIME = STR_TO_DATE(#{createTime},'%Y-%m-%d %T'),
  275. </if>
  276. <if test="updateTime != null and updateTime != ''">UPDATE_TIME = STR_TO_DATE(#{updateTime},'%Y-%m-%d %T'),
  277. </if>
  278. <if test="status != null and status != ''">STATUS = #{status},</if>
  279. <if test="pollNote != null and pollNote != ''">POLL_NOTE = #{pollNote},</if>
  280. </trim>
  281. <include refid="page_where"/>
  282. </update>
  283. <!-- 其他自定义SQL -->
  284. <select id="queryListByObjId" resultType="cn.com.goldenwater.dcproj.dto.BisInspProSourceProtectDto"
  285. parameterType="string">
  286. SELECT * FROM ( SELECT sws_cd ws_cd,CASE WHEN B.WATER_SOURCE_NM IS NULL THEN sws_nm ELSE B.WATER_SOURCE_NM END
  287. ws_nm,
  288. 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,
  289. CASE WHEN B.ENG_ID =#{engId} THEN 1 ELSE 0 end STATUS,CASE WHEN B.ENG_SUR_ID IS NULL THEN sws_cd ELSE
  290. B.ENG_SUR_ID END ID FROM WR_SWS_B A
  291. LEFT JOIN BIS_INSP_PRO_SOURCE_PROTECT B ON A.sws_cd = B.WTSR_CD WHERE A.sws_cd like CONCAT(#{objId}, '%')
  292. <if test="name != null and name != ''">AND B.WATER_SOURCE_NM LIKE CONCAT('%', #{name}, '%')</if>
  293. union all
  294. SELECT gws_cd ws_cd,CASE WHEN B.WATER_SOURCE_NM IS NULL THEN Gws_nm ELSE B.WATER_SOURCE_NM END ws_nm,
  295. 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,
  296. CASE WHEN B.ENG_ID =#{engId} THEN 1 ELSE 0 end STATUS,CASE WHEN B.ENG_SUR_ID IS NULL THEN gws_cd ELSE
  297. B.ENG_SUR_ID END ID FROM WR_GWS_B A
  298. LEFT JOIN BIS_INSP_PRO_SOURCE_PROTECT B ON A.gws_cd = B.WTSR_CD WHERE A.gws_cd like CONCAT(#{objId}, '%')
  299. <if test="name != null and name != ''">AND B.WATER_SOURCE_NM LIKE CONCAT('%', #{name}, '%')</if>
  300. UNION ALL
  301. 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
  302. TM,1 STATUS,A.ENG_SUR_ID ID FROM BIS_INSP_PRO_SOURCE_PROTECT A
  303. LEFT JOIN (SELECT sws_cd WS_CD FROM WR_SWS_B WHERE sws_cd like CONCAT(#{objId}, '%') UNION ALL SELECT Gws_cd WS_CD FROM
  304. WR_GWS_B WHERE Gws_cd like CONCAT(#{objId}, '%') ) B on A.WTSR_CD=B.WS_CD
  305. WHERE B.WS_CD IS NULL AND A.ENG_ID=#{engId} <if test="name != null and name != ''">AND A.WATER_SOURCE_NM LIKE
  306. CONCAT('%', #{name}, '%')</if>) w
  307. ORDER BY STATUS DESC,TM DESC
  308. </select>
  309. <select id="getListByCodeAndPerId" parameterType="cn.com.goldenwater.dcproj.dto.VillRgstrDto"
  310. resultType="cn.com.goldenwater.dcproj.model.BisInspProSourceProtect">
  311. SELECT * FROM BIS_INSP_PRO_SOURCE_PROTECT A LEFT JOIN BIS_INSP_VILL_RGSTR B ON A.ENG_ID = B.ENG_ID
  312. LEFT JOIN BIS_INSP_ALL_OBJ C ON B.OBJ_ID = C.OBJ_ID
  313. WHERE
  314. C.id in (${inIdsSql})
  315. AND C.CODE LIKE '${adCode}%' AND C.PTYPE = '2'
  316. <if test="adNm != null and adNm != ''">AND A.WATER_SOURCE_NM LIKE '%${adNm}%'</if>
  317. </select>
  318. <select id="getPageByNodeId" parameterType="cn.com.goldenwater.dcproj.param.GetVillPageByNodeIdParam"
  319. resultType="cn.com.goldenwater.dcproj.dto.BisInspProSourceProtectDcdxDto">
  320. select A.WTSR_CD ,
  321. A.PRO_PLBM ,
  322. A.MK_PLBM ,
  323. A.POLL_PLBM ,
  324. A.SP_PLBM ,
  325. A.LGTD ,
  326. A.LTTD ,
  327. A.LGTDPC ,
  328. A.LTTDPC ,
  329. A.ENG_SUR_ID ,
  330. A.ENG_ID ,
  331. A.WATER_SOURCE_NM ,
  332. A.VILLAGE_NM ,
  333. A.CWS_CODE ,
  334. A.PLAN_INS_AMOUNT ,
  335. A.SOURCE_TYPE ,
  336. A.IS_PROTECT_AREA ,
  337. A.WATER_QUALITY ,
  338. A.IS_PROTECT_MARK ,
  339. A.IS_POLL_SOURCE ,
  340. A.IS_SPARE ,
  341. DATE_FORMAT(A.VISIT_DATE,'%Y-%m-%d') VISIT_DATE,
  342. A.REC_PERS_ID ,
  343. A.REC_PERS2 ,
  344. A.REC_PERS_TEL ,
  345. DATE_FORMAT(A.CREATE_TIME,'%Y-%m-%d %T') CREATE_TIME,
  346. DATE_FORMAT(A.UPDATE_TIME,'%Y-%m-%d %T') UPDATE_TIME,
  347. A.STATUS,
  348. A.POLL_NOTE,D.PNM GROUP_NM,F.PNM CHKCOM from
  349. 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
  350. ON B.OBJ_ID=C.OBJ_ID
  351. 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
  352. E.PID=F.ID WHERE 1=1
  353. <if test="nodeId != null and nodeId != ''">
  354. and C.ID like CONCAT(#{nodeId}, '%')
  355. </if>
  356. <if test="startDate != null and startDate != ''">
  357. AND A.VISIT_DATE &gt;=STR_TO_DATE(#{startDate},'%Y-%m-%d')
  358. </if>
  359. <if test="endDate != null and endDate != ''">
  360. AND A.VISIT_DATE &lt;=STR_TO_DATE(#{endDate},'%Y-%m-%d')
  361. </if>
  362. <if test="chkComId != null and chkComId != ''">
  363. AND F.ID =#{chkComId}
  364. </if>
  365. <if test="groupId != null and groupId != ''">
  366. AND D.ID =#{groupId}
  367. </if>
  368. <if test="adNm != null and adNm != ''">
  369. AND A.VILLAGE_NM LIKE CONCAT('%', #{adNm}, '%')
  370. </if>
  371. ORDER BY A.UPDATE_TIME DESC,A.VISIT_DATE DESC
  372. </select>
  373. </mapper>