<?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.countrygarden.bi.main.dao.bigholderAduit.BigholderLandEstateMapper">
	<resultMap type="cn.com.countrygarden.bi.main.model.BigholderLandEstate"
		id="BigholderLandEstateMap">
		<id column="id" jdbcType="INTEGER" property="id" />
		<result column="land_area" jdbcType="VARCHAR" property="landArea" />
		<result column="estate_area" jdbcType="VARCHAR" property="estateArea" />
		<result column="a2" jdbcType="VARCHAR" property="a2" />
		<result column="a3" jdbcType="INTEGER" property="a3" />
		<result column="a4" jdbcType="INTEGER" property="a4" />
		<result column="a8" jdbcType="INTEGER" property="a8" />
		<result column="a9" jdbcType="INTEGER" property="a9" />
		<result column="a10" jdbcType="INTEGER" property="a10" />
		<result column="a11" jdbcType="VARCHAR" property="a11" />
		<result column="a12" jdbcType="VARCHAR" property="a12" />
		<result column="create_by" jdbcType="VARCHAR" property="createBy" />
		<result column="last_update_by" jdbcType="VARCHAR" property="lastUpdateBy" />
		<result column="create_date" jdbcType="TIMESTAMP" property="createDate" />
		<result column="last_update_date" jdbcType="TIMESTAMP"
			property="lastUpdateDate" />
	</resultMap>

	<select id="selectLandEstatebyYearArea" parameterType="Map"
		resultMap="BigholderLandEstateMap">
		select * from bigholder_land_estate as b where 1=1
		<if test="area!=null">
			and b.estate_area=#{area}
		</if>
		and DATE_FORMAT(b.create_date,'%Y') IN 
		<foreach item="item" index="index" collection="year"
			open="(" separator="," close=")">
			#{item}
		</foreach>
	</select>
	
	<!-- <select id="selectLandEstatebyArea" parameterType="Map"
		resultMap="BigholderLandEstateMap">
		select * from bigholder_land_estate as b where 1=1
		<if test="area!=null">
			and b.estate_area=#{area}
		</if>
		and DATE_FORMAT(b.create_date,'%Y') IN 
		<foreach item="item" index="index" collection="year"
			open="(" separator="," close=")">
			#{item}
		</foreach>
	</select> -->
	
	<select id="selectLandEstatebyMonArea" parameterType="Map"
		resultMap="BigholderLandEstateMap">
		select * from bigholder_land_estate as b where 1=1
		<if test="area!=null">
			and b.estate_area=#{area}
		</if>
		and DATE_FORMAT(b.create_date,'%Y-%m') IN 
		<foreach item="item" index="index" collection="yearMonth"
			open="(" separator="," close=")">
			#{item}
		</foreach>
		order by b.land_area desc
	</select>

	<select id="getLandEstatebyAreaOrYear" parameterType="Map"
		resultMap="BigholderLandEstateMap">
		select * from bigholder_land_estate as b where 1=1
		<if test="area!=null">
			and b.estate_area=#{area}
		</if>
		and DATE_FORMAT(b.create_date,'%Y') IN
		<foreach item="item" index="index" collection="yearMonth"
			open="(" separator="," close=")">
			#{item}
		</foreach>
	</select>

	<select id="getLandEstatebyAreaOrYearMon" parameterType="Map"
		resultMap="BigholderLandEstateMap">
		select * from bigholder_land_estate as b where 1=1
		<if test="area!=null">
			and b.estate_area=#{area}
		</if>
		and DATE_FORMAT(b.create_date,'%Y-%m') IN
		<foreach item="item" index="index" collection="yearMonth"
			open="(" separator="," close=")">
			#{item}
		</foreach>
	</select>

</mapper>