1dd7e024ddb7e454f9879b54f3d68e6ad1174afa.svn-base 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323
  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.AttFscBaseDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.AttFscBase" id="attFscBaseResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="code" column="CODE"/>
  7. <result property="name" column="NAME"/>
  8. <result property="type" column="TYPE"/>
  9. <result property="admOrg" column="ADM_ORG"/>
  10. <result property="adCode" column="AD_CODE"/>
  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="persId" column="PERS_ID"/>
  17. <result property="intm" column="INTM"/>
  18. <result property="uptm" column="UPTM"/>
  19. </resultMap>
  20. <sql id="table_columns">
  21. ID,
  22. CODE,
  23. NAME,
  24. TYPE,
  25. ADM_ORG,
  26. AD_CODE,
  27. LOCATION,
  28. CENTER_X,
  29. CENTER_Y,
  30. GD_X,
  31. GD_Y,
  32. PERS_ID,
  33. INTM,
  34. UPTM
  35. </sql>
  36. <sql id="entity_properties">
  37. #{id},
  38. #{code},
  39. #{name},
  40. #{type},
  41. #{admOrg},
  42. #{adCode},
  43. #{location},
  44. #{centerX},
  45. #{centerY},
  46. #{gdX},
  47. #{gdY},
  48. #{persId},
  49. #{intm},
  50. #{uptm}
  51. </sql>
  52. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  53. <sql id="page_where">
  54. <trim prefix="where" prefixOverrides="and | or ">
  55. <if test="code != null and code != ''">and CODE = #{code}</if>
  56. <if test="name != null and name != ''">and NAME = #{name}</if>
  57. <if test="type != null and type != ''">and TYPE = #{type}</if>
  58. <if test="admOrg != null and admOrg != ''">and ADM_ORG = #{admOrg}</if>
  59. <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
  60. <if test="location != null and location != ''">and LOCATION = #{location}</if>
  61. <if test="centerX != null and centerX != ''">and CENTER_X = #{centerX}</if>
  62. <if test="centerY != null and centerY != ''">and CENTER_Y = #{centerY}</if>
  63. <if test="gdX != null and gdX != ''">and GD_X = #{gdX}</if>
  64. <if test="gdY != null and gdY != ''">and GD_Y = #{gdY}</if>
  65. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  66. <if test="intm != null">and INTM = #{intm}</if>
  67. <if test="uptm != null">and UPTM = #{uptm}</if>
  68. </trim>
  69. </sql>
  70. <select id="get" resultMap="attFscBaseResultMap" parameterType="String">
  71. select
  72. <include refid="table_columns"/>
  73. from ATT_FSC_BASE where ID = #{id}
  74. </select>
  75. <select id="getBy" resultMap="attFscBaseResultMap">
  76. select
  77. <include refid="table_columns"/>
  78. from ATT_FSC_BASE
  79. <include refid="page_where"/>
  80. </select>
  81. <select id="findAll" resultMap="attFscBaseResultMap">
  82. select
  83. <include refid="table_columns"/>
  84. from ATT_FSC_BASE
  85. </select>
  86. <select id="findList" resultMap="attFscBaseResultMap">
  87. select
  88. <include refid="table_columns"/>
  89. from ATT_FSC_BASE
  90. <include refid="page_where"/>
  91. </select>
  92. <select id="selectCount" resultType="int">
  93. select count(ID) from ATT_FSC_BASE
  94. <include refid="page_where"/>
  95. </select>
  96. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.AttFscBase">
  97. insert into ATT_FSC_BASE(
  98. <include refid="table_columns"/>
  99. )
  100. values (
  101. <include refid="entity_properties"/>
  102. )
  103. </insert>
  104. <delete id="delete" parameterType="java.lang.String">
  105. delete from ATT_FSC_BASE where ID = #{id}
  106. </delete>
  107. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.AttFscBase">
  108. delete from ATT_FSC_BASE
  109. <include refid="page_where"/>
  110. </delete>
  111. <update id="deleteInFlag" parameterType="java.lang.String">
  112. update ATT_FSC_BASE set flag_valid = 0 where ID = #{id}
  113. </update>
  114. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.AttFscBase">
  115. update ATT_FSC_BASE
  116. <trim prefix="set" suffixOverrides=",">
  117. <if test="code != null and code != ''">CODE = #{code},</if>
  118. <if test="name != null and name != ''">NAME = #{name},</if>
  119. <if test="type != null and type != ''">TYPE = #{type},</if>
  120. <if test="admOrg != null and admOrg != ''">ADM_ORG = #{admOrg},</if>
  121. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  122. <if test="location != null and location != ''">LOCATION = #{location},</if>
  123. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  124. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  125. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  126. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  127. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  128. <if test="intm != null">INTM = #{intm},</if>
  129. <if test="uptm != null">UPTM = #{uptm},</if>
  130. </trim>
  131. <where>ID = #{id}</where>
  132. </update>
  133. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.AttFscBase">
  134. update ATT_FSC_BASE
  135. <trim prefix="set" suffixOverrides=",">
  136. <if test="code != null and code != ''">CODE = #{code},</if>
  137. <if test="name != null and name != ''">NAME = #{name},</if>
  138. <if test="type != null and type != ''">TYPE = #{type},</if>
  139. <if test="admOrg != null and admOrg != ''">ADM_ORG = #{admOrg},</if>
  140. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  141. <if test="location != null and location != ''">LOCATION = #{location},</if>
  142. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  143. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  144. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  145. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  146. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  147. <if test="intm != null">INTM = #{intm},</if>
  148. <if test="uptm != null">UPTM = #{uptm},</if>
  149. </trim>
  150. <include refid="page_where"/>
  151. </update>
  152. <sql id="orgIdSql">
  153. <choose>
  154. <when test="orgId !=null and orgId !=''">
  155. and ORG_ID=#{orgId}
  156. </when>
  157. <otherwise>
  158. and ORG_ID is null
  159. </otherwise>
  160. </choose>
  161. </sql>
  162. <select id="getObjByPersId" resultType="cn.com.goldenwater.dcproj.model.AttFscBase" parameterType="cn.com.goldenwater.dcproj.param.PersObjParam">
  163. SELECT A.* ,B.OBJ_ID,B.ID groupId,C.ID rgstrId FROM ATT_FSC_BASE A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.id = B.CODE
  164. LEFT JOIN BIS_INSP_FSC_RGSTR C ON B.OBJ_ID = C.OBJ_ID
  165. WHERE B.PTYPE = #{objType} AND
  166. REGEXP_LIKE(
  167. B.Id,'^('||
  168. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persGuid} and id like '009%'
  169. <include refid="orgIdSql"/>
  170. )>0 then
  171. (SELECT LISTAGG(id, '|') WITHIN GROUP(ORDER BY PERSID) as
  172. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persGuid} and id like '009%'
  173. <include refid="orgIdSql"/>
  174. )
  175. else (select 'non' from dual) end)
  176. ||')')
  177. <choose>
  178. <when test="province !=null and province !=''">
  179. and B.AD_CODE =#{province}
  180. </when>
  181. <otherwise>
  182. and B.AD_CODE is null
  183. </otherwise>
  184. </choose>
  185. <if test="adName != null and adName != ''">and A.NAME LIKE '%${adName}%'</if>
  186. <if test="adCode != null and adCode != ''">and A.AD_CODE LIKE '${adCode}%'</if>
  187. </select>
  188. <!-- 其他自定义SQL -->
  189. <select id="getBasePageInfoNotInFsc" parameterType="cn.com.goldenwater.dcproj.param.AttFscBaseParam"
  190. resultType="cn.com.goldenwater.dcproj.model.AttFscBase">
  191. select f.code,
  192. f.name,
  193. f.ad_code,
  194. f.location,
  195. f.center_x,
  196. f.center_y,
  197. f.gd_x,
  198. f.gd_y,
  199. f.type from (
  200. select to_char(rs.rs_code) as code,to_char(rs.rs_name) as name,to_char(rs.adm_div) as
  201. ad_Code,to_char(rs.rs_adm_name) as location,rs.center_x as center_X,rs.center_y as center_y,
  202. rs.center_x_gd as GD_X ,rs.center_y_gd as GD_Y, '1' as type from ATT_RS_BASE rs
  203. union all
  204. select t.obj_code as code,t.gate_name as name,t.ad_code as ad_code,t.location_cun as location, t.center_x as
  205. center_X,t.center_y as center_y,
  206. t.gd_x as GD_X,t.GD_Y as GD_Y,'2' as type from ATT_WAGA_BASE t
  207. union all
  208. select t.cws_code as code,t.cws_name as name ,t.addvcd as ad_code,t.cws_loc as location,t.cws_long as
  209. center_x,t.cws_lat as center_y,
  210. t.center_x_gd as GD_X ,t.center_y_gd as GD_Y,'3' as type from ATT_CWS_BASE t
  211. union all
  212. select t.id as code,t.nm as name,t.ad_code as ad_code,'' as location,t.lgtd as center_x,t.lttd as center_y,
  213. t.lgtd_pc as gd_x ,t.lttd_pc as gd_y,'4' as type from ATT_EMPWTPRJ_BASE t where t.eng_sta = '2'
  214. union all
  215. select t.id as code,t.nm as name,t.ad_code as ad_code,'' as location,t.lgtd as center_x,t.lttd as center_y,
  216. t.lgtd_pc as gd_x ,t.lttd_pc as gd_y,'4' as type from ATT_EMPWTPRJ_BASE t where t.eng_sta = '1'
  217. ) f
  218. where 1=1
  219. <if test="type != null and type != ''">
  220. and f.type = #{type}
  221. </if>
  222. <if test="province !=null and province !=''">
  223. AND f.ad_code like '${province}%'
  224. </if>
  225. <if test="name != null and name != ''">
  226. AND f.name like '%${name}%'
  227. </if>
  228. <if test="adCode != null and adCode != ''">
  229. AND f.ad_Code like '${adCode}%'
  230. </if>
  231. AND f.code not in (select code from att_fsc_base t where t.code is not null)
  232. </select>
  233. <update id="updateFscBase" parameterType="cn.com.goldenwater.dcproj.model.AttFscBase" >
  234. update ATT_FSC_BASE
  235. <trim prefix="set" suffixOverrides=",">
  236. CODE = #{code},
  237. <if test="name != null and name != ''">NAME = #{name},</if>
  238. <if test="type != null and type != ''">TYPE = #{type},</if>
  239. ADM_ORG = #{admOrg},
  240. AD_CODE = #{adCode},
  241. LOCATION = #{location},
  242. CENTER_X = #{centerX},
  243. CENTER_Y = #{centerY},
  244. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  245. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  246. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  247. <if test="intm != null">INTM = #{intm},</if>
  248. <if test="uptm != null">UPTM = #{uptm},</if>
  249. </trim>
  250. <where>ID = #{id}</where>
  251. </update>
  252. <select id="findListBy" parameterType="cn.com.goldenwater.dcproj.param.PersObjParam" resultType="cn.com.goldenwater.dcproj.model.AttFscBase">
  253. select
  254. A.ID,
  255. A.CODE,
  256. A.NAME,
  257. A.TYPE,
  258. A.ADM_ORG,
  259. A.AD_CODE,
  260. A.LOCATION,
  261. A.CENTER_X,
  262. A.CENTER_Y,
  263. A.GD_X,
  264. A.GD_Y,
  265. A.PERS_ID,
  266. A.INTM,
  267. A.UPTM
  268. from ATT_FSC_BASE A
  269. where 1=1
  270. <if test="adName != null and adName != ''">and A.name LIKE '%${adName}%'</if>
  271. <if test="adCode != null and adCode != ''">and A.AD_CODE LIKE '${adCode}%'</if>
  272. <if test="maxLgtd != null and maxLgtd != '' and minLgtd != null and minLgtd != ''">and A.CENTER_X BETWEEN
  273. #{minLgtd} AND #{maxLgtd}
  274. </if>
  275. <if test="maxLttd != null and maxLttd != '' and minLttd != null and minLttd != ''">and A.CENTER_Y BETWEEN
  276. #{minLttd} AND #{maxLttd}
  277. </if>
  278. </select>
  279. <select id="getObjListNotInspGroupId" resultType="cn.com.goldenwater.dcproj.model.AttWagaBase" parameterType="String">
  280. select t.*
  281. from ATT_FSC_BASE t
  282. where t.id not in (
  283. select CODE from BIS_INSP_ALL_OBJ B where id like concat(#{inspGroupId},'%') and B.obj_type=#{objType}
  284. <choose>
  285. <when test="province !=null and province !=''">
  286. and B.AD_CODE =#{province}
  287. </when>
  288. <otherwise>
  289. and B.AD_CODE is null
  290. </otherwise>
  291. </choose>
  292. )
  293. <if test="adName != null and adName != ''">and t.nm LIKE '%${adName}%'</if>
  294. <if test="adCode != null and adCode != ''">and t.AD_CODE LIKE '${adCode}%'</if>
  295. </select>
  296. </mapper>