AttJskejianFlkdisRgstrDao.xml 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369
  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.AttJskejianFlkdisRgstrDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.AttJskejianFlkdisRgstr" id="attJskejianFlkdisRgstrResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="objId" column="OBJ_ID"/>
  7. <result property="name" column="NAME"/>
  8. <result property="rvReaLkName" column="RV_REA_LK_NAME"/>
  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="contRvonNameDuty" column="CONT_RVON_NAME_DUTY"/>
  17. <result property="townRvonNameDuty" column="TOWN_RVON_NAME_DUTY"/>
  18. <result property="vilgRvonNameDuty" column="VILG_RVON_NAME_DUTY"/>
  19. <result property="pblmType" column="PBLM_TYPE"/>
  20. <result property="pblmDesc" column="PBLM_DESC"/>
  21. <result property="rectConc" column="RECT_CONC"/>
  22. <result property="reviConc" column="REVI_CONC"/>
  23. <result property="reviOpin" column="REVI_OPIN"/>
  24. <result property="persId" column="PERS_ID"/>
  25. <result property="intm" column="INTM"/>
  26. <result property="uptm" column="UPTM"/>
  27. <result property="state" column="STATE"/>
  28. <result property="groupId" column="GROUP_ID"/>
  29. <result property="province" column="PROVINCE"/>
  30. </resultMap>
  31. <sql id="table_columns">
  32. ID,
  33. OBJ_ID,
  34. NAME,
  35. RV_REA_LK_NAME,
  36. AD_CODE,
  37. AD_NAME,
  38. LOCATION,
  39. CENTER_X,
  40. CENTER_Y,
  41. GD_X,
  42. GD_Y,
  43. CONT_RVON_NAME_DUTY,
  44. TOWN_RVON_NAME_DUTY,
  45. VILG_RVON_NAME_DUTY,
  46. PBLM_TYPE,
  47. PBLM_DESC,
  48. RECT_CONC,
  49. REVI_CONC,
  50. REVI_OPIN,
  51. PERS_ID,
  52. INTM,
  53. UPTM,
  54. STATE,
  55. GROUP_ID,
  56. PROVINCE
  57. </sql>
  58. <sql id="entity_properties">
  59. #{id},
  60. #{objId},
  61. #{name},
  62. #{rvReaLkName},
  63. #{adCode},
  64. #{adName},
  65. #{location},
  66. #{centerX},
  67. #{centerY},
  68. #{gdX},
  69. #{gdY},
  70. #{contRvonNameDuty},
  71. #{townRvonNameDuty},
  72. #{vilgRvonNameDuty},
  73. #{pblmType},
  74. #{pblmDesc},
  75. #{rectConc},
  76. #{reviConc},
  77. #{reviOpin},
  78. #{persId},
  79. #{intm},
  80. #{uptm},
  81. #{state},
  82. #{groupId},
  83. #{province}
  84. </sql>
  85. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  86. <sql id="page_where">
  87. <trim prefix="where" prefixOverrides="and | or ">
  88. <if test="objId != null and objId != ''">and OBJ_ID = #{objId}</if>
  89. <if test="name != null and name != ''">and NAME = #{name}</if>
  90. <if test="rvReaLkName != null and rvReaLkName != ''">and RV_REA_LK_NAME = #{rvReaLkName}</if>
  91. <if test="adCode != null and adCode != ''">and AD_CODE like '${adCode}%'</if>
  92. <if test="adName != null and adName != ''">and AD_NAME = #{adName}</if>
  93. <if test="location != null and location != ''">and LOCATION = #{location}</if>
  94. <if test="centerX != null and centerX != ''">and CENTER_X = #{centerX}</if>
  95. <if test="centerY != null and centerY != ''">and CENTER_Y = #{centerY}</if>
  96. <if test="gdX != null and gdX != ''">and GD_X = #{gdX}</if>
  97. <if test="gdY != null and gdY != ''">and GD_Y = #{gdY}</if>
  98. <if test="contRvonNameDuty != null and contRvonNameDuty != ''">and CONT_RVON_NAME_DUTY =
  99. #{contRvonNameDuty}
  100. </if>
  101. <if test="townRvonNameDuty != null and townRvonNameDuty != ''">and TOWN_RVON_NAME_DUTY =
  102. #{townRvonNameDuty}
  103. </if>
  104. <if test="vilgRvonNameDuty != null and vilgRvonNameDuty != ''">and VILG_RVON_NAME_DUTY =
  105. #{vilgRvonNameDuty}
  106. </if>
  107. <if test="pblmType != null and pblmType != ''">and PBLM_TYPE = #{pblmType}</if>
  108. <if test="pblmDesc != null and pblmDesc != ''">and PBLM_DESC = #{pblmDesc}</if>
  109. <if test="rectConc != null and rectConc != ''">and RECT_CONC = #{rectConc}</if>
  110. <if test="reviConc != null and reviConc != ''">and REVI_CONC = #{reviConc}</if>
  111. <if test="reviOpin != null and reviOpin != ''">and REVI_OPIN = #{reviOpin}</if>
  112. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  113. <if test="intm != null">and INTM = #{intm}</if>
  114. <if test="uptm != null">and UPTM = #{uptm}</if>
  115. <if test="state != null and state != ''">and STATE = #{state}</if>
  116. <if test="groupId != null and groupId != ''">and GROUP_ID = #{groupId}</if>
  117. <if test="province != null and province != ''">and PROVINCE like '%${province}%'</if>
  118. </trim>
  119. </sql>
  120. <select id="get" resultMap="attJskejianFlkdisRgstrResultMap" parameterType="String">
  121. select
  122. <include refid="table_columns"/>
  123. from ATT_JSKEJIAN_FLKDIS_RGSTR where ID = #{id}
  124. </select>
  125. <select id="getBy" resultMap="attJskejianFlkdisRgstrResultMap">
  126. select
  127. <include refid="table_columns"/>
  128. from ATT_JSKEJIAN_FLKDIS_RGSTR
  129. <include refid="page_where"/>
  130. </select>
  131. <select id="findAll" resultMap="attJskejianFlkdisRgstrResultMap">
  132. select
  133. <include refid="table_columns"/>
  134. from ATT_JSKEJIAN_FLKDIS_RGSTR
  135. </select>
  136. <select id="findList" resultMap="attJskejianFlkdisRgstrResultMap">
  137. select
  138. <include refid="table_columns"/>
  139. from ATT_JSKEJIAN_FLKDIS_RGSTR
  140. <include refid="page_where"/>
  141. </select>
  142. <select id="selectCount" resultType="int">
  143. select count(ID) from ATT_JSKEJIAN_FLKDIS_RGSTR
  144. <include refid="page_where"/>
  145. </select>
  146. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.AttJskejianFlkdisRgstr">
  147. insert into ATT_JSKEJIAN_FLKDIS_RGSTR(
  148. <include refid="table_columns"/>
  149. )
  150. values (
  151. <include refid="entity_properties"/>
  152. )
  153. </insert>
  154. <delete id="delete" parameterType="java.lang.String">
  155. delete from ATT_JSKEJIAN_FLKDIS_RGSTR where ID = #{id}
  156. </delete>
  157. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.AttJskejianFlkdisRgstr">
  158. delete from ATT_JSKEJIAN_FLKDIS_RGSTR
  159. <include refid="page_where"/>
  160. </delete>
  161. <update id="deleteInFlag" parameterType="java.lang.String">
  162. update ATT_JSKEJIAN_FLKDIS_RGSTR set flag_valid = 0 where ID = #{id}
  163. </update>
  164. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.AttJskejianFlkdisRgstr">
  165. update ATT_JSKEJIAN_FLKDIS_RGSTR
  166. <trim prefix="set" suffixOverrides=",">
  167. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  168. <if test="name != null and name != ''">NAME = #{name},</if>
  169. <if test="rvReaLkName != null and rvReaLkName != ''">RV_REA_LK_NAME = #{rvReaLkName},</if>
  170. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  171. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  172. <if test="location != null and location != ''">LOCATION = #{location},</if>
  173. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  174. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  175. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  176. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  177. <if test="contRvonNameDuty != null and contRvonNameDuty != ''">CONT_RVON_NAME_DUTY = #{contRvonNameDuty},
  178. </if>
  179. <if test="townRvonNameDuty != null and townRvonNameDuty != ''">TOWN_RVON_NAME_DUTY = #{townRvonNameDuty},
  180. </if>
  181. <if test="vilgRvonNameDuty != null and vilgRvonNameDuty != ''">VILG_RVON_NAME_DUTY = #{vilgRvonNameDuty},
  182. </if>
  183. <if test="pblmType != null and pblmType != ''">PBLM_TYPE = #{pblmType},</if>
  184. <if test="pblmDesc != null and pblmDesc != ''">PBLM_DESC = #{pblmDesc},</if>
  185. <if test="rectConc != null and rectConc != ''">RECT_CONC = #{rectConc},</if>
  186. <if test="reviConc != null and reviConc != ''">REVI_CONC = #{reviConc},</if>
  187. <if test="reviOpin != null and reviOpin != ''">REVI_OPIN = #{reviOpin},</if>
  188. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  189. <if test="intm != null">INTM = #{intm},</if>
  190. <if test="uptm != null">UPTM = #{uptm},</if>
  191. <if test="state != null and state != ''">STATE = #{state},</if>
  192. <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
  193. <if test="province != null and province != ''">PROVINCE = #{province},</if>
  194. </trim>
  195. <where>ID = #{id}</where>
  196. </update>
  197. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.AttJskejianFlkdisRgstr">
  198. update ATT_JSKEJIAN_FLKDIS_RGSTR
  199. <trim prefix="set" suffixOverrides=",">
  200. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  201. <if test="name != null and name != ''">NAME = #{name},</if>
  202. <if test="rvReaLkName != null and rvReaLkName != ''">RV_REA_LK_NAME = #{rvReaLkName},</if>
  203. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  204. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  205. <if test="location != null and location != ''">LOCATION = #{location},</if>
  206. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  207. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  208. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  209. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  210. <if test="contRvonNameDuty != null and contRvonNameDuty != ''">CONT_RVON_NAME_DUTY = #{contRvonNameDuty},
  211. </if>
  212. <if test="townRvonNameDuty != null and townRvonNameDuty != ''">TOWN_RVON_NAME_DUTY = #{townRvonNameDuty},
  213. </if>
  214. <if test="vilgRvonNameDuty != null and vilgRvonNameDuty != ''">VILG_RVON_NAME_DUTY = #{vilgRvonNameDuty},
  215. </if>
  216. <if test="pblmType != null and pblmType != ''">PBLM_TYPE = #{pblmType},</if>
  217. <if test="pblmDesc != null and pblmDesc != ''">PBLM_DESC = #{pblmDesc},</if>
  218. <if test="rectConc != null and rectConc != ''">RECT_CONC = #{rectConc},</if>
  219. <if test="reviConc != null and reviConc != ''">REVI_CONC = #{reviConc},</if>
  220. <if test="reviOpin != null and reviOpin != ''">REVI_OPIN = #{reviOpin},</if>
  221. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  222. <if test="intm != null">INTM = #{intm},</if>
  223. <if test="uptm != null">UPTM = #{uptm},</if>
  224. <if test="state != null and state != ''">STATE = #{state},</if>
  225. <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
  226. <if test="province != null and province != ''">PROVINCE = #{province},</if>
  227. </trim>
  228. <include refid="page_where"/>
  229. </update>
  230. <!-- 其他自定义SQL -->
  231. <select id="getListJSFLByInspGroupIdObjType" parameterType="cn.com.goldenwater.dcproj.param.PagePersObjParam"
  232. resultType="cn.com.goldenwater.dcproj.model.AttJskejianFlkdisRgstr">
  233. select t.*,C.id groupId,C.PNM groupName,B.obj_id
  234. from ATT_JSKEJIAN_FLKDIS_BASE t
  235. left join BIS_INSP_ALL_OBJ B
  236. on B.CODE = t.ID
  237. LEFT JOIN BIS_INSP_ALL C ON B.ID = C.ID
  238. and B.ptype = #{objType}
  239. where 1 = 1
  240. <if test="wtdstNm !=null and wtdstNm !=''">
  241. and b.nm like '%${wtdstNm}%'
  242. </if>
  243. <if test='null !=isAll and isAll.toString() == "0"'>and B.ID = #{inspGroupId}</if>
  244. <if test='null !=isAll and isAll.toString() == "1"'>and B.ID LIKE '${inspGroupId}%'</if>
  245. <if test="adCode != null and adCode != ''">
  246. and t.AD_CODE like '${adCode}%'
  247. </if>
  248. <choose>
  249. <when test="province != null and province != ''">
  250. and B.AD_CODE LIKE '${province}%'
  251. </when>
  252. <otherwise>
  253. and B.AD_CODE is null
  254. </otherwise>
  255. </choose>
  256. </select>
  257. <sql id="choseSql">
  258. <choose>
  259. <when test="province !=null and province !=''">
  260. and A.AD_Code like '${province}%'
  261. </when>
  262. <otherwise>
  263. and A.AD_CODE is null
  264. </otherwise>
  265. </choose>
  266. </sql>
  267. <select id="findJsflPage" parameterType="cn.com.goldenwater.dcproj.param.TypeParam"
  268. resultType="cn.com.goldenwater.dcproj.dto.BisInspRgstrDto">
  269. select w.* from (
  270. select
  271. A.*,
  272. b.id as rgstrId,
  273. CASE WHEN B.STATE IS NULL THEN '0' ELSE B.STATE END AS state,
  274. (case when b.name is null then cast(c.name as char) else b.name end) as name,
  275. (case when b.pblm_type='1' then '乱占'
  276. when b.pblm_type='2' then '乱采'
  277. when b.pblm_type='3' then '乱堆'
  278. when b.pblm_type='4' then '乱建'
  279. when b.pblm_type='5' then '其他' end
  280. ) as type,
  281. b.intm as IN_TM, b.uptm as Up_tm,b.pblm_desc,
  282. (case when b.rect_conc='1' then '已销号' when b.rect_conc='2' then '未销号' else '' end) as rect_conc,
  283. c.id as baseId,
  284. (case when b.CENTER_X is null then c.CENTER_X else b.CENTER_X end) as centerX,
  285. (case when b.CENTER_Y is null then c.CENTER_Y else b.CENTER_Y end) as centerY,
  286. (case when b.location is null then c.location else b.location end) as location,ia.pnm groupName,ria.pnm
  287. riverName,ad.ad_full_name as ad_name
  288. from BIS_INSP_ALL_OBJ A join ATT_JSKEJIAN_FLKDIS_RGSTR B on A.Obj_Id = B.Obj_Id
  289. left join ATT_JSKEJIAN_FLKDIS_BASE c on a.code = c.id
  290. 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
  291. left join BIS_INSP_ALL ria on substr(A.ID,1,6) = ria.id
  292. where 1 = 1
  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="plnaId !=null and plnaId !=''">
  298. and A.id like '${plnaId}%'
  299. </if>
  300. <if test="orgId != null and orgId !=''">and A.org_id = #{orgId}</if>
  301. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  302. AND B.INTM &gt;= STR_TO_DATE(#{sttm},'%Y-%m-%d') AND B.UPTM &lt; DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d'),INTERVAL 1 DAY)
  303. </if>
  304. and
  305. A.id in (${inIdsSql})
  306. ) w where 1 = 1
  307. <if test="state != null and state != ''">
  308. and w.state in (${state})
  309. </if>
  310. <if test="name != null and name != ''">
  311. and w.name like '%${name}%'
  312. </if>
  313. </select>
  314. <select id="findPcJsflPage" resultType="cn.com.goldenwater.dcproj.dto.AttJskejianFlkdisRgstrDto"
  315. parameterType="cn.com.goldenwater.dcproj.param.AttJskejianFlkdisRgstrParam">
  316. select w.* from (
  317. select
  318. A.*,
  319. b.id as rgstrId, b.name, b.pblm_type, b.pblm_desc,b.intm,b.uptm,b.location,b.CENTER_X,b.CENTER_Y,
  320. CASE WHEN B.STATE IS NULL THEN '0' ELSE B.STATE END AS state, c.id as baseId,
  321. CASE WHEN B.RECT_CONC='1' THEN '已销号' WHEN B.RECT_CONC='2' THEN '未销号' ELSE '' END AS rect_conc,
  322. ia.pnm groupName,ria.pnm riverName, ad.ad_full_name
  323. FROM BIS_INSP_ALL_OBJ A
  324. JOIN ATT_JSKEJIAN_FLKDIS_RGSTR B ON A.OBJ_ID = B.OBJ_ID
  325. LEFT JOIN ATT_JSKEJIAN_FLKDIS_BASE C ON A.CODE = C.ID
  326. LEFT JOIN ATT_AD_X_BASE AD ON B.AD_CODE = AD.AD_CODE
  327. LEFT JOIN BIS_INSP_ALL IA ON A.ID = IA.ID
  328. LEFT JOIN BIS_INSP_ALL RIA ON SUBSTR(A.ID,1,6) = RIA.ID
  329. <where>
  330. <include refid="choseSql"/>
  331. <if test="adCode != null and adCode !=''">and B.AD_CODE like '${adCode}%'</if>
  332. <if test="adName != null and adName != ''">and ad.AD_FULL_NAME LIKE '%${adName}%'</if>
  333. <if test="plnaId !=null and plnaId !=''">and A.id like '${plnaId}%'</if>
  334. <if test="groupId != null and groupId != ''">and A.id = #{groupId}</if>
  335. <if test="orgId != null and orgId !=''">and A.org_id =#{orgId}</if>
  336. <if test="sttm != null and sttm != '' and entm != null and entm != ''">
  337. AND B.INTM &gt;= STR_TO_DATE(#{sttm},'%Y-%m-%d') AND B.UPTM &lt; DATE_ADD(STR_TO_DATE(#{entm},'%Y-%m-%d'),INTERVAL 1 DAY)
  338. </if>
  339. <if test="tabType =='2'.toString()">and IA.entm &lt; DATE_ADD(STR_TO_DATE(#{nowTime},'%Y-%m-%d') ,INTERVAL 1 DAY)</if>
  340. <if test="tabType =='1'.toString()">and IA.entm &gt;= STR_TO_DATE(#{nowTime},'%Y-%m-%d')</if>
  341. </where>
  342. ) w
  343. <where>
  344. <if test="state != null and state != ''">and w.state in (${state})</if>
  345. <if test="name != null and name != ''">and w.name like '%${name}%'</if>
  346. </where>
  347. </select>
  348. </mapper>