AttFscBaseDao.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313
  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. B.id in (${inIdsSql})
  167. <choose>
  168. <when test="province !=null and province !=''">
  169. and B.AD_CODE =#{province}
  170. </when>
  171. <otherwise>
  172. and B.AD_CODE is null
  173. </otherwise>
  174. </choose>
  175. <if test="adName != null and adName != ''">and A.NAME LIKE '%${adName}%'</if>
  176. <if test="adCode != null and adCode != ''">and A.AD_CODE LIKE '${adCode}%'</if>
  177. </select>
  178. <!-- 其他自定义SQL -->
  179. <select id="getBasePageInfoNotInFsc" parameterType="cn.com.goldenwater.dcproj.param.AttFscBaseParam"
  180. resultType="cn.com.goldenwater.dcproj.model.AttFscBase">
  181. select f.code,
  182. f.name,
  183. f.ad_code,
  184. f.location,
  185. f.center_x,
  186. f.center_y,
  187. f.gd_x,
  188. f.gd_y,
  189. f.type from (
  190. select cast(rs.rs_code as CHAR) as code,rs.rs_name as name,rs.adm_div as
  191. ad_Code,rs.rs_adm_name as location,rs.center_x as center_X,rs.center_y as center_y,
  192. rs.center_x_gd as GD_X ,rs.center_y_gd as GD_Y, '1' as type from ATT_RS_BASE rs
  193. union all
  194. 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
  195. center_X,t.center_y as center_y,
  196. t.gd_x as GD_X,t.GD_Y as GD_Y,'2' as type from ATT_WAGA_BASE t
  197. union all
  198. 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
  199. center_x,t.cws_lat as center_y,
  200. t.center_x_gd as GD_X ,t.center_y_gd as GD_Y,'3' as type from ATT_CWS_BASE t
  201. union all
  202. 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,
  203. 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'
  204. union all
  205. 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,
  206. 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'
  207. ) f
  208. where 1=1
  209. <if test="type != null and type != ''">
  210. and f.type = #{type}
  211. </if>
  212. <if test="province !=null and province !=''">
  213. AND f.ad_code like '${province}%'
  214. </if>
  215. <if test="name != null and name != ''">
  216. AND f.name like '%${name}%'
  217. </if>
  218. <if test="adCode != null and adCode != ''">
  219. AND f.ad_Code like '${adCode}%'
  220. </if>
  221. AND f.code not in (select code from att_fsc_base t where t.code is not null)
  222. </select>
  223. <update id="updateFscBase" parameterType="cn.com.goldenwater.dcproj.model.AttFscBase" >
  224. update ATT_FSC_BASE
  225. <trim prefix="set" suffixOverrides=",">
  226. CODE = #{code},
  227. <if test="name != null and name != ''">NAME = #{name},</if>
  228. <if test="type != null and type != ''">TYPE = #{type},</if>
  229. ADM_ORG = #{admOrg},
  230. AD_CODE = #{adCode},
  231. LOCATION = #{location},
  232. CENTER_X = #{centerX},
  233. CENTER_Y = #{centerY},
  234. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  235. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  236. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  237. <if test="intm != null">INTM = #{intm},</if>
  238. <if test="uptm != null">UPTM = #{uptm},</if>
  239. </trim>
  240. <where>ID = #{id}</where>
  241. </update>
  242. <select id="findListBy" parameterType="cn.com.goldenwater.dcproj.param.PersObjParam" resultType="cn.com.goldenwater.dcproj.model.AttFscBase">
  243. select
  244. A.ID,
  245. A.CODE,
  246. A.NAME,
  247. A.TYPE,
  248. A.ADM_ORG,
  249. A.AD_CODE,
  250. A.LOCATION,
  251. A.CENTER_X,
  252. A.CENTER_Y,
  253. A.GD_X,
  254. A.GD_Y,
  255. A.PERS_ID,
  256. A.INTM,
  257. A.UPTM
  258. from ATT_FSC_BASE A
  259. where 1=1
  260. <if test="adName != null and adName != ''">and A.name LIKE '%${adName}%'</if>
  261. <if test="adCode != null and adCode != ''">and A.AD_CODE LIKE '${adCode}%'</if>
  262. <if test="maxLgtd != null and maxLgtd != '' and minLgtd != null and minLgtd != ''">and A.CENTER_X BETWEEN
  263. #{minLgtd} AND #{maxLgtd}
  264. </if>
  265. <if test="maxLttd != null and maxLttd != '' and minLttd != null and minLttd != ''">and A.CENTER_Y BETWEEN
  266. #{minLttd} AND #{maxLttd}
  267. </if>
  268. </select>
  269. <select id="getObjListNotInspGroupId" resultType="cn.com.goldenwater.dcproj.model.AttWagaBase" parameterType="String">
  270. select t.*
  271. from ATT_FSC_BASE t
  272. where t.id not in (
  273. select CODE from BIS_INSP_ALL_OBJ B where id like concat(#{inspGroupId},'%') and B.obj_type=#{objType}
  274. <choose>
  275. <when test="province !=null and province !=''">
  276. and B.AD_CODE =#{province}
  277. </when>
  278. <otherwise>
  279. and B.AD_CODE is null
  280. </otherwise>
  281. </choose>
  282. )
  283. <if test="adName != null and adName != ''">and t.nm LIKE '%${adName}%'</if>
  284. <if test="adCode != null and adCode != ''">and t.AD_CODE LIKE '${adCode}%'</if>
  285. </select>
  286. </mapper>