BisInspWtdstDao.xml 25 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524
  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.BisInspWtdstDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspWtdst" id="bisInspWtdstResultMap">
  5. <result property="wtdstDtle" column="WTDST_DTLE" />
  6. <result property="wtdstWrkam" column="WTDST_WRKAM" />
  7. <result property="planRcvrTm" column="PLAN_RCVR_TM" />
  8. <result property="intm" column="INTM" />
  9. <result property="uptm" column="UPTM" />
  10. <result property="note" column="NOTE" />
  11. <result property="wtdstLgtd" column="WTDST_LGTD" />
  12. <result property="wtdstLttd" column="WTDST_LTTD" />
  13. <result property="locNm" column="LOC_NM" />
  14. <result property="objType" column="OBJ_TYPE" />
  15. <result property="objCode" column="OBJ_CODE" />
  16. <result property="objName" column="OBJ_NAME" />
  17. <result property="centerXGd" column="CENTER_X_GD" />
  18. <result property="centerYGd" column="CENTER_Y_GD" />
  19. <result property="prjamntTcfSum" column="PRJAMNT_TCF_SUM" />
  20. <result property="prjamntMony" column="PRJAMNT_MONY" />
  21. <result property="prjamntSum" column="PRJAMNT_SUM" />
  22. <result property="prjState" column="PRJ_STATE" />
  23. <result property="fdPlan" column="FD_PLAN" />
  24. <result property="year" column="YEAR" />
  25. <result property="wtdstId" column="WTDST_ID" />
  26. <result property="wtdstType" column="WTDST_TYPE" />
  27. <result property="wtdstNm" column="WTDST_NM" />
  28. <result property="wtdstState" column="WTDST_STATE" />
  29. <result property="locAd" column="LOC_AD" />
  30. <result property="orgId" column="ORG_ID" />
  31. <result property="cost" column="COST" />
  32. <result property="planRcvr" column="PLAN_RCVR" />
  33. <result property="prjType" column="PRJ_TYPE" />
  34. <result property="wtdstLev" column="WTDST_LEV" />
  35. <result property="prjamntTcfBch" column="PRJAMNT_TCF_BCH" />
  36. <result property="prjamntTcfNo" column="PRJAMNT_TCF_NO" />
  37. <result property="adName" column="AD_NAME" />
  38. </resultMap>
  39. <sql id="table_columns">
  40. AD_NAME,
  41. WTDST_DTLE,
  42. WTDST_WRKAM,
  43. PLAN_RCVR_TM,
  44. INTM,
  45. UPTM,
  46. NOTE,
  47. WTDST_LGTD,
  48. WTDST_LTTD,
  49. LOC_NM,
  50. OBJ_TYPE,
  51. OBJ_CODE,
  52. OBJ_NAME,
  53. CENTER_X_GD,
  54. CENTER_Y_GD,
  55. PRJAMNT_TCF_SUM,
  56. PRJAMNT_MONY,
  57. PRJAMNT_SUM,
  58. PRJ_STATE,
  59. FD_PLAN,
  60. YEAR,
  61. WTDST_ID,
  62. WTDST_TYPE,
  63. WTDST_NM,
  64. WTDST_STATE,
  65. LOC_AD,
  66. ORG_ID,
  67. COST,
  68. PLAN_RCVR,
  69. PRJ_TYPE,
  70. WTDST_LEV,
  71. PRJAMNT_TCF_BCH,
  72. PRJAMNT_TCF_NO,
  73. PROVINCIAL
  74. </sql>
  75. <sql id="entity_properties">
  76. #{adName},
  77. #{wtdstDtle},
  78. #{wtdstWrkam},
  79. #{planRcvrTm},
  80. #{intm},
  81. #{uptm},
  82. #{note},
  83. #{wtdstLgtd},
  84. #{wtdstLttd},
  85. #{locNm},
  86. #{objType},
  87. #{objCode},
  88. #{objName},
  89. #{centerXGd},
  90. #{centerYGd},
  91. #{prjamntTcfSum},
  92. #{prjamntMony},
  93. #{prjamntSum},
  94. #{prjState},
  95. #{fdPlan},
  96. #{year},
  97. #{wtdstId},
  98. #{wtdstType},
  99. #{wtdstNm},
  100. #{wtdstState},
  101. #{locAd},
  102. #{orgId},
  103. #{cost},
  104. #{planRcvr},
  105. #{prjType},
  106. #{wtdstLev},
  107. #{prjamntTcfBch},
  108. #{prjamntTcfNo},
  109. #{provincial}
  110. </sql>
  111. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  112. <sql id="page_where">
  113. <trim prefix="where" prefixOverrides="and | or ">
  114. <if test="wtdstId != null and wtdstId != ''">and WTDST_ID = #{wtdstId}</if>
  115. <if test="wtdstType != null and wtdstType != ''">and WTDST_TYPE = #{wtdstType}</if>
  116. <if test="wtdstNm != null and wtdstNm != ''">and WTDST_NM LIKE concat('%',#{wtdstNm},'%')</if>
  117. <if test="wtdstState != null and wtdstState != ''">and WTDST_STATE = #{wtdstState}</if>
  118. <if test="locAd != null and locAd != ''">and LOC_AD LIKE concat(#{locAd},'%')</if>
  119. <if test="wtdstDtle != null and wtdstDtle != ''">and WTDST_DTLE = #{wtdstDtle}</if>
  120. <if test="wtdstWrkam != null and wtdstWrkam != ''">and WTDST_WRKAM = #{wtdstWrkam}</if>
  121. <if test="planRcvrTm != null and planRcvrTm != ''">and PLAN_RCVR_TM = STR_TO_DATE(#{planRcvrTm},'%Y-%m-%d')
  122. </if>
  123. <if test="intm != null and intm != ''">and INTM = STR_TO_DATE(#{intm},'%Y-%m-%d %H:%i:%s')</if>
  124. <if test="uptm != null and uptm != ''">and UPTM = STR_TO_DATE(#{uptm},'%Y-%m-%d %H:%i:%s')</if>
  125. <if test="note != null and note != ''">and NOTE = #{note}</if>
  126. <if test="wtdstLgtd != null and wtdstLgtd != ''">and WTDST_LGTD = #{wtdstLgtd}</if>
  127. <if test="wtdstLttd != null and wtdstLttd != ''">and WTDST_LTTD = #{wtdstLttd}</if>
  128. <if test="locNm != null and locNm != ''">and LOC_NM LIKE concat('%',#{locNm},'%')</if>
  129. <if test="objType != null and objType != ''">and OBJ_TYPE = #{objType}</if>
  130. <if test="objCode != null and objCode != ''">and OBJ_CODE = #{objCode}</if>
  131. <if test="objName != null and objName != ''">and OBJ_NAME LIKE concat('%',#{objName},'%')</if>
  132. <if test="centerXGd != null and centerXGd != ''">and CENTER_X_GD = #{centerXGd}</if>
  133. <if test="centerYGd != null and centerYGd != ''">and CENTER_Y_GD = #{centerYGd}</if>
  134. <if test="orgId != null and orgId != ''">and ORG_ID = #{orgId}</if>
  135. <if test="cost != null and cost != ''">and COST = #{cost}</if>
  136. <if test="planRcvr != null and planRcvr != ''">and PLAN_RCVR = #{planRcvr}</if>
  137. <if test="province != null and province != ''">and loc_ad LIKE concat(#{province},'%') </if>
  138. <if test="provincial != null and provincial != ''">and PROVINCIAL = #{provincial}</if>
  139. </trim>
  140. </sql>
  141. <select id="get" resultMap="bisInspWtdstResultMap" parameterType="String" >
  142. select <include refid="table_columns" /> from BIS_INSP_WTDST where WTDST_ID = #{id}
  143. </select>
  144. <select id="getBy" resultMap="bisInspWtdstResultMap">
  145. select <include refid="table_columns" /> from BIS_INSP_WTDST <include refid="page_where" />
  146. </select>
  147. <select id="findAll" resultMap="bisInspWtdstResultMap">
  148. select <include refid="table_columns" /> from BIS_INSP_WTDST
  149. </select>
  150. <select id="findList" resultMap="bisInspWtdstResultMap">
  151. select <include refid="table_columns" /> from BIS_INSP_WTDST <include refid="page_where" /> ORDER BY plan_rcvr_tm DESC
  152. </select>
  153. <select id="selectCount" resultType="int" >
  154. select count(WTDST_ID) from BIS_INSP_WTDST <include refid="page_where" />
  155. </select>
  156. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspWtdst">
  157. insert into BIS_INSP_WTDST( <include refid="table_columns" /> )
  158. values ( <include refid="entity_properties" /> )
  159. </insert>
  160. <delete id="delete" parameterType="java.lang.String">
  161. delete from BIS_INSP_WTDST where WTDST_ID = #{id}
  162. </delete>
  163. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspWtdst">
  164. delete from BIS_INSP_WTDST <include refid="page_where" />
  165. </delete>
  166. <update id="deleteInFlag" parameterType="java.lang.String">
  167. update BIS_INSP_WTDST set flag_valid = 0 where WTDST_ID = #{id}
  168. </update>
  169. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspWtdst">
  170. update BIS_INSP_WTDST
  171. <trim prefix="set" suffixOverrides=",">
  172. <if test="wtdstWrkam != null and wtdstWrkam != ''">WTDST_WRKAM = #{wtdstWrkam},</if>
  173. <if test="planRcvrTm != null">PLAN_RCVR_TM = #{planRcvrTm},</if>
  174. <if test="intm != null">INTM = #{intm},</if>
  175. <if test="uptm != null">UPTM = #{uptm},</if>
  176. <if test="note != null and note != ''">NOTE = #{note},</if>
  177. <if test="wtdstLgtd != null and wtdstLgtd != ''">WTDST_LGTD = #{wtdstLgtd},</if>
  178. <if test="wtdstLttd != null and wtdstLttd != ''">WTDST_LTTD = #{wtdstLttd},</if>
  179. <if test="locNm != null and locNm != ''">LOC_NM = #{locNm},</if>
  180. <if test="objType != null and objType != ''">OBJ_TYPE = #{objType},</if>
  181. <if test="objCode != null and objCode != ''">OBJ_CODE = #{objCode},</if>
  182. <if test="objName != null and objName != ''">OBJ_NAME = #{objName},</if>
  183. <if test="centerXGd != null and centerXGd != ''">CENTER_X_GD = #{centerXGd},</if>
  184. <if test="centerYGd != null and centerYGd != ''">CENTER_Y_GD = #{centerYGd},</if>
  185. <if test="prjamntTcfSum != null and prjamntTcfSum != ''">PRJAMNT_TCF_SUM = #{prjamntTcfSum},</if>
  186. <if test="prjamntMony != null and prjamntMony != ''">PRJAMNT_MONY = #{prjamntMony},</if>
  187. <if test="prjamntSum != null and prjamntSum != ''">PRJAMNT_SUM = #{prjamntSum},</if>
  188. <if test="prjState != null and prjState != ''">PRJ_STATE = #{prjState},</if>
  189. <if test="fdPlan != null and fdPlan != ''">FD_PLAN = #{fdPlan},</if>
  190. <if test="year != null and year != ''">YEAR = #{year},</if>
  191. <if test="wtdstId != null and wtdstId != ''">WTDST_ID = #{wtdstId},</if>
  192. <if test="wtdstType != null and wtdstType != ''">WTDST_TYPE = #{wtdstType},</if>
  193. <if test="wtdstNm != null and wtdstNm != ''">WTDST_NM = #{wtdstNm},</if>
  194. <if test="wtdstState != null and wtdstState != ''">WTDST_STATE = #{wtdstState},</if>
  195. <if test="locAd != null and locAd != ''">LOC_AD = #{locAd},</if>
  196. <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
  197. <if test="cost != null and cost != ''">COST = #{cost},</if>
  198. <if test="planRcvr != null and planRcvr != ''">PLAN_RCVR = #{planRcvr},</if>
  199. <if test="prjType != null and prjType != ''">PRJ_TYPE = #{prjType},</if>
  200. <if test="wtdstLev != null and wtdstLev != ''">WTDST_LEV = #{wtdstLev},</if>
  201. <if test="prjamntTcfBch != null and prjamntTcfBch != ''">PRJAMNT_TCF_BCH = #{prjamntTcfBch},</if>
  202. <if test="prjamntTcfNo != null and prjamntTcfNo != ''">PRJAMNT_TCF_NO = #{prjamntTcfNo},</if>
  203. <if test="provincial != null and provincial != ''">PROVINCIAL = #{provincial},</if>
  204. </trim>
  205. <where>WTDST_ID = #{wtdstId}</where>
  206. </update>
  207. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspWtdst">
  208. update BIS_INSP_WTDST
  209. <trim prefix="set" suffixOverrides=",">
  210. <if test="wtdstWrkam != null and wtdstWrkam != ''">WTDST_WRKAM = #{wtdstWrkam},</if>
  211. <if test="planRcvrTm != null">PLAN_RCVR_TM = #{planRcvrTm},</if>
  212. <if test="intm != null">INTM = #{intm},</if>
  213. <if test="uptm != null">UPTM = #{uptm},</if>
  214. <if test="note != null and note != ''">NOTE = #{note},</if>
  215. <if test="wtdstLgtd != null and wtdstLgtd != ''">WTDST_LGTD = #{wtdstLgtd},</if>
  216. <if test="wtdstLttd != null and wtdstLttd != ''">WTDST_LTTD = #{wtdstLttd},</if>
  217. <if test="locNm != null and locNm != ''">LOC_NM = #{locNm},</if>
  218. <if test="objType != null and objType != ''">OBJ_TYPE = #{objType},</if>
  219. <if test="objCode != null and objCode != ''">OBJ_CODE = #{objCode},</if>
  220. <if test="objName != null and objName != ''">OBJ_NAME = #{objName},</if>
  221. <if test="centerXGd != null and centerXGd != ''">CENTER_X_GD = #{centerXGd},</if>
  222. <if test="centerYGd != null and centerYGd != ''">CENTER_Y_GD = #{centerYGd},</if>
  223. <if test="prjamntTcfSum != null and prjamntTcfSum != ''">PRJAMNT_TCF_SUM = #{prjamntTcfSum},</if>
  224. <if test="prjamntMony != null and prjamntMony != ''">PRJAMNT_MONY = #{prjamntMony},</if>
  225. <if test="prjamntSum != null and prjamntSum != ''">PRJAMNT_SUM = #{prjamntSum},</if>
  226. <if test="prjState != null and prjState != ''">PRJ_STATE = #{prjState},</if>
  227. <if test="fdPlan != null and fdPlan != ''">FD_PLAN = #{fdPlan},</if>
  228. <if test="year != null and year != ''">YEAR = #{year},</if>
  229. <if test="wtdstId != null and wtdstId != ''">WTDST_ID = #{wtdstId},</if>
  230. <if test="wtdstType != null and wtdstType != ''">WTDST_TYPE = #{wtdstType},</if>
  231. <if test="wtdstNm != null and wtdstNm != ''">WTDST_NM = #{wtdstNm},</if>
  232. <if test="wtdstState != null and wtdstState != ''">WTDST_STATE = #{wtdstState},</if>
  233. <if test="locAd != null and locAd != ''">LOC_AD = #{locAd},</if>
  234. <if test="orgId != null and orgId != ''">ORG_ID = #{orgId},</if>
  235. <if test="cost != null and cost != ''">COST = #{cost},</if>
  236. <if test="planRcvr != null and planRcvr != ''">PLAN_RCVR = #{planRcvr},</if>
  237. <if test="prjType != null and prjType != ''">PRJ_TYPE = #{prjType},</if>
  238. <if test="wtdstLev != null and wtdstLev != ''">WTDST_LEV = #{wtdstLev},</if>
  239. <if test="prjamntTcfBch != null and prjamntTcfBch != ''">PRJAMNT_TCF_BCH = #{prjamntTcfBch},</if>
  240. <if test="prjamntTcfNo != null and prjamntTcfNo != ''">PRJAMNT_TCF_NO = #{prjamntTcfNo},</if>
  241. <if test="provincial != null and provincial != ''">PROVINCIAL = #{provincial},</if>
  242. </trim>
  243. <include refid="page_where" />
  244. </update>
  245. <!-- 其他自定义SQL -->
  246. <!--查询督查范围内的对下那个-->
  247. <select id="getListByInspGroupIdObjType" resultType="cn.com.goldenwater.dcproj.model.BisInspWtdst">
  248. select t.*,C.id,C.PNM,B.obj_id
  249. from BIS_INSP_WTDST t
  250. left join BIS_INSP_ALL_OBJ B
  251. on B.CODE = t.wtdst_id
  252. LEFT JOIN BIS_INSP_ALL C ON B.ID = C.ID
  253. and B.ptype = #{objType}
  254. where 1 = 1
  255. <if test='isAll == "0"'>and B.ID = #{inspGroupId}</if>
  256. <if test='isAll == "1"'>and B.ID LIKE '${inspGroupId}%'</if>
  257. <if test="wtdstNm != null and wtdstNm != ''">and t.WTDST_NM LIKE '%${wtdstNm}%'</if>
  258. <if test="wtdstState != null and wtdstState != ''">and t.WTDST_STATE = #{wtdstState}</if>
  259. <if test="wtdstType != null and wtdstType != ''">and t.WTDST_TYPE = #{wtdstType}</if>
  260. <if test="adCode != null and adCode != ''">and t.LOC_AD LIKE '${adCode}%'</if>
  261. <choose>
  262. <when test="province !=null and province !=''">
  263. and t.LOC_AD like '${province}%'
  264. </when>
  265. <otherwise>
  266. and t.LOC_AD is null
  267. </otherwise>
  268. </choose>
  269. </select>
  270. <!--查询不在范围内的对象-->
  271. <select id="getObjListNotInspGroupId" resultType="cn.com.goldenwater.dcproj.model.BisInspWtdst">
  272. SELECT * FROM BIS_INSP_WTDST T
  273. WHERE T.WTDST_ID NOT IN (
  274. SELECT CODE FROM BIS_INSP_ALL_OBJ B WHERE ID LIKE CONCAT(#{inspGroupId},'%')
  275. )
  276. <if test="province !=null and province !=''">and t.LOC_AD like '${province}%'</if>
  277. <if test="wtdstNm != null and wtdstNm != ''">and t.WTDST_NM LIKE '%${wtdstNm}%'</if>
  278. <if test="wtdstState != null and wtdstState != ''">and t.WTDST_STATE = #{wtdstState}</if>
  279. <if test="wtdstType != null and wtdstType != ''">and t.WTDST_TYPE = #{wtdstType}</if>
  280. <if test="adCode != null and adCode != ''">and t.LOC_AD LIKE '${adCode}%'</if>
  281. <if test="year != null and year != ''">and t.year = #{year}</if>
  282. <if test="prjState != null and prjState != ''">and t.PRJ_STATE = #{prjState}</if>
  283. </select>
  284. <sql id="orgIdSql">
  285. <choose>
  286. <when test="orgId !=null and orgId !=''">
  287. and ORG_ID=#{orgId}
  288. </when>
  289. <otherwise>
  290. and ORG_ID is null
  291. </otherwise>
  292. </choose>
  293. </sql>
  294. <select id="getObjByPersId" parameterType="cn.com.goldenwater.dcproj.param.PersObjParam" resultType="cn.com.goldenwater.dcproj.model.AttPersWtdst">
  295. SELECT TR.TRACK_ID,A.WTDST_ID,
  296. A.WTDST_TYPE,
  297. A.WTDST_NM,
  298. A.WTDST_STATE,
  299. A.LOC_AD,
  300. A.WTDST_DTLE,
  301. A.WTDST_WRKAM,
  302. A.PLAN_RCVR_TM,
  303. A.INTM,
  304. A.UPTM,
  305. A.NOTE,
  306. A.WTDST_LGTD,
  307. A.WTDST_LTTD,
  308. A.LOC_NM,B.ID,
  309. A.CENTER_X_GD,
  310. A.CENTER_Y_GD,
  311. B.NM,
  312. B.PTYPE,
  313. B.LGTD,
  314. B.LTTD,AD.AD_NAME adName,
  315. B.OBJ_ID,
  316. TR.AD_NM,
  317. TR.STATE,
  318. A.PROVINCIAL
  319. FROM BIS_INSP_WTDST A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.WTDST_ID = B.CODE
  320. LEFT JOIN ATT_AD_BASE AD ON A.LOC_AD = AD.AD_CODE
  321. LEFT JOIN (select a.track_id,a.state ,a.obj_id ,a.ad_nm from BIS_INSP_WTDST_TRACK a LEFT JOIN (select obj_id,max(intm) intm from BIS_INSP_WTDST_TRACK group by obj_id) b ON a.OBJ_ID = b.OBJ_ID where a.intm = b.intm) TR ON B.OBJ_ID = TR.OBJ_ID
  322. WHERE B.PTYPE = #{objType}
  323. <include refid="choseSql"/>
  324. AND
  325. REGEXP_LIKE(
  326. B.Id,concat('^(',
  327. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persGuid}
  328. <include refid="orgIdSql"/>
  329. )>0 then
  330. (SELECT group_concat(id separator '|') as id
  331. FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persGuid}
  332. <include refid="orgIdSql"/>
  333. GROUP BY PERSID
  334. )
  335. else (select 'non' from dual) end)
  336. ,')') )
  337. <if test="wtdstNm != null and wtdstNm != ''">and A.WTDST_NM LIKE '%${wtdstNm}%'</if>
  338. <if test="adCode != null and adCode != ''">and A.LOC_AD LIKE '${adCode}%'</if>
  339. <if test="maxcenterXGd != null and maxcenterXGd != '' and mincenterXGd != null and mincenterXGd != ''">and A.CENTER_X_GD BETWEEN #{mincenterXGd} AND #{maxcenterXGd}</if>
  340. <if test="maxcenterYGd != null and maxcenterYGd != '' and mincenterYGd != null and mincenterYGd != ''">and A.CENTER_Y_GD BETWEEN #{mincenterYGd} AND #{maxcenterYGd}</if>
  341. ORDER BY A.LOC_AD
  342. </select>
  343. <sql id="choseSql">
  344. <choose>
  345. <when test="province !=null and province !=''">
  346. and B.ad_code like '${province}%'
  347. </when>
  348. <otherwise>
  349. and B.ad_code is null
  350. </otherwise>
  351. </choose>
  352. </sql>
  353. <select id="findDtoList" resultType="cn.com.goldenwater.dcproj.dto.BisInspWtdstDetailDto" parameterType="cn.com.goldenwater.dcproj.param.BisInspWtdstDtoListParam">
  354. select
  355. A.WTDST_ID,A.WTDST_TYPE,A.WTDST_NM,A.WTDST_LGTD,A.WTDST_LTTD,A.LOC_NM,A.OBJ_TYPE,A.OBJ_CODE,A.OBJ_NAME,A.CENTER_X_GD,A.CENTER_Y_GD,A.LOC_AD,A.PROVINCIAL,
  356. C.TRACK_ID ,
  357. c.CHK_TIME,
  358. CASE WHEN C.OBJ_ID IS NULL THEN B.OBJ_ID ELSE C.OBJ_ID END OBJ_ID ,
  359. C.OBJ_NM ,
  360. C.MANG_NM ,
  361. C.LOAC ,
  362. CASE WHEN C.DIS_CONTENT IS NULL THEN A.WTDST_DTLE ELSE C.DIS_CONTENT END DIS_CONTENT ,
  363. A.WTDST_WRKAM,
  364. CASE WHEN C.WKSTATE IS NULL THEN A.WTDST_STATE ELSE C.WKSTATE END WKSTATE,
  365. DATE_FORMAT(CASE WHEN C.PLAN_TM IS NULL THEN A.PLAN_RCVR_TM ELSE C.PLAN_TM END,'%Y-%m-%d') PLAN_TM,
  366. C.PROM_NUM ,
  367. C.AD_NM ,
  368. C.GROUP_LEADER_ID ,
  369. C.GROUP_LEADER ,
  370. C.GROUP_LEADER_TEL ,
  371. C.REC_PERS_ID ,
  372. C.REC_PERS ,
  373. C.REC_PERS_TEL ,
  374. C.INDP ,
  375. DATE_FORMAT(C.INTM,'%Y-%m-%d %H:%i:%s') INTM,
  376. DATE_FORMAT(C.UPTM,'%Y-%m-%d %H:%i:%s') UPTM,
  377. C.NOTE ,
  378. C.ATTACHID ,
  379. C.DATA_STAT ,
  380. C.STATE, c.prj_state,
  381. D.PNM GROUPNM ,D.ID GROUPID,F.PNM CHKCOM,F.ID CHKID,H.AD_NAME COUNTY,I.AD_NAME CITY,J.AD_NAME PROVINCE
  382. from BIS_INSP_WTDST A JOIN BIS_INSP_ALL_OBJ B ON A.WTDST_ID=B.CODE LEFT JOIN BIS_INSP_WTDST_TRACK C ON B.OBJ_ID=C.OBJ_ID
  383. LEFT JOIN BIS_INSP_ALL D ON B.ID=D.ID LEFT JOIN BIS_INSP_ALL E ON D.PID=E.ID LEFT JOIN BIS_INSP_ALL F ON E.PID=F.ID
  384. LEFT JOIN ATT_AD_X_BASE H ON A.LOC_AD=H.AD_CODE
  385. LEFT JOIN ATT_AD_X_BASE I ON H.AD_FCODE=I.AD_CODE LEFT JOIN ATT_AD_X_BASE J ON I.AD_FCODE=J.AD_CODE
  386. WHERE 1=1
  387. <if test="tabType =='2'.toString()">
  388. and D.entm &lt; DATE_ADD(STR_TO_DATE(#{nowTime},'%Y-%m-%d'), INTERVAL 1 DAY)
  389. </if>
  390. <if test="tabType =='1'.toString()">
  391. and D.entm &gt;=STR_TO_DATE(#{nowTime},'%Y-%m-%d')
  392. </if>
  393. <if test="wtdstId != null and wtdstId != ''">and A.WTDST_ID = #{wtdstId}</if>
  394. <if test="wtdstType != null and wtdstType != ''">and A.WTDST_TYPE = #{wtdstType}</if>
  395. <if test="wtdstNm != null and wtdstNm != ''">and A.WTDST_NM LIKE concat('%',#{wtdstNm},'%')</if>
  396. <if test="locNm != null and locNm != ''">and A.LOC_NM LIKE concat('%',#{locNm},'%')</if>
  397. <if test="objType != null and objType != ''">and A.OBJ_TYPE = #{objType}</if>
  398. <if test="objCode != null and objCode != ''">and A.OBJ_CODE = #{objCode}</if>
  399. <if test="objName != null and objName != ''">and A.OBJ_NAME LIKE concat('%',#{objName},'%')</if>
  400. <if test="trackId != null and trackId != ''">and C.TRACK_ID = #{trackId}</if>
  401. <if test="objId != null and objId != ''">and C.OBJ_ID = #{objId}</if>
  402. <if test="mangNm != null and mangNm != ''">and C.MANG_NM = #{mangNm}</if>
  403. <if test="disContent != null and disContent != ''">and A.WTDST_DTLE LIKE concat('%',#{disContent},'%')</if>
  404. <if test="wkstate != null and wkstate != ''">and A.WTDST_STATE = #{wkstate}</if>
  405. <if test="planTm != null and planTm != ''">and A.PLAN_RCVR_TM = STR_TO_DATE(#{planTm},'%Y-%m-%d')</if>
  406. <if test="state != null and state != ''">and C.STATE = #{state}</if>
  407. <if test="locAd != null and locAd != ''">and A.LOC_AD LIKE concat( #{locAd},'%')</if>
  408. <if test="startDate != null and startDate != ''">
  409. AND C.CHK_TIME &gt;=STR_TO_DATE(#{startDate},'%Y-%m-%d')
  410. </if>
  411. <if test="endDate != null and endDate != ''">
  412. AND C.CHK_TIME &lt; DATE_ADD(STR_TO_DATE(#{endDate},'%Y-%m-%d'), INTERVAL 1 DAY)
  413. </if>
  414. <if test="chkComId != null and chkComId != ''">
  415. AND F.ID =#{chkComId}
  416. </if>
  417. <if test="nodeId !=null and nodeId !=''">
  418. AND B.ID like '${nodeId}%'
  419. </if>
  420. <if test="groupId != null and groupId != ''">
  421. AND D.ID =#{groupId}
  422. </if>
  423. <if test="adNm != null and adNm != ''">
  424. AND( A.LOC_NM LIKE concat('%',#{adNm},'%') OR H.AD_NAME LIKE concat('%',#{adNm},'%') OR I.AD_NAME LIKE concat('%',#{adNm},'%') OR J.AD_NAME LIKE concat('%',#{adNm},'%') )
  425. </if>
  426. AND
  427. REGEXP_LIKE(
  428. B.Id,concat('^(',
  429. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persGuid}
  430. <include refid="orgIdSql"/>
  431. )>0 then
  432. (SELECT group_concat(id separator '|') as
  433. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persGuid}
  434. <include refid="orgIdSql"/>
  435. GROUP BY PERSID
  436. )
  437. else (select 'non' from dual) end)
  438. ,')') )
  439. ORDER BY C.STATE,C.UPTM
  440. </select>
  441. <select id="findDtoListAboutExport" resultType="cn.com.goldenwater.dcproj.dto.BisInspWtdstDetailDto" parameterType="cn.com.goldenwater.dcproj.param.TypeExportParam">
  442. select A.WTDST_ID,A.WTDST_TYPE,A.WTDST_NM,A.WTDST_LGTD,A.WTDST_LTTD,A.LOC_NM,A.OBJ_TYPE,A.OBJ_CODE,A.OBJ_NAME,A.CENTER_X_GD,A.CENTER_Y_GD,A.LOC_AD,A.PROVINCIAL,
  443. C.TRACK_ID ,
  444. CASE WHEN C.OBJ_ID IS NULL THEN B.OBJ_ID ELSE C.OBJ_ID END OBJ_ID ,
  445. C.OBJ_NM ,
  446. C.MANG_NM ,
  447. C.LOAC ,
  448. CASE WHEN C.DIS_CONTENT IS NULL THEN A.WTDST_DTLE ELSE C.DIS_CONTENT END DIS_CONTENT ,
  449. A.WTDST_WRKAM,
  450. CASE WHEN C.WKSTATE IS NULL THEN A.WTDST_STATE ELSE C.WKSTATE END WKSTATE,
  451. DATE_FORMAT(CASE WHEN C.PLAN_TM IS NULL THEN A.PLAN_RCVR_TM ELSE C.PLAN_TM END,'%Y-%m-%d') PLAN_TM,
  452. C.PROM_NUM ,
  453. C.AD_NM ,
  454. C.GROUP_LEADER_ID ,
  455. C.GROUP_LEADER ,
  456. C.GROUP_LEADER_TEL ,
  457. C.REC_PERS_ID ,
  458. C.REC_PERS ,
  459. C.REC_PERS_TEL ,
  460. C.INDP ,
  461. DATE_FORMAT(C.INTM,'%Y-%m-%d %H:%i:%s') INTM,
  462. DATE_FORMAT(C.UPTM,'%Y-%m-%d %H:%i:%s') UPTM,
  463. C.NOTE ,
  464. C.ATTACHID ,
  465. C.DATA_STAT ,
  466. C.STATE
  467. from BIS_INSP_WTDST A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.WTDST_ID=B.CODE LEFT JOIN BIS_INSP_WTDST_TRACK C ON B.OBJ_ID=C.OBJ_ID
  468. WHERE 1=1
  469. <include refid="choseSql"/>
  470. <if test="adCodes != null and adCodes != ''">and A.LOC_AD LIKE concat(#{adCodes},'%')</if>
  471. <if test="ids !=null and ids !=''">
  472. AND B.ID IN
  473. <foreach item="item" index="index" collection="ids.split(',')" open="( '" separator="' , '" close="' )">
  474. ${item}
  475. </foreach>
  476. </if>
  477. AND REGEXP_LIKE(
  478. B.Id,concat('^(',
  479. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persGuid}
  480. <include refid="orgIdSql"/>
  481. )>0 then
  482. (SELECT group_concat(id separator '|') as id
  483. FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persGuid}
  484. <include refid="orgIdSql"/>
  485. GROUP BY PERSID
  486. )
  487. else (select 'non' from dual) end)
  488. ,')' ) )
  489. ORDER BY C.STATE,C.UPTM
  490. </select>
  491. <update id="updateBatchProvincial" parameterType="cn.com.goldenwater.dcproj.param.BisInspWtdstParam">
  492. update BIS_INSP_WTDST set PROVINCIAL = #{provincial}
  493. where WTDST_ID in
  494. <foreach item="wtdstId" collection="wtdstIds" open="(" separator="," close=")">
  495. #{wtdstId}
  496. </foreach>
  497. </update>
  498. </mapper>