| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127 |
- <?xml version="1.0" encoding="UTF-8" ?>
- <!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
- <mapper namespace="cn.com.goldenwater.dcproj.dao.AttRlrwImplDao">
- <resultMap type="cn.com.goldenwater.dcproj.model.AttRlrwImpl" id="attRlrwImplResultMap">
- <result property="id" column="ID"/>
- <result property="landCode" column="LAND_CODE"/>
- <result property="returnYear" column="RETURN_YEAR"/>
- <result property="returnCount" column="RETURN_COUNT"/>
- <result property="returnArea" column="RETURN_AREA"/>
- <result property="intm" column="INTM"/>
- <result property="remark" column="REMARK"/>
- </resultMap>
-
- <sql id="table_columns">
- ID,
- LAND_CODE,
- RETURN_YEAR,
- RETURN_COUNT,
- RETURN_AREA,
- INTM,
- REMARK
- </sql>
- <sql id="entity_properties">
- #{id},
- #{landCode},
- #{returnYear},
- #{returnCount},
- #{returnArea},
- #{intm},
- #{remark}
- </sql>
- <!-- 使用like用法:columnName like concat('%',#columnName#,'%') -->
- <sql id="page_where">
- <trim prefix="where" prefixOverrides="and | or ">
- <if test="landCode != null and landCode != ''">and LAND_CODE = #{landCode}</if>
- <if test="returnYear != null and returnYear != ''">and RETURN_YEAR = #{returnYear}</if>
- <if test="returnCount != null and returnCount != ''">and RETURN_COUNT = #{returnCount}</if>
- <if test="returnArea != null and returnArea != ''">and RETURN_AREA = #{returnArea}</if>
- <if test="intm != null">and INTM = #{intm}</if>
- <if test="remark != null and remark != ''">and REMARK = #{remark}</if>
- </trim>
- </sql>
- <select id="get" resultMap="attRlrwImplResultMap" parameterType="String" >
- select <include refid="table_columns" /> from ATT_RLRW_IMPL where ID = #{id}
- </select>
- <select id="getBy" resultMap="attRlrwImplResultMap">
- select <include refid="table_columns" /> from ATT_RLRW_IMPL <include refid="page_where" />
- </select>
- <select id="findAll" resultMap="attRlrwImplResultMap">
- select <include refid="table_columns" /> from ATT_RLRW_IMPL
- </select>
- <select id="findList" resultMap="attRlrwImplResultMap">
- select <include refid="table_columns" /> from ATT_RLRW_IMPL <include refid="page_where" />
- </select>
- <select id="selectCount" resultType="int" >
- select count(ID) from ATT_RLRW_IMPL <include refid="page_where" />
- </select>
- <insert id="insert" parameterType="cn.com.goldenwater.dcproj.model.AttRlrwImpl">
- insert into ATT_RLRW_IMPL( <include refid="table_columns" /> )
- values ( <include refid="entity_properties" /> )
- </insert>
- <delete id="delete" parameterType="java.lang.String">
- update ATT_RLRW_IMPL set DATA_STAT='9' where ID = #{id}
- </delete>
- <delete id="deleteBy" parameterType="cn.com.goldenwater.dcproj.model.AttRlrwImpl">
- delete from ATT_RLRW_IMPL <include refid="page_where" />
- </delete>
- <update id="deleteInFlag" parameterType="java.lang.String">
- update ATT_RLRW_IMPL set flag_valid = 0 where ID = #{id}
- </update>
- <update id="update" parameterType="cn.com.goldenwater.dcproj.model.AttRlrwImpl">
- update ATT_RLRW_IMPL
- <trim prefix="set" suffixOverrides=",">
- <if test="landCode != null and landCode != ''">LAND_CODE = #{landCode},</if>
- <if test="returnYear != null and returnYear != ''">RETURN_YEAR = #{returnYear},</if>
- <if test="returnCount != null and returnCount != ''">RETURN_COUNT = #{returnCount},</if>
- <if test="returnArea != null and returnArea != ''">RETURN_AREA = #{returnArea},</if>
- <if test="intm != null">INTM = #{intm},</if>
- <if test="remark != null and remark != ''">REMARK = #{remark},</if>
- </trim>
- <where>ID = #{id}</where>
- </update>
- <update id="updateBy" parameterType="cn.com.goldenwater.dcproj.model.AttRlrwImpl">
- update ATT_RLRW_IMPL
- <trim prefix="set" suffixOverrides=",">
- <if test="landCode != null and landCode != ''">LAND_CODE = #{landCode},</if>
- <if test="returnYear != null and returnYear != ''">RETURN_YEAR = #{returnYear},</if>
- <if test="returnCount != null and returnCount != ''">RETURN_COUNT = #{returnCount},</if>
- <if test="returnArea != null and returnArea != ''">RETURN_AREA = #{returnArea},</if>
- <if test="intm != null">INTM = #{intm},</if>
- <if test="remark != null and remark != ''">REMARK = #{remark},</if>
- </trim>
- <include refid="page_where" />
- </update>
- <!-- 其他自定义SQL -->
- <select id="getReturnLandInfo" resultType="String" parameterType="String" >
- select '历年退地:'||sum(return_area)||'亩' remark from
- (select land_code,return_year,max(return_count) return_count
- from ATT_RLRW_IMPL where return_year < to_char(sysdate,'yyyy') and land_code=#{landcode}
- group by land_code,return_year) a left join ATT_RLRW_IMPL b
- on a.land_code=b.land_code and a.return_year=b.return_year and a.return_count=b.return_count
- group by a.land_code
- union all
- select * from
- (select '截止第'||return_count||'轮督查退地:'||return_area||'亩' remark
- from ATT_RLRW_IMPL where return_year=to_char(sysdate,'yyyy') and land_code=#{landcode}
- order by return_count)
- </select>
- </mapper>
|