9d41ea4e23563b3b4ebd452dc933d8d223d2b782.svn-base 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165
  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.AttBasBaseDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.AttBasBase" id="attBasBaseResultMap">
  5. <result property="basCode" column="BAS_CODE"/>
  6. <result property="basName" column="BAS_NAME"/>
  7. <result property="crOverType" column="CR_OVER_TYPE"/>
  8. <result property="basAdName" column="BAS_AD_NAME"/>
  9. <result property="basGrad" column="BAS_GRAD"/>
  10. <result property="basArea" column="BAS_AREA"/>
  11. <result property="meaAnnPrec" column="MEA_ANN_PREC"/>
  12. <result property="meaAnnDept" column="MEA_ANN_DEPT"/>
  13. <result property="meaAnnRuof" column="MEA_ANN_RUOF"/>
  14. <result property="note" column="NOTE"/>
  15. <result property="effDate" column="EFF_DATE"/>
  16. <result property="exprDate" column="EXPR_DATE"/>
  17. </resultMap>
  18. <sql id="table_columns">
  19. BAS_CODE,
  20. BAS_NAME,
  21. CR_OVER_TYPE,
  22. BAS_AD_NAME,
  23. BAS_GRAD,
  24. BAS_AREA,
  25. MEA_ANN_PREC,
  26. MEA_ANN_DEPT,
  27. MEA_ANN_RUOF,
  28. NOTE,
  29. EFF_DATE,
  30. EXPR_DATE
  31. </sql>
  32. <sql id="entity_properties">
  33. #{basCode},
  34. #{basName},
  35. #{crOverType},
  36. #{basAdName},
  37. #{basGrad},
  38. #{basArea},
  39. #{meaAnnPrec},
  40. #{meaAnnDept},
  41. #{meaAnnRuof},
  42. #{note},
  43. #{effDate},
  44. #{exprDate}
  45. </sql>
  46. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  47. <sql id="page_where">
  48. <trim prefix="where" prefixOverrides="and | or ">
  49. <if test="basName != null and basName != ''">and BAS_NAME = #{basName}</if>
  50. <if test="crOverType != null and crOverType != ''">and CR_OVER_TYPE = #{crOverType}</if>
  51. <if test="basAdName != null and basAdName != ''">and BAS_AD_NAME = #{basAdName}</if>
  52. <if test="basGrad != null and basGrad != ''">and BAS_GRAD = #{basGrad}</if>
  53. <if test="basArea != null and basArea != ''">and BAS_AREA = #{basArea}</if>
  54. <if test="meaAnnPrec != null and meaAnnPrec != ''">and MEA_ANN_PREC = #{meaAnnPrec}</if>
  55. <if test="meaAnnDept != null and meaAnnDept != ''">and MEA_ANN_DEPT = #{meaAnnDept}</if>
  56. <if test="meaAnnRuof != null and meaAnnRuof != ''">and MEA_ANN_RUOF = #{meaAnnRuof}</if>
  57. <if test="note != null and note != ''">and NOTE = #{note}</if>
  58. <if test="effDate != null">and EFF_DATE = #{effDate}</if>
  59. <if test="exprDate != null">and EXPR_DATE = #{exprDate}</if>
  60. </trim>
  61. </sql>
  62. <select id="get" resultMap="attBasBaseResultMap" parameterType="String">
  63. select
  64. <include refid="table_columns"/>
  65. from ATT_BAS_BASE where BAS_CODE = #{id}
  66. </select>
  67. <select id="getBy" resultMap="attBasBaseResultMap">
  68. select
  69. <include refid="table_columns"/>
  70. from ATT_BAS_BASE
  71. <include refid="page_where"/>
  72. </select>
  73. <select id="findAll" resultMap="attBasBaseResultMap">
  74. select
  75. <include refid="table_columns"/>
  76. from ATT_BAS_BASE
  77. </select>
  78. <select id="findList" resultMap="attBasBaseResultMap">
  79. select
  80. <include refid="table_columns"/>
  81. from ATT_BAS_BASE
  82. <include refid="page_where"/>
  83. </select>
  84. <select id="selectCount" resultType="int">
  85. select count(ID) from ATT_BAS_BASE
  86. <include refid="page_where"/>
  87. </select>
  88. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.AttBasBase">
  89. insert into ATT_BAS_BASE(
  90. <include refid="table_columns"/>
  91. )
  92. values (
  93. <include refid="entity_properties"/>
  94. )
  95. </insert>
  96. <delete id="delete" parameterType="java.lang.String">
  97. delete from ATT_BAS_BASE where ID = #{id}
  98. </delete>
  99. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.AttBasBase">
  100. delete from ATT_BAS_BASE
  101. <include refid="page_where"/>
  102. </delete>
  103. <update id="deleteInFlag" parameterType="java.lang.String">
  104. update ATT_BAS_BASE set flag_valid = 0 where ID = #{id}
  105. </update>
  106. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.AttBasBase">
  107. update ATT_BAS_BASE
  108. <trim prefix="set" suffixOverrides=",">
  109. <if test="basName != null and basName != ''">BAS_NAME = #{basName},</if>
  110. <if test="crOverType != null and crOverType != ''">CR_OVER_TYPE = #{crOverType},</if>
  111. <if test="basAdName != null and basAdName != ''">BAS_AD_NAME = #{basAdName},</if>
  112. <if test="basGrad != null and basGrad != ''">BAS_GRAD = #{basGrad},</if>
  113. <if test="basArea != null and basArea != ''">BAS_AREA = #{basArea},</if>
  114. <if test="meaAnnPrec != null and meaAnnPrec != ''">MEA_ANN_PREC = #{meaAnnPrec},</if>
  115. <if test="meaAnnDept != null and meaAnnDept != ''">MEA_ANN_DEPT = #{meaAnnDept},</if>
  116. <if test="meaAnnRuof != null and meaAnnRuof != ''">MEA_ANN_RUOF = #{meaAnnRuof},</if>
  117. <if test="note != null and note != ''">NOTE = #{note},</if>
  118. <if test="effDate != null">EFF_DATE = #{effDate},</if>
  119. <if test="exprDate != null">EXPR_DATE = #{exprDate},</if>
  120. </trim>
  121. <where>ID = #{id}</where>
  122. </update>
  123. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.AttBasBase">
  124. update ATT_BAS_BASE
  125. <trim prefix="set" suffixOverrides=",">
  126. <if test="basName != null and basName != ''">BAS_NAME = #{basName},</if>
  127. <if test="crOverType != null and crOverType != ''">CR_OVER_TYPE = #{crOverType},</if>
  128. <if test="basAdName != null and basAdName != ''">BAS_AD_NAME = #{basAdName},</if>
  129. <if test="basGrad != null and basGrad != ''">BAS_GRAD = #{basGrad},</if>
  130. <if test="basArea != null and basArea != ''">BAS_AREA = #{basArea},</if>
  131. <if test="meaAnnPrec != null and meaAnnPrec != ''">MEA_ANN_PREC = #{meaAnnPrec},</if>
  132. <if test="meaAnnDept != null and meaAnnDept != ''">MEA_ANN_DEPT = #{meaAnnDept},</if>
  133. <if test="meaAnnRuof != null and meaAnnRuof != ''">MEA_ANN_RUOF = #{meaAnnRuof},</if>
  134. <if test="note != null and note != ''">NOTE = #{note},</if>
  135. <if test="effDate != null">EFF_DATE = #{effDate},</if>
  136. <if test="exprDate != null">EXPR_DATE = #{exprDate},</if>
  137. </trim>
  138. <include refid="page_where"/>
  139. </update>
  140. <!-- 其他自定义SQL -->
  141. <select id="selectMax" resultType="int">
  142. select max(to_number(t.BAS_CODE)) from ATT_BAS_BASE t
  143. </select>
  144. </mapper>