BisInspRlrwRgstrDao.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304
  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.BisInspRlrwRgstrDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.BisInspRlrwRgstr" id="bisInspRlrwRgstrResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="objId" column="OBJ_ID"/>
  7. <result property="landCode" column="LAND_CODE"/>
  8. <result property="landName" column="LAND_NAME"/>
  9. <result property="landArea" column="LAND_AREA"/>
  10. <result property="adCode" column="AD_CODE"/>
  11. <result property="adName" column="AD_NAME"/>
  12. <result property="contact" column="CONTACT"/>
  13. <result property="contactTel" column="CONTACT_TEL"/>
  14. <result property="centerX" column="CENTER_X"/>
  15. <result property="centerY" column="CENTER_Y"/>
  16. <result property="gdX" column="GD_X"/>
  17. <result property="gdY" column="GD_Y"/>
  18. <result property="curState" column="CUR_STATE"/>
  19. <result property="beoState" column="BEO_STATE"/>
  20. <result property="state" column="STATE"/>
  21. <result property="persId" column="PERS_ID"/>
  22. <result property="intm" column="INTM"/>
  23. <result property="uptm" column="UPTM"/>
  24. <result property="groupId" column="GROUP_ID"/>
  25. <result property="dataStat" column="DATA_STAT"/>
  26. </resultMap>
  27. <sql id="table_columns">
  28. ID,
  29. OBJ_ID,
  30. LAND_CODE,
  31. LAND_NAME,
  32. LAND_AREA,
  33. AD_CODE,
  34. AD_NAME,
  35. CONTACT,
  36. CONTACT_TEL,
  37. CENTER_X,
  38. CENTER_Y,
  39. GD_X,
  40. GD_Y,
  41. CUR_STATE,
  42. BEO_STATE,
  43. STATE,
  44. PERS_ID,
  45. INTM,
  46. UPTM,
  47. GROUP_ID,
  48. DATA_STAT
  49. </sql>
  50. <sql id="entity_properties">
  51. #{id},
  52. #{objId},
  53. #{landCode},
  54. #{landName},
  55. #{landArea},
  56. #{adCode},
  57. #{adName},
  58. #{contact},
  59. #{contactTel},
  60. #{centerX},
  61. #{centerY},
  62. #{gdX},
  63. #{gdY},
  64. #{curState},
  65. #{beoState},
  66. #{state},
  67. #{persId},
  68. #{intm},
  69. #{uptm},
  70. #{groupId},
  71. #{dataStat}
  72. </sql>
  73. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  74. <sql id="page_where">
  75. <trim prefix="where" prefixOverrides="and | or ">
  76. <if test="objId != null and objId != ''">and OBJ_ID = #{objId}</if>
  77. <if test="landCode != null and landCode != ''">and LAND_CODE = #{landCode}</if>
  78. <if test="landName != null and landName != ''">and LAND_NAME = #{landName}</if>
  79. <if test="landArea != null and landArea != ''">and LAND_AREA = #{landArea}</if>
  80. <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
  81. <if test="adName != null and adName != ''">and AD_NAME = #{adName}</if>
  82. <if test="contact != null and contact != ''">and CONTACT = #{contact}</if>
  83. <if test="contactTel != null and contactTel != ''">and CONTACT_TEL = #{contactTel}</if>
  84. <if test="centerX != null and centerX != ''">and CENTER_X = #{centerX}</if>
  85. <if test="centerY != null and centerY != ''">and CENTER_Y = #{centerY}</if>
  86. <if test="gdX != null and gdX != ''">and GD_X = #{gdX}</if>
  87. <if test="gdY != null and gdY != ''">and GD_Y = #{gdY}</if>
  88. <if test="curState != null and curState != ''">and CUR_STATE = #{curState}</if>
  89. <if test="beoState != null and beoState != ''">and BEO_STATE = #{beoState}</if>
  90. <if test="state != null and state != ''">and STATE = #{state}</if>
  91. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  92. <if test="intm != null">and INTM = #{intm}</if>
  93. <if test="uptm != null">and UPTM = #{uptm}</if>
  94. <if test="groupId != null and groupId != ''">and GROUP_ID = #{groupId}</if>
  95. <if test="dataStat != null and dataStat != ''">and DATA_STAT = #{dataStat}</if>
  96. </trim>
  97. </sql>
  98. <select id="get" resultMap="bisInspRlrwRgstrResultMap" parameterType="String" >
  99. select <include refid="table_columns" /> from BIS_INSP_RLRW_RGSTR where ID = #{id}
  100. </select>
  101. <select id="getBy" resultMap="bisInspRlrwRgstrResultMap">
  102. select <include refid="table_columns" /> from BIS_INSP_RLRW_RGSTR <include refid="page_where" />
  103. </select>
  104. <select id="findAll" resultMap="bisInspRlrwRgstrResultMap">
  105. select <include refid="table_columns" /> from BIS_INSP_RLRW_RGSTR
  106. </select>
  107. <select id="findList" resultMap="bisInspRlrwRgstrResultMap">
  108. select <include refid="table_columns" /> from BIS_INSP_RLRW_RGSTR <include refid="page_where" />
  109. </select>
  110. <select id="selectCount" resultType="int" >
  111. select count(ID) from BIS_INSP_RLRW_RGSTR <include refid="page_where" />
  112. </select>
  113. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.BisInspRlrwRgstr">
  114. insert into BIS_INSP_RLRW_RGSTR( <include refid="table_columns" /> )
  115. values ( <include refid="entity_properties" /> )
  116. </insert>
  117. <delete id="delete" parameterType="java.lang.String">
  118. delete from BIS_INSP_RLRW_RGSTR where ID = #{id}
  119. </delete>
  120. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspRlrwRgstr">
  121. delete from BIS_INSP_RLRW_RGSTR <include refid="page_where" />
  122. </delete>
  123. <update id="deleteInFlag" parameterType="java.lang.String">
  124. update BIS_INSP_RLRW_RGSTR set flag_valid = 0 where ID = #{id}
  125. </update>
  126. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.BisInspRlrwRgstr">
  127. update BIS_INSP_RLRW_RGSTR
  128. <trim prefix="set" suffixOverrides=",">
  129. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  130. <if test="landCode != null and landCode != ''">LAND_CODE = #{landCode},</if>
  131. <if test="landName != null and landName != ''">LAND_NAME = #{landName},</if>
  132. <if test="landArea != null and landArea != ''">LAND_AREA = #{landArea},</if>
  133. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  134. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  135. <if test="contact != null and contact != ''">CONTACT = #{contact},</if>
  136. <if test="contactTel != null and contactTel != ''">CONTACT_TEL = #{contactTel},</if>
  137. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  138. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  139. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  140. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  141. <if test="curState != null and curState != ''">CUR_STATE = #{curState},</if>
  142. <if test="beoState != null and beoState != ''">BEO_STATE = #{beoState},</if>
  143. <if test="state != null and state != ''">STATE = #{state},</if>
  144. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  145. <if test="intm != null">INTM = #{intm},</if>
  146. <if test="uptm != null">UPTM = #{uptm},</if>
  147. <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
  148. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  149. </trim>
  150. <where>ID = #{id}</where>
  151. </update>
  152. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.BisInspRlrwRgstr">
  153. update BIS_INSP_RLRW_RGSTR
  154. <trim prefix="set" suffixOverrides=",">
  155. <if test="objId != null and objId != ''">OBJ_ID = #{objId},</if>
  156. <if test="landCode != null and landCode != ''">LAND_CODE = #{landCode},</if>
  157. <if test="landName != null and landName != ''">LAND_NAME = #{landName},</if>
  158. <if test="landArea != null and landArea != ''">LAND_AREA = #{landArea},</if>
  159. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  160. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  161. <if test="contact != null and contact != ''">CONTACT = #{contact},</if>
  162. <if test="contactTel != null and contactTel != ''">CONTACT_TEL = #{contactTel},</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="curState != null and curState != ''">CUR_STATE = #{curState},</if>
  168. <if test="beoState != null and beoState != ''">BEO_STATE = #{beoState},</if>
  169. <if test="state != null and state != ''">STATE = #{state},</if>
  170. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  171. <if test="intm != null">INTM = #{intm},</if>
  172. <if test="uptm != null">UPTM = #{uptm},</if>
  173. <if test="groupId != null and groupId != ''">GROUP_ID = #{groupId},</if>
  174. <if test="dataStat != null and dataStat != ''">DATA_STAT = #{dataStat},</if>
  175. </trim>
  176. <include refid="page_where" />
  177. </update>
  178. <!-- 其他自定义SQL -->
  179. <select id="findPageList" resultType="cn.com.goldenwater.dcproj.dto.BisInspRlrwRgstrDto">
  180. SELECT * FROM (
  181. select
  182. A.CODE, A.ID nodeId, A.NM, A.ptype, A.OBJ_ID,
  183. aw.AD_CODE as baseId, ia.pnm groupName,
  184. B.ID ID, B.id as rgstrId,
  185. (case when b.STATE is null then '0' else b.state end) STATE,
  186. B.AD_CODE, B.AD_NAME, B.LAND_CODE, B.LAND_NAME, B.CONTACT, B.CONTACT_TEL,
  187. B.LAND_AREA, B.CENTER_X, B.CENTER_Y, B.GD_X, B.GD_Y, B.CUR_STATE,B.BEO_STATE,
  188. B.PERS_ID, B.GROUP_ID, B.INTM, B.UPTM, B.DATA_STAT
  189. FROM BIS_INSP_ALL_OBJ A
  190. LEFT JOIN BIS_INSP_RLRW_RGSTR B ON A.OBJ_ID=B.OBJ_ID
  191. LEFT JOIN BIS_INSP_ALL IA ON A.ID = IA.ID
  192. LEFT JOIN ATT_AD_BASE AW ON B.AD_CODE = AW.AD_CODE
  193. where A.ptype= #{pType}
  194. and B.DATA_STAT='0'
  195. <if test="adCodes ==null or adCodes ==''">
  196. <choose>
  197. <when test='isAll =="1"'>
  198. </when>
  199. <otherwise>
  200. and
  201. A.Id in (
  202. select distinct id from (
  203. SELECT P.id FROM BIS_INSP_ALL P START WITH P.PID IN (SELECT id FROM BIS_INSP_ALL_RLATION A
  204. WHERE A.PERSID = #{presId} and TYPE = #{pType} and length(id) in (3,6,9))
  205. CONNECT BY P.PID = PRIOR P.ID
  206. union all
  207. SELECT P.id FROM BIS_INSP_ALL P where p.id in (SELECT id FROM BIS_INSP_ALL_RLATION A
  208. WHERE A.PERSID =#{presId} and TYPE = #{pType} and length(id)=12 )
  209. )
  210. )
  211. </otherwise>
  212. </choose>
  213. </if>
  214. <if test="adCodes !=null and adCodes !=''">
  215. and
  216. <foreach item="item" index="index" collection="adCodes.split(',')" open="(" separator="or" close=")">
  217. b.ad_code like concat('${item}','%')
  218. </foreach>
  219. </if>
  220. ) A WHERE a.PTYPE=#{pType}
  221. <if test="plnaId !=null and plnaId !=''">
  222. and a.nodeId like '${plnaId}%'
  223. </if>
  224. <if test="state !=null and state !=''">
  225. and STATE in (${state})
  226. </if>
  227. <if test="rsName !=null and rsName !=''">
  228. and a.nm like '%${rsName}%'
  229. </if>
  230. <if test="code !=null and code !=''">
  231. and a.code = #{code}
  232. </if>
  233. <if test="adName != null and adName != ''">and a.adName like '%${adName}%'</if>
  234. <if test="sttm != null and sttm != ''">and a.Intm&gt;= TO_DATE(#{sttm},'YYYY-MM-DD')</if>
  235. <if test="entm != null and entm != ''">and a.Intm &lt; To_DATE(#{entm},'yyyy-MM-dd') + 1</if>
  236. <if test="groupId != null and groupId != ''">and a.nodeId = #{groupId}</if>
  237. order by code asc
  238. <if test="orderBy != null and orderBy != ''">
  239. ,nlssort(nm,'NLS_SORT=SCHINESE_PINYIN_M')
  240. </if>
  241. </select>
  242. <select id="getListByInspGroupIdObjType" resultType="cn.com.goldenwater.dcproj.dto.BisInspRlrwRgstrDto"
  243. parameterType="cn.com.goldenwater.dcproj.param.PagePersObjParam">
  244. select t.id,t.id as rgstrId,
  245. (case when t.STATE is null then '0' else t.state end) STATE,
  246. t.LAND_CODE,t.LAND_NAME,t.AD_CODE, t.AD_NAME, t.CONTACT, t.CONTACT_TEL, t.CENTER_X, t.CENTER_Y, t.GD_X, t.GD_Y, t.CUR_STATE,t.BEO_STATE,
  247. t.PERS_ID, t.GROUP_ID, t.INTM, t.UPTM, t.DATA_STAT,C.id groupId,C.PNM groupName,B.obj_id,B.code code
  248. from BIS_INSP_RLRW_RGSTR t
  249. left join BIS_INSP_ALL_OBJ B
  250. on t.OBJ_ID = B.OBJ_ID
  251. LEFT JOIN BIS_INSP_ALL C ON B.ID = C.ID
  252. and B.ptype = #{objType}
  253. where 1 = 1
  254. <if test='isAll == "0"'>and B.ID = #{inspGroupId}</if>
  255. <if test='isAll == "1"'>and B.ID LIKE '${inspGroupId}%'</if>
  256. <if test="adCode != null and adCode != ''">
  257. and t.AD_CODE like '${adCode}%'
  258. </if>
  259. <choose>
  260. <when test="province != null and province != ''">
  261. and B.AD_CODE LIKE '${province}%'
  262. </when>
  263. <otherwise>
  264. and B.AD_CODE is null
  265. </otherwise>
  266. </choose>
  267. </select>
  268. <select id="findRlrwPageInfo" parameterType="cn.com.goldenwater.dcproj.param.BisInspRlrwRgstrParam" resultType="cn.com.goldenwater.dcproj.dto.BisInspRlrwRgstrDto">
  269. select a.ID, a.OBJ_ID, LAND_CODE, LAND_NAME,LAND_AREA, a.AD_CODE, a.AD_NAME,CONTACT,CONTACT_TEL,
  270. CENTER_X, CENTER_Y, GD_X, GD_Y,a.Cur_State,a.Beo_State, STATE,
  271. PERS_ID, a.INTM, UPTM, GROUP_ID, DATA_STAT ,(c.pnm)groupName
  272. from BIS_INSP_RLRW_RGSTR a left join bis_insp_all_obj b left join bis_insp_all c on b.id = c.id
  273. on a.obj_id=b.obj_id
  274. where 1=1
  275. <if test="plnaId != null and plnaId != ''">and b.id=#{plnaId}</if>
  276. <if test="state != null and state != ''">and a.state=#{state}</if>
  277. <if test="adName != null and adName != ''">and a.AD_NAME like '%${adName}%'</if>
  278. <if test="sttm != null and sttm != ''">and a.Intm&gt;= TO_DATE(#{sttm},'YYYY-MM-DD')</if>
  279. <if test="entm != null and entm != ''">and a.Intm &lt; To_DATE(#{entm},'yyyy-MM-dd') + 1</if>
  280. </select>
  281. </mapper>