<?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.performance.PerformanceWeightMapper">
    <resultMap id="BaseResultMap" type="cn.com.countrygarden.bi.main.model.performance.PerformanceWeight">
        <constructor>
            <idArg column="weight_id" javaType="java.lang.Long" jdbcType="BIGINT"/>
            <arg column="element_id" javaType="java.lang.Long" jdbcType="BIGINT"/>
            <arg column="type" javaType="java.lang.String" jdbcType="VARCHAR"/>
            <arg column="weight" javaType="java.lang.Double" jdbcType="DOUBLE"/>
            <arg column="frequency" javaType="java.lang.String" jdbcType="VARCHAR"/>
            <arg column="year" javaType="java.lang.Integer" jdbcType="INTEGER"/>
            <arg column="quarterly" javaType="java.lang.Integer" jdbcType="INTEGER"/>
            <arg column="is_delete" javaType="java.lang.Short" jdbcType="SMALLINT"/>
            <arg column="created_date" javaType="java.util.Date" jdbcType="TIMESTAMP"/>
            <arg column="created_by" javaType="java.lang.String" jdbcType="VARCHAR"/>
            <arg column="update_date" javaType="java.util.Date" jdbcType="TIMESTAMP"/>
            <arg column="update_by" javaType="java.lang.String" jdbcType="VARCHAR"/>
        </constructor>
    </resultMap>

    <sql id="Base_Column_List">
        weight_id, element_id, type, weight, frequency, year, quarterly, is_delete, created_date,
        created_by, update_date, update_by
    </sql>

    <select id="selectByPrimaryKey" parameterType="java.lang.Long" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from performance_weight
        where weight_id = #{weightId,jdbcType=BIGINT}
    </select>

    <delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
        delete from performance_weight
        where weight_id = #{weightId,jdbcType=BIGINT}
    </delete>

    <insert id="insertSelective" parameterType="PerformanceWeight">
        insert into performance_weight
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="weightId != null">
                weight_id,
            </if>
            <if test="elementId != null">
                element_id,
            </if>
            <if test="type != null">
                type,
            </if>
            <if test="weight != null">
                weight,
            </if>
            <if test="frequency != null">
                frequency,
            </if>
            <if test="year != null">
                year,
            </if>
            <if test="quarterly != null">
                quarterly,
            </if>
            <if test="isDelete != null">
                is_delete,
            </if>
            <if test="createdDate != null">
                created_date,
            </if>
            <if test="createdBy != null">
                created_by,
            </if>
            <if test="updateDate != null">
                update_date,
            </if>
            <if test="updateBy != null">
                update_by,
            </if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="weightId != null">
                #{weightId,jdbcType=BIGINT},
            </if>
            <if test="elementId != null">
                #{elementId,jdbcType=BIGINT},
            </if>
            <if test="type != null">
                #{type,jdbcType=VARCHAR},
            </if>
            <if test="weight != null">
                #{weight,jdbcType=DOUBLE},
            </if>
            <if test="frequency != null">
                #{frequency,jdbcType=VARCHAR},
            </if>
            <if test="year != null">
                #{year,jdbcType=INTEGER},
            </if>
            <if test="quarterly != null">
                #{quarterly,jdbcType=INTEGER},
            </if>
            <if test="isDelete != null">
                #{isDelete,jdbcType=SMALLINT},
            </if>
            <if test="createdDate != null">
                #{createdDate,jdbcType=TIMESTAMP},
            </if>
            <if test="createdBy != null">
                #{createdBy,jdbcType=VARCHAR},
            </if>
            <if test="updateDate != null">
                #{updateDate,jdbcType=TIMESTAMP},
            </if>
            <if test="updateBy != null">
                #{updateBy,jdbcType=VARCHAR},
            </if>
        </trim>
    </insert>

    <update id="updateByPrimaryKeySelective"
            parameterType="PerformanceWeight">
        update performance_weight
        <set>
            <if test="elementId != null">
                element_id = #{elementId,jdbcType=BIGINT},
            </if>
            <if test="type != null">
                type = #{type,jdbcType=VARCHAR},
            </if>
            <if test="weight != null">
                weight = #{weight,jdbcType=DOUBLE},
            </if>
            <if test="frequency != null">
                frequency = #{frequency,jdbcType=VARCHAR},
            </if>
            <if test="year != null">
                year = #{year,jdbcType=INTEGER},
            </if>
            <if test="quarterly != null">
                quarterly = #{quarterly,jdbcType=INTEGER},
            </if>
            <if test="isDelete != null">
                is_delete = #{isDelete,jdbcType=SMALLINT},
            </if>
            <if test="createdDate != null">
                created_date = #{createdDate,jdbcType=TIMESTAMP},
            </if>
            <if test="createdBy != null">
                created_by = #{createdBy,jdbcType=VARCHAR},
            </if>
            <if test="updateDate != null">
                update_date = #{updateDate,jdbcType=TIMESTAMP},
            </if>
            <if test="updateBy != null">
                update_by = #{updateBy,jdbcType=VARCHAR},
            </if>
        </set>
        where weight_id = #{weightId,jdbcType=BIGINT}
    </update>

    <select id="getSelective" parameterType="PerformanceWeight" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from performance_weight
        where 1=1
        <if test="elementId != null">
            and element_id = #{elementId,jdbcType=BIGINT}
        </if>
        <if test="type != null">
            and type = #{type,jdbcType=VARCHAR}
        </if>
        <if test="weight != null">
            and weight = #{weight,jdbcType=DOUBLE}
        </if>
        <if test="frequency != null">
            and frequency = #{frequency,jdbcType=VARCHAR}
        </if>
        <if test="year != null">
            and year = #{year,jdbcType=INTEGER}
        </if>
        <if test="quarterly != null">
            and quarterly = #{quarterly,jdbcType=INTEGER}
        </if>
        <if test="isDelete != null">
            and is_delete = #{isDelete,jdbcType=SMALLINT}
        </if>
        <if test="createdDate != null">
            and created_date = #{createdDate,jdbcType=TIMESTAMP}
        </if>
        <if test="createdBy != null">
            and created_by = #{createdBy,jdbcType=VARCHAR}
        </if>
        <if test="updateDate != null">
            and update_date = #{updateDate,jdbcType=TIMESTAMP}
        </if>
        <if test="updateBy != null">
            and update_by = #{updateBy,jdbcType=VARCHAR}
        </if>
    </select>
</mapper>