AttWiuBaseDao.xml 13 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  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.AttWiuBaseDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.AttWiuBase" id="attWiuBaseResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="wiuCode" column="WIU_CODE"/>
  7. <result property="wiuName" column="WIU_NAME"/>
  8. <result property="wintCode" column="WINT_CODE"/>
  9. <result property="idtType" column="IDT_TYPE"/>
  10. <result property="name" column="NAME"/>
  11. <result property="adName" column="AD_NAME"/>
  12. <result property="adCode" column="AD_CODE"/>
  13. <result property="wiuNat" column="WIU_NAT"/>
  14. <result property="wiuNatName" column="WIU_NAT_NAME"/>
  15. <result property="codeType" column="CODE_TYPE"/>
  16. <result property="codeVal" column="CODE_VAL"/>
  17. <result property="wiuContact" column="WIU_CONTACT"/>
  18. <result property="wiuContactTel" column="WIU_CONTACT_TEL"/>
  19. <result property="inTm" column="IN_TM"/>
  20. <result property="upTm" column="UP_TM"/>
  21. <result property="wiuLong" column="WIU_LONG"/>
  22. <result property="wiuLat" column="WIU_LAT"/>
  23. <result property="gdX" column="GD_X"/>
  24. <result property="gdY" column="GD_Y"/>
  25. <result property="unitType" column="UNIT_TYPE"/>
  26. <result property="ndstyType" column="NDSTY_TYPE"/>
  27. <result property="rgstrAddr" column="RGSTR_ADDR"/>
  28. <result property="bizAddr" column="BIZ_ADDR"/>
  29. <result property="note" column="NOTE"/>
  30. </resultMap>
  31. <sql id="table_columns">
  32. ID,
  33. WIU_CODE,
  34. WIU_NAME,
  35. WINT_CODE,
  36. IDT_TYPE,
  37. AD_NAME,
  38. AD_CODE,
  39. NAME,
  40. WIU_NAT,
  41. WIU_NAT_NAME,
  42. CODE_TYPE,
  43. CODE_VAL,
  44. WIU_CONTACT,
  45. WIU_CONTACT_TEL,
  46. IN_TM,
  47. UP_TM,
  48. WIU_LONG,
  49. WIU_LAT,
  50. GD_X,
  51. GD_Y,
  52. UNIT_TYPE,
  53. NDSTY_TYPE,
  54. RGSTR_ADDR,
  55. BIZ_ADDR,
  56. NOTE
  57. </sql>
  58. <sql id="entity_properties">
  59. #{id},
  60. #{wiuCode},
  61. #{wiuName},
  62. #{wintCode},
  63. #{idtType},
  64. #{adName},
  65. #{adCode},
  66. #{name},
  67. #{wiuNat},
  68. #{wiuNatName},
  69. #{codeType},
  70. #{codeVal},
  71. #{wiuContact},
  72. #{wiuContactTel},
  73. #{inTm},
  74. #{upTm},
  75. #{wiuLong},
  76. #{wiuLat},
  77. #{gdX},
  78. #{gdY},
  79. #{unitType},
  80. #{ndstyType},
  81. #{rgstrAddr},
  82. #{bizAddr},
  83. #{note}
  84. </sql>
  85. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  86. <sql id="page_where">
  87. <trim prefix="where" prefixOverrides="and | or ">
  88. <if test="unitType != null and unitType != ''">and UNIT_TYPE = #{unitType}</if>
  89. <if test="ndstyType != null and ndstyType != ''">and NDSTY_TYPE = #{ndstyType}</if>
  90. <if test="rgstrAddr != null and rgstrAddr != ''">and RGSTR_ADDR = #{rgstrAddr}</if>
  91. <if test="bizAddr != null and bizAddr != ''">and BIZ_ADDR = #{bizAddr}</if>
  92. <if test="wiuCode != null and wiuCode != ''">and WIU_CODE = #{wiuCode}</if>
  93. <if test="wiuName != null and wiuName != ''">and WIU_NAME = #{wiuName}</if>
  94. <if test="wintCode != null and wintCode != ''">and WINT_CODE = #{wintCode}</if>
  95. <if test="idtType != null and idtType != ''">and IDT_TYPE = #{idtType}</if>
  96. <if test="name != null and name != ''">and NAME = #{name}</if>
  97. <if test="adName != null and adName != ''">and AD_NAME = #{adName}</if>
  98. <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
  99. <if test="wiuNat != null and wiuNat != ''">and WIU_NAT = #{wiuNat}</if>
  100. <if test="wiuNatName != null and wiuNatName != ''">and WIU_NAT_NAME = #{wiuNatName}</if>
  101. <if test="codeType != null and codeType != ''">and CODE_TYPE = #{codeType}</if>
  102. <if test="codeVal != null and codeVal != ''">and CODE_VAL = #{codeVal}</if>
  103. <if test="wiuContact != null and wiuContact != ''">and WIU_CONTACT = #{wiuContact}</if>
  104. <if test="wiuContactTel != null and wiuContactTel != ''">and WIU_CONTACT_TEL = #{wiuContactTel}</if>
  105. <if test="inTm != null">and IN_TM = #{inTm}</if>
  106. <if test="upTm != null">and UP_TM = #{upTm}</if>
  107. <if test="wiuLong != null and wiuLong != ''">and WIU_LONG = #{wiuLong}</if>
  108. <if test="wiuLat != null and wiuLat != ''">and WIU_LAT = #{wiuLat}</if>
  109. <if test="gdX != null and gdX != ''">and GD_X = #{gdX}</if>
  110. <if test="gdY != null and gdY != ''">and GD_Y = #{gdY}</if>
  111. </trim>
  112. </sql>
  113. <select id="get" resultMap="attWiuBaseResultMap" parameterType="String">
  114. select
  115. <include refid="table_columns"/>
  116. from ATT_WIU_BASE where ID = #{id}
  117. </select>
  118. <select id="getBy" resultMap="attWiuBaseResultMap">
  119. select
  120. <include refid="table_columns"/>
  121. from ATT_WIU_BASE
  122. <include refid="page_where"/>
  123. </select>
  124. <select id="findList" resultMap="attWiuBaseResultMap">
  125. select
  126. <include refid="table_columns"/>
  127. from ATT_WIU_BASE
  128. <include refid="page_where"/>
  129. </select>
  130. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.AttWiuBase">
  131. insert into ATT_WIU_BASE(
  132. <include refid="table_columns"/>
  133. )
  134. values (
  135. <include refid="entity_properties"/>
  136. )
  137. </insert>
  138. <delete id="delete" parameterType="java.lang.String">
  139. delete from ATT_WIU_BASE where ID = #{id}
  140. </delete>
  141. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.AttWiuBase">
  142. delete from ATT_WIU_BASE
  143. <include refid="page_where"/>
  144. </delete>
  145. <update id="deleteInFlag" parameterType="java.lang.String">
  146. update ATT_WIU_BASE set flag_valid = 0 where ID = #{id}
  147. </update>
  148. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.AttWiuBase">
  149. update ATT_WIU_BASE
  150. <trim prefix="set" suffixOverrides=",">
  151. <if test="note != null and note != ''">NOTE = #{note},</if>
  152. <if test="unitType != null and unitType != ''">UNIT_TYPE = #{unitType},</if>
  153. <if test="ndstyType != null and ndstyType != ''">NDSTY_TYPE = #{ndstyType},</if>
  154. <if test="rgstrAddr != null and rgstrAddr != ''">RGSTR_ADDR = #{rgstrAddr},</if>
  155. <if test="bizAddr != null and bizAddr != ''">BIZ_ADDR = #{bizAddr},</if>
  156. <if test="wiuCode != null and wiuCode != ''">WIU_CODE = #{wiuCode},</if>
  157. <if test="wiuName != null and wiuName != ''">WIU_NAME = #{wiuName},</if>
  158. <if test="wintCode != null and wintCode != ''">WINT_CODE = #{wintCode},</if>
  159. <if test="idtType != null and idtType != ''">IDT_TYPE = #{idtType},</if>
  160. <if test="name != null and name != ''">NAME = #{name},</if>
  161. <if test="wiuNat != null and wiuNat != ''">WIU_NAT = #{wiuNat},</if>
  162. <if test="wiuNatName != null and wiuNatName != ''">WIU_NAT_NAME = #{wiuNatName},</if>
  163. <if test="codeType != null and codeType != ''">CODE_TYPE = #{codeType},</if>
  164. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  165. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  166. <if test="codeVal != null and codeVal != ''">CODE_VAL = #{codeVal},</if>
  167. <if test="wiuContact != null and wiuContact != ''">WIU_CONTACT = #{wiuContact},</if>
  168. <if test="wiuContactTel != null and wiuContactTel != ''">WIU_CONTACT_TEL = #{wiuContactTel},</if>
  169. <if test="inTm != null">IN_TM = #{inTm},</if>
  170. <if test="upTm != null">UP_TM = #{upTm},</if>
  171. <if test="wiuLong != null and wiuLong != ''">WIU_LONG = #{wiuLong},</if>
  172. <if test="wiuLat != null and wiuLat != ''">WIU_LAT = #{wiuLat},</if>
  173. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  174. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  175. </trim>
  176. <where>ID = #{id}</where>
  177. </update>
  178. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.AttWiuBase">
  179. update ATT_WIU_BASE
  180. <trim prefix="set" suffixOverrides=",">
  181. <if test="unitType != null and unitType != ''">UNIT_TYPE = #{unitType},</if>
  182. <if test="ndstyType != null and ndstyType != ''">NDSTY_TYPE = #{ndstyType},</if>
  183. <if test="rgstrAddr != null and rgstrAddr != ''">RGSTR_ADDR = #{rgstrAddr},</if>
  184. <if test="bizAddr != null and bizAddr != ''">BIZ_ADDR = #{bizAddr},</if>
  185. <if test="wiuCode != null and wiuCode != ''">WIU_CODE = #{wiuCode},</if>
  186. <if test="wiuName != null and wiuName != ''">WIU_NAME = #{wiuName},</if>
  187. <if test="wintCode != null and wintCode != ''">WINT_CODE = #{wintCode},</if>
  188. <if test="idtType != null and idtType != ''">IDT_TYPE = #{idtType},</if>
  189. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  190. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  191. <if test="name != null and name != ''">NAME = #{name},</if>
  192. <if test="wiuNat != null and wiuNat != ''">WIU_NAT = #{wiuNat},</if>
  193. <if test="wiuNatName != null and wiuNatName != ''">WIU_NAT_NAME = #{wiuNatName},</if>
  194. <if test="codeType != null and codeType != ''">CODE_TYPE = #{codeType},</if>
  195. <if test="codeVal != null and codeVal != ''">CODE_VAL = #{codeVal},</if>
  196. <if test="wiuContact != null and wiuContact != ''">WIU_CONTACT = #{wiuContact},</if>
  197. <if test="wiuContactTel != null and wiuContactTel != ''">WIU_CONTACT_TEL = #{wiuContactTel},</if>
  198. <if test="inTm != null">IN_TM = #{inTm},</if>
  199. <if test="upTm != null">UP_TM = #{upTm},</if>
  200. <if test="wiuLong != null and wiuLong != ''">WIU_LONG = #{wiuLong},</if>
  201. <if test="wiuLat != null and wiuLat != ''">WIU_LAT = #{wiuLat},</if>
  202. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  203. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  204. </trim>
  205. <include refid="page_where"/>
  206. </update>
  207. <!-- 其他自定义SQL -->
  208. <select id="getMaxCode" resultType="string" parameterType="string">
  209. select MAX(WIU_Code) as code from ATT_WIU_BASE e where e.ad_code LIKE #{adCode}||'%'
  210. </select>
  211. <sql id="orgIdSql">
  212. <choose>
  213. <when test="orgId !=null and orgId !=''">
  214. and ORG_ID=#{orgId}
  215. </when>
  216. <otherwise>
  217. and ORG_ID is null
  218. </otherwise>
  219. </choose>
  220. </sql>
  221. <select id="getObjByPersId" parameterType="cn.com.goldenwater.dcproj.param.PersObjParam"
  222. resultType="cn.com.goldenwater.dcproj.model.AttWiuBase">
  223. SELECT A.* ,B.OBJ_ID,B.ID groupId,C.ID rgstrId FROM ATT_WIU_BASE A LEFT JOIN BIS_INSP_ALL_OBJ B ON A.id = B.CODE
  224. LEFT JOIN BIS_INSP_WIU_RGSTR C ON B.OBJ_ID = C.OBJ_ID
  225. WHERE B.PTYPE = #{objType} AND
  226. REGEXP_LIKE(
  227. B.Id,'^('||
  228. ( case when(SELECT count(id) from BIS_INSP_ALL_RLATION WHERE PERSID =#{persGuid}<include refid="orgIdSql"/>)>0
  229. then
  230. (SELECT LISTAGG(id, '|') as
  231. id FROM BIS_INSP_ALL_RLATION WHERE PERSID =#{persGuid}<include refid="orgIdSql"/> GROUP BY PERSID)
  232. else (select 'non' from dual) end)
  233. ||')')
  234. <choose>
  235. <when test="province !=null and province !=''">
  236. and B.AD_CODE =#{province}
  237. </when>
  238. <otherwise>
  239. and B.AD_CODE is null
  240. </otherwise>
  241. </choose>
  242. <if test="adName != null and adName != ''">and A.WIU_NAME LIKE '%${adName}%'</if>
  243. <if test="adCode != null and adCode != ''">and A.AD_CODE LIKE '${adCode}%'</if>
  244. </select>
  245. <select id="getObjListNotInspGroupId" parameterType="String"
  246. resultType="cn.com.goldenwater.dcproj.model.AttWiuBase">
  247. select t.*
  248. from ATT_WIU_BASE t
  249. where t.id not in (
  250. select CODE from BIS_INSP_ALL_OBJ B where id like concat(#{inspGroupId},'%') AND B.OBJ_TYPE = #{objType}
  251. <choose>
  252. <when test="province !=null and province !=''">
  253. and B.AD_CODE =#{province}
  254. </when>
  255. <otherwise>
  256. and B.AD_CODE is null
  257. </otherwise>
  258. </choose>
  259. )
  260. <if test="adName != null and adName != ''">and t.nm LIKE '%${adName}%'</if>
  261. <if test="adCode != null and adCode != ''">and t.AD_CODE LIKE '${adCode}%'</if>
  262. </select>
  263. <select id="getObjId" parameterType="String"
  264. resultType="cn.com.goldenwater.dcproj.model.AttWiuBase">
  265. SELECT
  266. <include refid="table_columns"/>
  267. FROM ATT_WIU_BASE
  268. WHERE ID = (SELECT CODE FROM BIS_INSP_ALL_OBJ WHERE OBJ_ID = #{objId})
  269. </select>
  270. </mapper>