<?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.resident.ResidentQuotaMapper">
    <resultMap id="BaseResultMap" type="cn.com.countrygarden.bi.main.model.resident.ResidentQuota">
        <!--
          WARNING - @mbg.generated
        -->
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="year" jdbcType="INTEGER" property="year"/>
        <result column="organ_id" jdbcType="VARCHAR" property="organId"/>
        <result column="organ_name" jdbcType="VARCHAR" property="organName"/>
        <result column="total" jdbcType="DECIMAL" property="total"/>
        <result column="gross" jdbcType="DECIMAL" property="gross"/>
        <result column="house" jdbcType="DECIMAL" property="house"/>
        <result column="arena" jdbcType="DECIMAL" property="arena"/>
        <result column="group_buying" jdbcType="DECIMAL" property="groupBuying"/>
        <result column="tourism" jdbcType="DECIMAL" property="tourism"/>
        <result column="car_service" jdbcType="DECIMAL" property="carService"/>
        <result column="short_rent" jdbcType="DECIMAL" property="shortRent"/>
        <result column="insurance" jdbcType="DECIMAL" property="insurance"/>
        <result column="media" jdbcType="DECIMAL" property="media"/>
        <result column="other" jdbcType="DECIMAL" property="other"/>
        <result column="is_deleted" jdbcType="BIT" property="isDeleted"/>
        <result column="gmt_create" jdbcType="TIMESTAMP" property="gmtCreate"/>
        <result column="created_by" jdbcType="VARCHAR" property="createdBy"/>
        <result column="gmt_modified" jdbcType="TIMESTAMP" property="gmtModified"/>
        <result column="modified_by" jdbcType="VARCHAR" property="modifiedBy"/>
    </resultMap>

    <select id="search" resultMap="BaseResultMap">
        <![CDATA[
        SELECT * FROM resident_quota AS q
        ]]>
        <where>
            <if test="year != null">
                <![CDATA[
                  AND q.year = #{year}
                ]]>
            </if>
            <if test="1 == 1">
                <![CDATA[
                  AND q.is_deleted = 0
                ]]>
            </if>
        </where>
    </select>
</mapper>