AttWiuBaseDao.xml 9.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241
  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. </resultMap>
  26. <sql id="table_columns">
  27. ID,
  28. WIU_CODE,
  29. WIU_NAME,
  30. WINT_CODE,
  31. IDT_TYPE,
  32. AD_NAME,
  33. AD_CODE,
  34. NAME,
  35. WIU_NAT,
  36. WIU_NAT_NAME,
  37. CODE_TYPE,
  38. CODE_VAL,
  39. WIU_CONTACT,
  40. WIU_CONTACT_TEL,
  41. IN_TM,
  42. WIU_LONG,
  43. WIU_LAT,
  44. GD_X,
  45. GD_Y,
  46. UP_TM
  47. </sql>
  48. <sql id="entity_properties">
  49. #{id},
  50. #{wiuCode},
  51. #{wiuName},
  52. #{wintCode},
  53. #{idtType},
  54. #{adName},
  55. #{adCode},
  56. #{name},
  57. #{wiuNat},
  58. #{wiuNatName},
  59. #{codeType},
  60. #{codeVal},
  61. #{wiuContact},
  62. #{wiuContactTel},
  63. #{inTm},
  64. #{wiuLong},
  65. #{wiuLat},
  66. #{gdX},
  67. #{gdY},
  68. #{upTm}
  69. </sql>
  70. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  71. <sql id="page_where">
  72. <trim prefix="where" prefixOverrides="and | or ">
  73. <if test="wiuCode != null and wiuCode != ''">and WIU_CODE = #{wiuCode}</if>
  74. <if test="wiuName != null and wiuName != ''">and WIU_NAME = #{wiuName}</if>
  75. <if test="wintCode != null and wintCode != ''">and WINT_CODE = #{wintCode}</if>
  76. <if test="idtType != null and idtType != ''">and IDT_TYPE = #{idtType}</if>
  77. <if test="name != null and name != ''">and NAME = #{name}</if>
  78. <if test="adName != null and adName != ''">and AD_NAME = #{adName}</if>
  79. <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
  80. <if test="wiuNat != null and wiuNat != ''">and WIU_NAT = #{wiuNat}</if>
  81. <if test="wiuNatName != null and wiuNatName != ''">and WIU_NAT_NAME = #{wiuNatName}</if>
  82. <if test="codeType != null and codeType != ''">and CODE_TYPE = #{codeType}</if>
  83. <if test="codeVal != null and codeVal != ''">and CODE_VAL = #{codeVal}</if>
  84. <if test="wiuContact != null and wiuContact != ''">and WIU_CONTACT = #{wiuContact}</if>
  85. <if test="wiuContactTel != null and wiuContactTel != ''">and WIU_CONTACT_TEL = #{wiuContactTel}</if>
  86. <if test="inTm != null">and IN_TM = #{inTm}</if>
  87. <if test="upTm != null">and UP_TM = #{upTm}</if>
  88. <if test="wiuLong != null and wiuLong != ''">and WIU_LONG = #{wiuLong}</if>
  89. <if test="wiuLat != null and wiuLat != ''">and WIU_LAT = #{wiuLat}</if>
  90. <if test="gdX != null and gdX != ''">and GD_X = #{gdX}</if>
  91. <if test="gdY != null and gdY != ''">and GD_Y = #{gdY}</if>
  92. </trim>
  93. </sql>
  94. <select id="get" resultMap="attWiuBaseResultMap" parameterType="String" >
  95. select <include refid="table_columns" /> from ATT_WIU_BASE where ID = #{id}
  96. </select>
  97. <select id="getBy" resultMap="attWiuBaseResultMap">
  98. select <include refid="table_columns" /> from ATT_WIU_BASE <include refid="page_where" />
  99. </select>
  100. <select id="findAll" resultMap="attWiuBaseResultMap">
  101. select <include refid="table_columns" /> from ATT_WIU_BASE
  102. </select>
  103. <select id="findList" resultMap="attWiuBaseResultMap">
  104. select <include refid="table_columns" /> from ATT_WIU_BASE <include refid="page_where" />
  105. </select>
  106. <select id="selectCount" resultType="int" >
  107. select count(ID) from ATT_WIU_BASE <include refid="page_where" />
  108. </select>
  109. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.AttWiuBase">
  110. insert into ATT_WIU_BASE( <include refid="table_columns" /> )
  111. values ( <include refid="entity_properties" /> )
  112. </insert>
  113. <delete id="delete" parameterType="java.lang.String">
  114. delete from ATT_WIU_BASE where ID = #{id}
  115. </delete>
  116. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.AttWiuBase">
  117. delete from ATT_WIU_BASE <include refid="page_where" />
  118. </delete>
  119. <update id="deleteInFlag" parameterType="java.lang.String">
  120. update ATT_WIU_BASE set flag_valid = 0 where ID = #{id}
  121. </update>
  122. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.AttWiuBase">
  123. update ATT_WIU_BASE
  124. <trim prefix="set" suffixOverrides=",">
  125. <if test="wiuCode != null and wiuCode != ''">WIU_CODE = #{wiuCode},</if>
  126. <if test="wiuName != null and wiuName != ''">WIU_NAME = #{wiuName},</if>
  127. <if test="wintCode != null and wintCode != ''">WINT_CODE = #{wintCode},</if>
  128. <if test="idtType != null and idtType != ''">IDT_TYPE = #{idtType},</if>
  129. <if test="name != null and name != ''">NAME = #{name},</if>
  130. <if test="wiuNat != null and wiuNat != ''">WIU_NAT = #{wiuNat},</if>
  131. <if test="wiuNatName != null and wiuNatName != ''">WIU_NAT_NAME = #{wiuNatName},</if>
  132. <if test="codeType != null and codeType != ''">CODE_TYPE = #{codeType},</if>
  133. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  134. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  135. <if test="codeVal != null and codeVal != ''">CODE_VAL = #{codeVal},</if>
  136. <if test="wiuContact != null and wiuContact != ''">WIU_CONTACT = #{wiuContact},</if>
  137. <if test="wiuContactTel != null and wiuContactTel != ''">WIU_CONTACT_TEL = #{wiuContactTel},</if>
  138. <if test="inTm != null">IN_TM = #{inTm},</if>
  139. <if test="upTm != null">UP_TM = #{upTm},</if>
  140. <if test="wiuLong != null and wiuLong != ''">WIU_LONG = #{wiuLong},</if>
  141. <if test="wiuLat != null and wiuLat != ''">WIU_LAT = #{wiuLat},</if>
  142. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  143. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  144. </trim>
  145. <where>ID = #{id}</where>
  146. </update>
  147. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.AttWiuBase">
  148. update ATT_WIU_BASE
  149. <trim prefix="set" suffixOverrides=",">
  150. <if test="wiuCode != null and wiuCode != ''">WIU_CODE = #{wiuCode},</if>
  151. <if test="wiuName != null and wiuName != ''">WIU_NAME = #{wiuName},</if>
  152. <if test="wintCode != null and wintCode != ''">WINT_CODE = #{wintCode},</if>
  153. <if test="idtType != null and idtType != ''">IDT_TYPE = #{idtType},</if>
  154. <if test="adName != null and adName != ''">AD_NAME = #{adName},</if>
  155. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  156. <if test="name != null and name != ''">NAME = #{name},</if>
  157. <if test="wiuNat != null and wiuNat != ''">WIU_NAT = #{wiuNat},</if>
  158. <if test="wiuNatName != null and wiuNatName != ''">WIU_NAT_NAME = #{wiuNatName},</if>
  159. <if test="codeType != null and codeType != ''">CODE_TYPE = #{codeType},</if>
  160. <if test="codeVal != null and codeVal != ''">CODE_VAL = #{codeVal},</if>
  161. <if test="wiuContact != null and wiuContact != ''">WIU_CONTACT = #{wiuContact},</if>
  162. <if test="wiuContactTel != null and wiuContactTel != ''">WIU_CONTACT_TEL = #{wiuContactTel},</if>
  163. <if test="inTm != null">IN_TM = #{inTm},</if>
  164. <if test="upTm != null">UP_TM = #{upTm},</if>
  165. <if test="wiuLong != null and wiuLong != ''">WIU_LONG = #{wiuLong},</if>
  166. <if test="wiuLat != null and wiuLat != ''">WIU_LAT = #{wiuLat},</if>
  167. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  168. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  169. </trim>
  170. <include refid="page_where" />
  171. </update>
  172. <!-- 其他自定义SQL -->
  173. <select id="getMaxCode" resultType="string" parameterType="string">
  174. select MAX(WIU_Code) as code from ATT_WIU_BASE e where e.ad_code LIKE concat(#{adCode},'%')
  175. </select>
  176. <sql id="orgIdSql">
  177. <choose>
  178. <when test="orgId !=null and orgId !=''">
  179. and ORG_ID=#{orgId}
  180. </when>
  181. <otherwise>
  182. and ORG_ID is null
  183. </otherwise>
  184. </choose>
  185. </sql>
  186. <select id="getObjByPersId" parameterType="cn.com.goldenwater.dcproj.param.PersObjParam" resultType="cn.com.goldenwater.dcproj.model.AttWiuBase">
  187. 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
  188. LEFT JOIN BIS_INSP_WIU_RGSTR C ON B.OBJ_ID = C.OBJ_ID
  189. WHERE B.PTYPE = #{objType} AND
  190. B.id in (${inIdsSql})
  191. <choose>
  192. <when test="province !=null and province !=''">
  193. and B.AD_CODE =#{province}
  194. </when>
  195. <otherwise>
  196. and B.AD_CODE is null
  197. </otherwise>
  198. </choose>
  199. <if test="adName != null and adName != ''">and A.WIU_NAME LIKE '%${adName}%'</if>
  200. <if test="adCode != null and adCode != ''">and A.AD_CODE LIKE '${adCode}%'</if>
  201. </select>
  202. <select id="getObjListNotInspGroupId" parameterType="String" resultType="cn.com.goldenwater.dcproj.model.AttWiuBase">
  203. select t.*
  204. from ATT_WIU_BASE t
  205. where t.id not in (
  206. select CODE from BIS_INSP_ALL_OBJ B where id like concat(#{inspGroupId},'%') and B.obj_type=#{objType}
  207. <choose>
  208. <when test="province !=null and province !=''">
  209. and B.AD_CODE =#{province}
  210. </when>
  211. <otherwise>
  212. and B.AD_CODE is null
  213. </otherwise>
  214. </choose>
  215. )
  216. <if test="adName != null and adName != ''">and t.nm LIKE '%${adName}%'</if>
  217. <if test="adCode != null and adCode != ''">and t.AD_CODE LIKE '${adCode}%'</if>
  218. </select>
  219. </mapper>