344af1c5d6c2db8eecc4beed55352de92b8c75fe.svn-base 5.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  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.AttRlrwImplDao">
  4. <resultMap type="cn.com.goldenwater.dcproj.model.AttRlrwImpl" id="attRlrwImplResultMap">
  5. <result property="id" column="ID"/>
  6. <result property="landCode" column="LAND_CODE"/>
  7. <result property="returnYear" column="RETURN_YEAR"/>
  8. <result property="returnCount" column="RETURN_COUNT"/>
  9. <result property="returnArea" column="RETURN_AREA"/>
  10. <result property="intm" column="INTM"/>
  11. <result property="remark" column="REMARK"/>
  12. </resultMap>
  13. <sql id="table_columns">
  14. ID,
  15. LAND_CODE,
  16. RETURN_YEAR,
  17. RETURN_COUNT,
  18. RETURN_AREA,
  19. INTM,
  20. REMARK
  21. </sql>
  22. <sql id="entity_properties">
  23. #{id},
  24. #{landCode},
  25. #{returnYear},
  26. #{returnCount},
  27. #{returnArea},
  28. #{intm},
  29. #{remark}
  30. </sql>
  31. <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
  32. <sql id="page_where">
  33. <trim prefix="where" prefixOverrides="and | or ">
  34. <if test="landCode != null and landCode != ''">and LAND_CODE = #{landCode}</if>
  35. <if test="returnYear != null and returnYear != ''">and RETURN_YEAR = #{returnYear}</if>
  36. <if test="returnCount != null and returnCount != ''">and RETURN_COUNT = #{returnCount}</if>
  37. <if test="returnArea != null and returnArea != ''">and RETURN_AREA = #{returnArea}</if>
  38. <if test="intm != null">and INTM = #{intm}</if>
  39. <if test="remark != null and remark != ''">and REMARK = #{remark}</if>
  40. </trim>
  41. </sql>
  42. <select id="get" resultMap="attRlrwImplResultMap" parameterType="String" >
  43. select <include refid="table_columns" /> from ATT_RLRW_IMPL where ID = #{id}
  44. </select>
  45. <select id="getBy" resultMap="attRlrwImplResultMap">
  46. select <include refid="table_columns" /> from ATT_RLRW_IMPL <include refid="page_where" />
  47. </select>
  48. <select id="findAll" resultMap="attRlrwImplResultMap">
  49. select <include refid="table_columns" /> from ATT_RLRW_IMPL
  50. </select>
  51. <select id="findList" resultMap="attRlrwImplResultMap">
  52. select <include refid="table_columns" /> from ATT_RLRW_IMPL <include refid="page_where" />
  53. </select>
  54. <select id="selectCount" resultType="int" >
  55. select count(ID) from ATT_RLRW_IMPL <include refid="page_where" />
  56. </select>
  57. <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.AttRlrwImpl">
  58. insert into ATT_RLRW_IMPL( <include refid="table_columns" /> )
  59. values ( <include refid="entity_properties" /> )
  60. </insert>
  61. <delete id="delete" parameterType="java.lang.String">
  62. update ATT_RLRW_IMPL set DATA_STAT='9' where ID = #{id}
  63. </delete>
  64. <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.AttRlrwImpl">
  65. delete from ATT_RLRW_IMPL <include refid="page_where" />
  66. </delete>
  67. <update id="deleteInFlag" parameterType="java.lang.String">
  68. update ATT_RLRW_IMPL set flag_valid = 0 where ID = #{id}
  69. </update>
  70. <update id="update" parameterType="cn.com.goldenwater.dcproj.model.AttRlrwImpl">
  71. update ATT_RLRW_IMPL
  72. <trim prefix="set" suffixOverrides=",">
  73. <if test="landCode != null and landCode != ''">LAND_CODE = #{landCode},</if>
  74. <if test="returnYear != null and returnYear != ''">RETURN_YEAR = #{returnYear},</if>
  75. <if test="returnCount != null and returnCount != ''">RETURN_COUNT = #{returnCount},</if>
  76. <if test="returnArea != null and returnArea != ''">RETURN_AREA = #{returnArea},</if>
  77. <if test="intm != null">INTM = #{intm},</if>
  78. <if test="remark != null and remark != ''">REMARK = #{remark},</if>
  79. </trim>
  80. <where>ID = #{id}</where>
  81. </update>
  82. <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.AttRlrwImpl">
  83. update ATT_RLRW_IMPL
  84. <trim prefix="set" suffixOverrides=",">
  85. <if test="landCode != null and landCode != ''">LAND_CODE = #{landCode},</if>
  86. <if test="returnYear != null and returnYear != ''">RETURN_YEAR = #{returnYear},</if>
  87. <if test="returnCount != null and returnCount != ''">RETURN_COUNT = #{returnCount},</if>
  88. <if test="returnArea != null and returnArea != ''">RETURN_AREA = #{returnArea},</if>
  89. <if test="intm != null">INTM = #{intm},</if>
  90. <if test="remark != null and remark != ''">REMARK = #{remark},</if>
  91. </trim>
  92. <include refid="page_where" />
  93. </update>
  94. <!-- 其他自定义SQL -->
  95. <select id="getReturnLandInfo" resultType="String" parameterType="String" >
  96. select concat('历年退地:',sum(return_area),'亩') remark from
  97. (select land_code,return_year,max(return_count) return_count
  98. from ATT_RLRW_IMPL where return_year &lt; DATE_FORMAT(sysdate,'%Y') and land_code=#{landcode}
  99. group by land_code,return_year) a left join ATT_RLRW_IMPL b
  100. on a.land_code=b.land_code and a.return_year=b.return_year and a.return_count=b.return_count
  101. group by a.land_code
  102. union all
  103. select * from
  104. (select concat('截止第',return_count,'轮督查退地:',return_area,'亩') remark
  105. from ATT_RLRW_IMPL where return_year=DATE_FORMAT(sysdate,'%Y') and land_code=#{landcode}
  106. order by return_count) c
  107. </select>
  108. </mapper>