AttJskejianEcofrdRgstrDao.xml 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385
  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.AttJskejianEcofrdRgstrDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.AttJskejianEcofrdRgstr" id="attJskejianEcofrdRgstrResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="objId" column="OBJ_ID"/>
  7. <result property="accepNum" column="ACCEP_NUM"/>
  8. <result property="assignNum" column="ASSIGN_NUM"/>
  9. <result property="adCode" column="AD_CODE"/>
  10. <result property="adName" column="AD_NAME"/>
  11. <result property="location" column="LOCATION"/>
  12. <result property="centerX" column="CENTER_X"/>
  13. <result property="centerY" column="CENTER_Y"/>
  14. <result property="gdX" column="GD_X"/>
  15. <result property="gdY" column="GD_Y"/>
  16. <result property="reportContent" column="REPORT_CONTENT"/>
  17. <result property="biz" column="BIZ"/>
  18. <result property="hostUnit" column="HOST_UNIT"/>
  19. <result property="sptUnit" column="SPT_UNIT"/>
  20. <result property="invstVfctn" column="INVST_VFCTN"/>
  21. <result property="trtmtRctftn" column="TRTMT_RCTFTN"/>
  22. <result property="opinion" column="OPINION"/>
  23. <result property="office" column="OFFICE"/>
  24. <result property="isOver" column="IS_OVER"/>
  25. <result property="reviConc" column="REVI_CONC"/>
  26. <result property="reviOpin" column="REVI_OPIN"/>
  27. <result property="persId" column="PERS_ID"/>
  28. <result property="intm" column="INTM"/>
  29. <result property="uptm" column="UPTM"/>
  30. <result property="state" column="STATE"/>
  31. <result property="groupId" column="GROUP_ID"/>
  32. <result property="province" column="PROVINCE"/>
  33. </resultMap>
  34. <sql id="table_columns">
  35. ID,
  36. OBJ_ID,
  37. ACCEP_NUM,
  38. ASSIGN_NUM,
  39. AD_CODE,
  40. AD_NAME,
  41. LOCATION,
  42. CENTER_X,
  43. CENTER_Y,
  44. GD_X,
  45. GD_Y,
  46. REPORT_CONTENT,
  47. BIZ,
  48. HOST_UNIT,
  49. SPT_UNIT,
  50. INVST_VFCTN,
  51. TRTMT_RCTFTN,
  52. OPINION,
  53. OFFICE,
  54. IS_OVER,
  55. REVI_CONC,
  56. REVI_OPIN,
  57. PERS_ID,
  58. INTM,
  59. UPTM,
  60. STATE,
  61. GROUP_ID,
  62. PROVINCE
  63. </sql>
  64. <sql id="entity_properties">
  65. #{id},
  66. #{objId},
  67. #{accepNum},
  68. #{assignNum},
  69. #{adCode},
  70. #{adName},
  71. #{location},
  72. #{centerX},
  73. #{centerY},
  74. #{gdX},
  75. #{gdY},
  76. #{reportContent},
  77. #{biz},
  78. #{hostUnit},
  79. #{sptUnit},
  80. #{invstVfctn},
  81. #{trtmtRctftn},
  82. #{opinion},
  83. #{office},
  84. #{isOver},
  85. #{reviConc},
  86. #{reviOpin},
  87. #{persId},
  88. #{intm},
  89. #{uptm},
  90. #{state},
  91. #{groupId},
  92. #{province}
  93. </sql>
  94. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  95. <sql id="page_where">
  96. <trim prefix="where" prefixOverrides="and | or ">
  97. <if test="objId != null and objId != ''">and OBJ_ID = #{objId}</if>
  98. <if test="accepNum != null and accepNum != ''">and ACCEP_NUM = #{accepNum}</if>
  99. <if test="assignNum != null and assignNum != ''">and ASSIGN_NUM = #{assignNum}</if>
  100. <if test="adCode != null and adCode != ''">and AD_CODE like '${adCode}%'</if>
  101. <if test="adName != null and adName != ''">and AD_NAME = #{adName}</if>
  102. <if test="location != null and location != ''">and LOCATION = #{location}</if>
  103. <if test="centerX != null and centerX != ''">and CENTER_X = #{centerX}</if>
  104. <if test="centerY != null and centerY != ''">and CENTER_Y = #{centerY}</if>
  105. <if test="gdX != null and gdX != ''">and GD_X = #{gdX}</if>
  106. <if test="gdY != null and gdY != ''">and GD_Y = #{gdY}</if>
  107. <if test="reportContent != null and reportContent != ''">and REPORT_CONTENT = #{reportContent}</if>
  108. <if test="biz != null and biz != ''">and BIZ = #{biz}</if>
  109. <if test="hostUnit != null and hostUnit != ''">and HOST_UNIT = #{hostUnit}</if>
  110. <if test="sptUnit != null and sptUnit != ''">and SPT_UNIT = #{sptUnit}</if>
  111. <if test="invstVfctn != null and invstVfctn != ''">and INVST_VFCTN = #{invstVfctn}</if>
  112. <if test="trtmtRctftn != null and trtmtRctftn != ''">and TRTMT_RCTFTN = #{trtmtRctftn}</if>
  113. <if test="opinion != null and opinion != ''">and OPINION = #{opinion}</if>
  114. <if test="office != null and office != ''">and OFFICE = #{office}</if>
  115. <if test="isOver != null and isOver != ''">and IS_OVER = #{isOver}</if>
  116. <if test="reviConc != null and reviConc != ''">and REVI_CONC = #{reviConc}</if>
  117. <if test="reviOpin != null and reviOpin != ''">and REVI_OPIN = #{reviOpin}</if>
  118. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  119. <if test="intm != null">and INTM = #{intm}</if>
  120. <if test="uptm != null">and UPTM = #{uptm}</if>
  121. <if test="state != null and state != ''">and STATE = #{state}</if>
  122. <if test="groupId != null and groupId != ''">and GROUP_ID = #{groupId}</if>
  123. <if test="province != null and province != ''">and PROVINCE like '%${province}%'</if>
  124. </trim>
  125. </sql>
  126. <select id="get" resultMap="attJskejianEcofrdRgstrResultMap" parameterType="String" >
  127. select <include refid="table_columns" /> from ATT_JSKEJIAN_ECOFRD_RGSTR where ID = #{id}
  128. </select>
  129. <select id="getBy" resultMap="attJskejianEcofrdRgstrResultMap">
  130. select <include refid="table_columns" /> from ATT_JSKEJIAN_ECOFRD_RGSTR <include refid="page_where" />
  131. </select>
  132. <select id="findAll" resultMap="attJskejianEcofrdRgstrResultMap">
  133. select <include refid="table_columns" /> from ATT_JSKEJIAN_ECOFRD_RGSTR
  134. </select>
  135. <select id="findList" resultMap="attJskejianEcofrdRgstrResultMap">
  136. select <include refid="table_columns" /> from ATT_JSKEJIAN_ECOFRD_RGSTR <include refid="page_where" />
  137. </select>
  138. <select id="selectCount" resultType="int" >
  139. select count(ID) from ATT_JSKEJIAN_ECOFRD_RGSTR <include refid="page_where" />
  140. </select>
  141. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.AttJskejianEcofrdRgstr">
  142. insert into ATT_JSKEJIAN_ECOFRD_RGSTR( <include refid="table_columns" /> )
  143. values ( <include refid="entity_properties" /> )
  144. </insert>
  145. <delete id="delete" parameterType="java.lang.String">
  146. delete from ATT_JSKEJIAN_ECOFRD_RGSTR where ID = #{id}
  147. </delete>
  148. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.AttJskejianEcofrdRgstr">
  149. delete from ATT_JSKEJIAN_ECOFRD_RGSTR <include refid="page_where" />
  150. </delete>
  151. <update id="deleteInFlag" parameterType="java.lang.String">
  152. update ATT_JSKEJIAN_ECOFRD_RGSTR set flag_valid = 0 where ID = #{id}
  153. </update>
  154. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.AttJskejianEcofrdRgstr">
  155. update ATT_JSKEJIAN_ECOFRD_RGSTR
  156. <trim prefix="set" suffixOverrides=",">
  157. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  158. <if test="accepNum != null and accepNum != ''">ACCEP_NUM = #{accepNum},</if>
  159. <if test="assignNum != null and assignNum != ''">ASSIGN_NUM = #{assignNum},</if>
  160. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  161. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  162. <if test="location != null and location != ''">LOCATION = #{location},</if>
  163. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  164. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  165. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  166. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  167. <if test="reportContent != null and reportContent != ''">REPORT_CONTENT = #{reportContent},</if>
  168. <if test="biz != null and biz != ''">BIZ = #{biz},</if>
  169. <if test="hostUnit != null and hostUnit != ''">HOST_UNIT = #{hostUnit},</if>
  170. <if test="sptUnit != null and sptUnit != ''">SPT_UNIT = #{sptUnit},</if>
  171. <if test="invstVfctn != null and invstVfctn != ''">INVST_VFCTN = #{invstVfctn},</if>
  172. <if test="trtmtRctftn != null and trtmtRctftn != ''">TRTMT_RCTFTN = #{trtmtRctftn},</if>
  173. <if test="opinion != null and opinion != ''">OPINION = #{opinion},</if>
  174. <if test="office != null and office != ''">OFFICE = #{office},</if>
  175. <if test="isOver != null and isOver != ''">IS_OVER = #{isOver},</if>
  176. <if test="reviConc != null and reviConc != ''">REVI_CONC = #{reviConc},</if>
  177. <if test="reviOpin != null and reviOpin != ''">REVI_OPIN = #{reviOpin},</if>
  178. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  179. <if test="intm != null">INTM = #{intm},</if>
  180. <if test="uptm != null">UPTM = #{uptm},</if>
  181. <if test="state != null and state != ''">STATE = #{state},</if>
  182. <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
  183. <if test="province != null and province != ''">PROVINCE = #{province},</if>
  184. </trim>
  185. <where>ID = #{id}</where>
  186. </update>
  187. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.AttJskejianEcofrdRgstr">
  188. update ATT_JSKEJIAN_ECOFRD_RGSTR
  189. <trim prefix="set" suffixOverrides=",">
  190. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  191. <if test="accepNum != null and accepNum != ''">ACCEP_NUM = #{accepNum},</if>
  192. <if test="assignNum != null and assignNum != ''">ASSIGN_NUM = #{assignNum},</if>
  193. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  194. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  195. <if test="location != null and location != ''">LOCATION = #{location},</if>
  196. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  197. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  198. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  199. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  200. <if test="reportContent != null and reportContent != ''">REPORT_CONTENT = #{reportContent},</if>
  201. <if test="biz != null and biz != ''">BIZ = #{biz},</if>
  202. <if test="hostUnit != null and hostUnit != ''">HOST_UNIT = #{hostUnit},</if>
  203. <if test="sptUnit != null and sptUnit != ''">SPT_UNIT = #{sptUnit},</if>
  204. <if test="invstVfctn != null and invstVfctn != ''">INVST_VFCTN = #{invstVfctn},</if>
  205. <if test="trtmtRctftn != null and trtmtRctftn != ''">TRTMT_RCTFTN = #{trtmtRctftn},</if>
  206. <if test="opinion != null and opinion != ''">OPINION = #{opinion},</if>
  207. <if test="office != null and office != ''">OFFICE = #{office},</if>
  208. <if test="isOver != null and isOver != ''">IS_OVER = #{isOver},</if>
  209. <if test="reviConc != null and reviConc != ''">REVI_CONC = #{reviConc},</if>
  210. <if test="reviOpin != null and reviOpin != ''">REVI_OPIN = #{reviOpin},</if>
  211. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  212. <if test="intm != null">INTM = #{intm},</if>
  213. <if test="uptm != null">UPTM = #{uptm},</if>
  214. <if test="state != null and state != ''">STATE = #{state},</if>
  215. <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
  216. <if test="province != null and province != ''">PROVINCE = #{province},</if>
  217. </trim>
  218. <include refid="page_where" />
  219. </update>
  220. <!-- 其他自定义SQL -->
  221. <select id="findEcfordPage" parameterType="cn.com.goldenwater.dcproj.param.TypeParam" resultType="cn.com.goldenwater.dcproj.dto.BisInspRgstrDto">
  222. select * from (
  223. select A.*,b.id as rgstrId,CASE WHEN B.STATE IS NULL THEN '0' ELSE B.STATE END AS state,(case when b.ASSIGN_NUM is
  224. null then to_char(c.ASSIGN_NUM) else b.ASSIGN_NUM end) as name,b.intm as IN_TM,b.uptm as Up_tm,
  225. c.id as baseId,b.REPORT_CONTENT,b.biz, (case when b.IS_OVER = '1' then '已办结' else '未办结' end) IS_OVER ,
  226. (case when b.location is null then c.location else b.location end) as location,ia.pnm groupName,ria.pnm
  227. riverName,ad.ad_full_name as ad_name from BIS_INSP_ALL_OBJ A join ATT_JSKEJIAN_ECOFRD_RGSTR B on A.Obj_Id
  228. = B.Obj_Id left join ATT_JSKEJIAN_ECOFRD_BASE c on a.code = c.id
  229. 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
  230. left join BIS_INSP_ALL ria on substr(A.ID,0,6) = ria.id
  231. where 1 = 1
  232. <include refid="choseSql"/>
  233. <if test="adName != null and adName != ''">and ad.AD_FULL_NAME LIKE '%${adName}%'</if>
  234. <if test="groupId != null and groupId != ''">and A.id = #{groupId}</if>
  235. <if test="adCode != null and adCode !=''">and B.AD_CODE like '${adCode}%'</if>
  236. <if test="plnaId !=null and plnaId !=''">
  237. and A.id like '${plnaId}%'
  238. </if>
  239. <if test="orgId != null and orgId !=''">and A.org_id = #{orgId}</if>
  240. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  241. AND B.intm &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND B.uptm &lt; TO_DATE(#{entm},'YYYY-MM-DD')+1
  242. </if>
  243. and
  244. REGEXP_LIKE(
  245. A.Id,'^('||
  246. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{presId}
  247. <include refid="orgIdSql"/>
  248. )>0 then
  249. (SELECT LISTAGG(id, '|') as
  250. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{presId}
  251. <include refid="orgIdSql"/> GROUP BY PERSID
  252. )
  253. else (select 'non' from dual) end)
  254. ||')')
  255. ) where 1 = 1
  256. <if test="state != null and state != ''">
  257. and state in (${state})
  258. </if>
  259. <if test="name != null and name != ''">
  260. and name like '%${name}%'
  261. </if>
  262. </select>
  263. <sql id="orgIdSql">
  264. <choose>
  265. <when test="orgId !=null and orgId !=''">
  266. and ORG_ID=#{orgId}
  267. </when>
  268. <otherwise>
  269. and ORG_ID is null
  270. </otherwise>
  271. </choose>
  272. </sql>
  273. <select id="findPcEcfordPage" resultType="cn.com.goldenwater.dcproj.dto.AttJskejianEcofrdRgstrDto"
  274. parameterType="cn.com.goldenwater.dcproj.param.AttJskejianEcofrdRgstrParam">
  275. select * from (
  276. select A.*,b.id as rgstrId,CASE WHEN B.STATE IS NULL THEN '0' ELSE B.STATE END AS state,(case when b.ASSIGN_NUM is
  277. null then to_char(c.ASSIGN_NUM) else b.ASSIGN_NUM end) as name,b.intm,b.uptm,
  278. c.id as baseId,b.biz,b.REPORT_CONTENT,
  279. (case when b.CENTER_X is null then c.CENTER_X else b.CENTER_X end) as centerX,
  280. (case when b.CENTER_Y is null then c.CENTER_Y else b.CENTER_Y end) as centerY,
  281. (case when b.location is null then c.location else b.location end) as location,ia.pnm groupName,ria.pnm
  282. riverName,ad.ad_full_name from BIS_INSP_ALL_OBJ A join ATT_JSKEJIAN_ECOFRD_RGSTR B on A.Obj_Id
  283. = B.Obj_Id left join ATT_JSKEJIAN_ECOFRD_BASE c on a.code = c.id
  284. 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
  285. left join BIS_INSP_ALL ria on substr(A.ID,0,6) = ria.id
  286. where 1 = 1
  287. <if test="tabType =='2'.toString()">
  288. and ria.entm &lt;to_date(#{nowTime},'yyyy-MM-dd')+1
  289. </if>
  290. <if test="tabType =='1'.toString()">
  291. and ria.entm &gt;=to_date(#{nowTime},'yyyy-MM-dd')
  292. </if>
  293. <include refid="choseSql"/>
  294. <if test="adName != null and adName != ''">and ad.AD_FULL_NAME LIKE '%${adName}%'</if>
  295. <if test="groupId != null and groupId != ''">and A.id = #{groupId}</if>
  296. <if test="adCode != null and adCode !=''">and B.AD_CODE like '${adCode}%'</if>
  297. <if test="orgId != null and orgId !=''">and A.org_id =#{orgId}</if>
  298. <if test="plnaId !=null and plnaId !=''">
  299. and A.id like '${plnaId}%'
  300. </if>
  301. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  302. AND B.INTM &gt;= TO_DATE(#{sttm},'YYYY-MM-DD') AND B.UPTM &lt; TO_DATE(#{entm},'YYYY-MM-DD')+1
  303. </if>
  304. and
  305. REGEXP_LIKE(
  306. A.Id,'^('||
  307. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  308. <include refid="orgIdSql"/>
  309. )>0 then
  310. (SELECT LISTAGG(id, '|') as
  311. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persId}
  312. <include refid="orgIdSql"/> GROUP BY PERSID
  313. )
  314. else (select 'non' from dual) end)
  315. ||')')
  316. ) where 1 = 1
  317. <if test="state != null and state != ''">
  318. and state in (${state})
  319. </if>
  320. <if test="name != null and name != ''">
  321. and name like '%${name}%'
  322. </if>
  323. </select>
  324. <select id="getListEcofrdByInspGroupIdObjType" resultType="cn.com.goldenwater.dcproj.model.AttJskejianEcofrdRgstr" parameterType="cn.com.goldenwater.dcproj.param.PagePersObjParam">
  325. select t.*,C.id groupId,C.PNM groupName,B.obj_id
  326. from ATT_JSKEJIAN_ECOFRD_BASE t
  327. left join BIS_INSP_ALL_OBJ B
  328. on B.CODE = t.ID
  329. LEFT JOIN BIS_INSP_ALL C ON B.ID = C.ID
  330. and B.ptype = #{objType}
  331. where 1 = 1
  332. <if test="wtdstNm !=null and wtdstNm !=''">
  333. and b.nm like '%${wtdstNm}%'
  334. </if>
  335. <if test='isAll == "0"'>and B.ID = #{inspGroupId}</if>
  336. <if test='isAll == "1"'>and B.ID LIKE '${inspGroupId}%'</if>
  337. <if test="adCode != null and adCode != ''">
  338. and t.AD_CODE like '${adCode}%'
  339. </if>
  340. <choose>
  341. <when test="province != null and province != ''">
  342. and B.AD_CODE LIKE '${province}%'
  343. </when>
  344. <otherwise>
  345. and B.AD_CODE is null
  346. </otherwise>
  347. </choose>
  348. </select>
  349. <sql id="choseSql">
  350. <choose>
  351. <when test="province !=null and province !=''">
  352. and A.AD_Code like '${province}%'
  353. </when>
  354. <otherwise>
  355. and A.AD_CODE is null
  356. </otherwise>
  357. </choose>
  358. </sql>
  359. </mapper>