TacAttPawpBaseDao.xml 8.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  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.TacAttPawpBaseDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.TacAttPawpBase" id="tacAttPawpBaseResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="name" column="NAME"/>
  7. <result property="type" column="TYPE"/>
  8. <result property="admOrg" column="ADM_ORG"/>
  9. <result property="adCode" column="AD_CODE"/>
  10. <result property="location" column="LOCATION"/>
  11. <result property="centerX" column="CENTER_X"/>
  12. <result property="centerY" column="CENTER_Y"/>
  13. <result property="gdX" column="GD_X"/>
  14. <result property="gdY" column="GD_Y"/>
  15. <result property="persId" column="PERS_ID"/>
  16. <result property="intm" column="INTM"/>
  17. <result property="uptm" column="UPTM"/>
  18. <result property="adName" column="AD_NAME"/>
  19. <result property="isPoverty" column="IS_POVERTY"/>
  20. <result property="province" column="PROVINCE"/>
  21. <result property="year" column="YEAR"/>
  22. <result property="commencementDate" column="COMMENCEMENT_DATE"/>
  23. <result property="totalInvestment" column="TOTAL_INVESTMENT"/>
  24. </resultMap>
  25. <sql id="table_columns">
  26. ID,
  27. NAME,
  28. TYPE,
  29. ADM_ORG,
  30. AD_CODE,
  31. LOCATION,
  32. CENTER_X,
  33. CENTER_Y,
  34. GD_X,
  35. GD_Y,
  36. PERS_ID,
  37. INTM,
  38. UPTM,AD_NAME,IS_POVERTY,PROVINCE,
  39. YEAR,
  40. COMMENCEMENT_DATE,
  41. TOTAL_INVESTMENT
  42. </sql>
  43. <sql id="entity_properties">
  44. #{id}, #{name},
  45. #{type},
  46. #{admOrg},
  47. #{adCode},
  48. #{location},
  49. #{centerX},
  50. #{centerY},
  51. #{gdX},
  52. #{gdY},
  53. #{persId},
  54. #{intm},
  55. #{uptm},#{adName},#{isPoverty},#{province},
  56. #{year},#{commencementDate},#{totalInvestment}
  57. </sql>
  58. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  59. <sql id="page_where">
  60. <trim prefix="where" prefixOverrides="and | or ">
  61. <if test="name != null and name != ''">and NAME like concat('%',concat(#{name},'%'))</if>
  62. <if test="type != null and type != ''">and TYPE like concat('%',concat(#{type},'%'))</if>
  63. <if test="admOrg != null and admOrg != ''">and ADM_ORG like concat('%',concat(#{admOrg},'%'))</if>
  64. <if test="adCode != null and adCode != ''">and AD_CODE = #{adCode}</if>
  65. <if test="location != null and location != ''">and LOCATION like concat('%',concat(#{location},'%'))</if>
  66. <if test="centerX != null and centerX != ''">and CENTER_X = #{centerX}</if>
  67. <if test="centerY != null and centerY != ''">and CENTER_Y = #{centerY}</if>
  68. <if test="gdX != null and gdX != ''">and GD_X = #{gdX}</if>
  69. <if test="gdY != null and gdY != ''">and GD_Y = #{gdY}</if>
  70. <if test="persId != null and persId != ''">and PERS_ID = #{persId}</if>
  71. <if test="intm != null">and INTM = #{intm}</if>
  72. <if test="uptm != null">and UPTM = #{uptm}</if>
  73. <if test="isPoverty != null">and IS_POVERTY = #{isPoverty}</if>
  74. <if test="adName != null">and AD_NAME = #{adName}</if>
  75. <if test="year != null and year != ''">and YEAR = #{year}</if>
  76. <if test="totalInvestment != null and totalInvestment != ''">and TOTAL_INVESTMENT = #{totalInvestment}</if>
  77. <if test="commencementDate != null">and COMMENCEMENT_DATE = #{commencementDate}</if>
  78. <include refid="choseSql"/>
  79. </trim>
  80. </sql>
  81. <sql id="choseSql">
  82. <choose>
  83. <when test="province !=null and province !=''">
  84. AND t.province=#{province}
  85. </when>
  86. <otherwise>
  87. AND t.province is null
  88. </otherwise>
  89. </choose>
  90. </sql>
  91. <select id="get" resultMap="tacAttPawpBaseResultMap" parameterType="String">
  92. select
  93. <include refid="table_columns"/>
  94. from TAC_ATT_PAWP_BASE where ID = #{id}
  95. </select>
  96. <select id="getBy" resultMap="tacAttPawpBaseResultMap">
  97. select
  98. <include refid="table_columns"/>
  99. from TAC_ATT_PAWP_BASE t
  100. <include refid="page_where"/>
  101. </select>
  102. <select id="findAll" resultMap="tacAttPawpBaseResultMap">
  103. select
  104. <include refid="table_columns"/>
  105. from TAC_ATT_PAWP_BASE
  106. </select>
  107. <select id="findList" resultMap="tacAttPawpBaseResultMap">
  108. select
  109. <include refid="table_columns"/>
  110. from TAC_ATT_PAWP_BASE t
  111. <include refid="page_where"/>
  112. </select>
  113. <select id="selectCount" resultType="int">
  114. select count(ID) from TAC_ATT_PAWP_BASE t
  115. <include refid="page_where"/>
  116. </select>
  117. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.TacAttPawpBase">
  118. insert into TAC_ATT_PAWP_BASE(
  119. <include refid="table_columns"/>
  120. )
  121. values (
  122. <include refid="entity_properties"/>
  123. )
  124. </insert>
  125. <delete id="delete" parameterType="java.lang.String">
  126. delete from TAC_ATT_PAWP_BASE where ID = #{id}
  127. </delete>
  128. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.TacAttPawpBase">
  129. delete from TAC_ATT_PAWP_BASE t
  130. <include refid="page_where"/>
  131. </delete>
  132. <update id="deleteInFlag" parameterType="java.lang.String">
  133. update TAC_ATT_PAWP_BASE set flag_valid = 0 where ID = #{id}
  134. </update>
  135. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.TacAttPawpBase">
  136. update TAC_ATT_PAWP_BASE
  137. <trim prefix="set" suffixOverrides=",">
  138. <if test="name != null and name != ''">NAME = #{name},</if>
  139. <if test="type != null and type != ''">TYPE = #{type},</if>
  140. <if test="isPoverty != null">IS_POVERTY = #{isPoverty},</if>
  141. <if test="adName != null">AD_NAME = #{adName},</if>
  142. <if test="admOrg != null">ADM_ORG = #{admOrg},</if>
  143. <if test="adCode != null">AD_CODE = #{adCode},</if>
  144. <if test="location != null">LOCATION = #{location},</if>
  145. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  146. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  147. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  148. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  149. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  150. <if test="intm != null">INTM = #{intm},</if>
  151. <if test="uptm != null">UPTM = #{uptm},</if>
  152. <if test="province != null">PROVINCE = #{province},</if>
  153. <if test="year != null and year != ''">YEAR = #{year},</if>
  154. <if test="totalInvestment != null">TOTAL_INVESTMENT = #{totalInvestment},</if>
  155. <if test="commencementDate != null">COMMENCEMENT_DATE = #{commencementDate},</if>
  156. </trim>
  157. <where>ID = #{id}</where>
  158. </update>
  159. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.TacAttPawpBase">
  160. update TAC_ATT_PAWP_BASE
  161. <trim prefix="set" suffixOverrides=",">
  162. <if test="isPoverty != null">IS_POVERTY = #{isPoverty},</if>
  163. <if test="adName != null">AD_NAME = #{adName},</if>
  164. <if test="name != null and name != ''">NAME = #{name},</if>
  165. <if test="type != null and type != ''">TYPE = #{type},</if>
  166. <if test="admOrg != null">ADM_ORG = #{admOrg},</if>
  167. <if test="adCode != null and adCode != ''">AD_CODE = #{adCode},</if>
  168. <if test="location != null">LOCATION = #{location},</if>
  169. <if test="centerX != null and centerX != ''">CENTER_X = #{centerX},</if>
  170. <if test="centerY != null and centerY != ''">CENTER_Y = #{centerY},</if>
  171. <if test="gdX != null and gdX != ''">GD_X = #{gdX},</if>
  172. <if test="gdY != null and gdY != ''">GD_Y = #{gdY},</if>
  173. <if test="persId != null and persId != ''">PERS_ID = #{persId},</if>
  174. <if test="intm != null">INTM = #{intm},</if>
  175. <if test="uptm != null">UPTM = #{uptm},</if>
  176. <if test="province != null">PROVINCE = #{province},</if>
  177. <if test="year != null and year != ''">YEAR = #{year},</if>
  178. <if test="totalInvestment != null">TOTAL_INVESTMENT = #{totalInvestment},</if>
  179. <if test="commencementDate != null">COMMENCEMENT_DATE = #{commencementDate},</if>
  180. </trim>
  181. <include refid="page_where"/>
  182. </update>
  183. <!-- 其他自定义SQL -->
  184. <select id="getBaseType" parameterType="cn.com.goldenwater.dcproj.param.TacAttPawpBaseParam" resultType="java.lang.String">
  185. select DISTINCT type from TAC_ATT_PAWP_BASE t where TYPE is not null
  186. <include refid="choseSql"/>
  187. </select>
  188. </mapper>