AttOtherBaseDao.xml 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296
  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.AttOtherBaseDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.AttOtherBase" id="attOtherBaseResultMap">
  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="attOtherBaseResultMap" parameterType="String">
  71. select
  72. <include refid="table_columns"/>
  73. from ATT_OTHER_BASE where ID = #{id}
  74. </select>
  75. <select id="getBy" resultMap="attOtherBaseResultMap">
  76. select
  77. <include refid="table_columns"/>
  78. from ATT_OTHER_BASE
  79. <include refid="page_where"/>
  80. </select>
  81. <select id="findAll" resultMap="attOtherBaseResultMap">
  82. select
  83. <include refid="table_columns"/>
  84. from ATT_OTHER_BASE
  85. </select>
  86. <select id="findList" resultMap="attOtherBaseResultMap">
  87. select
  88. <include refid="table_columns"/>
  89. from ATT_OTHER_BASE
  90. <include refid="page_where"/>
  91. </select>
  92. <select id="selectCount" resultType="int">
  93. select count(ID) from ATT_OTHER_BASE
  94. <include refid="page_where"/>
  95. </select>
  96. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.AttOtherBase">
  97. insert into ATT_OTHER_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_OTHER_BASE where ID = #{id}
  106. </delete>
  107. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.AttOtherBase">
  108. delete from ATT_OTHER_BASE
  109. <include refid="page_where"/>
  110. </delete>
  111. <update id="deleteInFlag" parameterType="java.lang.String">
  112. update ATT_OTHER_BASE set flag_valid = 0 where ID = #{id}
  113. </update>
  114. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.AttOtherBase">
  115. update ATT_OTHER_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.AttOtherBase">
  134. update ATT_OTHER_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 -->
  153. <select id="getBasePageInfoNotInFsc" parameterType="cn.com.goldenwater.dcproj.param.AttOtherBaseParam"
  154. resultType="cn.com.goldenwater.dcproj.model.AttOtherBase">
  155. select f.code,
  156. f.name,
  157. f.ad_code,
  158. f.location,
  159. f.center_x,
  160. f.center_y,
  161. f.gd_x,
  162. f.gd_y,
  163. f.type from (
  164. select cast(rs.rs_code as char) as code,rs.rs_name as name,rs.adm_div as
  165. ad_Code,rs.rs_adm_name as location,rs.center_x as center_X,rs.center_y as center_y,
  166. rs.center_x_gd as GD_X ,rs.center_y_gd as GD_Y, '1' as type from ATT_RS_BASE rs
  167. union all
  168. 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
  169. center_X,t.center_y as center_y,
  170. t.gd_x as GD_X,t.GD_Y as GD_Y,'2' as type from ATT_WAGA_BASE t
  171. union all
  172. 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
  173. center_x,t.cws_lat as center_y,
  174. t.center_x_gd as GD_X ,t.center_y_gd as GD_Y,'3' as type from ATT_CWS_BASE t
  175. union all
  176. 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,
  177. 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'
  178. union all
  179. 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,
  180. 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'
  181. ) f
  182. where 1=1
  183. <if test="type != null and type != ''">
  184. and f.type = #{type}
  185. </if>
  186. <if test="province !=null and province !=''">
  187. AND f.ad_code like '${province}%'
  188. </if>
  189. <if test="name != null and name != ''">
  190. AND f.name like '%${name}%'
  191. </if>
  192. <if test="adCode != null and adCode != ''">
  193. AND f.ad_Code like '${adCode}%'
  194. </if>
  195. AND f.code not in (select code from att_other_base t where t.code is not null)
  196. </select>
  197. <update id="updateOtherBase" parameterType="cn.com.goldenwater.dcproj.model.AttOtherBase">
  198. update ATT_OTHER_BASE
  199. <trim prefix="set" suffixOverrides=",">
  200. CODE = #{code},
  201. <if test="name != null and name != ''">NAME = #{name},</if>
  202. <if test="type != null and type != ''">TYPE = #{type},</if>
  203. ADM_ORG = #{admOrg},
  204. AD_CODE = #{adCode},
  205. LOCATION = #{location},
  206. CENTER_X = #{centerX},
  207. CENTER_Y = #{centerY},
  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="persId != null and persId != ''">PERS_ID = #{persId},</if>
  211. <if test="intm != null">INTM = #{intm},</if>
  212. <if test="uptm != null">UPTM = #{uptm},</if>
  213. </trim>
  214. <where>ID = #{id}</where>
  215. </update>
  216. <select id="getObjByPersId" parameterType="cn.com.goldenwater.dcproj.param.PersObjParam" resultType="cn.com.goldenwater.dcproj.model.AttOtherBase">
  217. SELECT A.* ,B.OBJ_ID,B.ID groupId,C.ID rgstrId FROM ATT_other_BASE A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.id = B.CODE
  218. LEFT JOIN BIS_INSP_OTHER_RGSTR C ON B.OBJ_ID = C.OBJ_ID
  219. WHERE B.PTYPE = #{objType} AND
  220. B.id in (${inIdsSql})
  221. <if test="adName != null and adName != ''">and A.NAME LIKE '%${adName}%'</if>
  222. <if test="adCode != null and adCode != ''">and A.AD_CODE LIKE '${adCode}%'</if>
  223. </select>
  224. <select id="findListBy" resultType="cn.com.goldenwater.dcproj.model.AttOtherBase" parameterType="cn.com.goldenwater.dcproj.param.PersObjParam">
  225. SELECT
  226. A.ID,
  227. A.CODE,
  228. A.NAME,
  229. A.TYPE,
  230. A.ADM_ORG,
  231. A.AD_CODE,
  232. A.LOCATION,
  233. A.CENTER_X,
  234. A.CENTER_Y,
  235. A.GD_X,
  236. A.GD_Y,
  237. A.PERS_ID,
  238. A.INTM,
  239. A.UPTM
  240. FROM ATT_OTHER_BASE A
  241. where 1=1
  242. <if test="adName != null and adName != ''">and A.name LIKE '%${adName}%'</if>
  243. <if test="adCode != null and adCode != ''">and A.AD_CODE LIKE '${adCode}%'</if>
  244. <if test="maxLgtd != null and maxLgtd != '' and minLgtd != null and minLgtd != ''">and A.CENTER_X BETWEEN
  245. #{minLgtd} AND #{maxLgtd}
  246. </if>
  247. <if test="maxLttd != null and maxLttd != '' and minLttd != null and minLttd != ''">and A.CENTER_Y BETWEEN
  248. #{minLttd} AND #{maxLttd}
  249. </if>
  250. </select>
  251. <select id="getObjListNotInspGroupId" parameterType="String" resultType="cn.com.goldenwater.dcproj.model.AttOtherBase">
  252. select t.*
  253. from ATT_OTHER_BASE t
  254. where t.id not in (
  255. select CODE from BIS_INSP_ALL_OBJ B where id like concat(#{inspGroupId},'%') and B.obj_type=#{objType}
  256. <choose>
  257. <when test="province !=null and province !=''">
  258. and B.AD_CODE =#{province}
  259. </when>
  260. <otherwise>
  261. and B.AD_CODE is null
  262. </otherwise>
  263. </choose>
  264. )
  265. <if test="adName != null and adName != ''">and t.nm LIKE '%${adName}%'</if>
  266. <if test="adCode != null and adCode != ''">and t.AD_CODE LIKE '${adCode}%'</if>
  267. </select>
  268. </mapper>