<?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="com.ygtx.gxt.mapper.GxtMonthScoreLogMapper">

    <resultMap type="GxtMonthScoreLog" id="GxtMonthScoreLogResult">
        <result property="id" column="id"/>
        <result property="monthScoreId" column="month_score_id"/>
        <result property="operator" column="operator"/>
        <result property="previousStatus" column="previous_status"/>
        <result property="presentStatus" column="present_status"/>
        <result property="monthPeriod" column="month_period"/>
        <result property="deptId" column="dept_id"/>
        <result property="status" column="status"/>
        <result property="explainCode" column="explain_code"/>
        <result property="feedbackContent" column="feedback_content"/>
        <result property="feedbackStatus" column="feedback_status"/>
        <result property="createBy" column="create_by"/>
        <result property="createTime" column="create_time"/>
        <result property="updateBy" column="update_by"/>
        <result property="updateTime" column="update_time"/>
        <result property="remark" column="remark"/>
    </resultMap>

    <sql id="selectGxtMonthScoreLogVo">
        select id, month_score_id, operator, previous_status, present_status, month_period, dept_id, status, explain_code, feedback_content, feedback_status, create_by, create_time, update_by, update_time, remark from gxt_month_score_log
    </sql>

    <select id="selectGxtMonthScoreLogList" parameterType="GxtMonthScoreLog" resultMap="GxtMonthScoreLogResult">
        <include refid="selectGxtMonthScoreLogVo"/>
        <where>
            <if test="monthScoreId != null "> and month_score_id = #{monthScoreId}</if>
            <if test="operator != null "> and operator = #{operator}</if>
            <if test="previousStatus != null "> and previous_status = #{previousStatus}</if>
            <if test="presentStatus != null "> and present_status = #{presentStatus}</if>
            <if test="monthPeriod != null  and monthPeriod != ''"> and month_period = #{monthPeriod}</if>
            <if test="deptId != null "> and dept_id = #{deptId}</if>
            <if test="status != null "> and status = #{status}</if>
            <if test="explainCode != null  and explainCode != ''"> and explain_code = #{explainCode}</if>
            <if test="feedbackContent != null  and feedbackContent != ''"> and feedback_content = #{feedbackContent}</if>
            <if test="feedbackStatus != null "> and feedback_status = #{feedbackStatus}</if>
            <if test="createBy != null  and createBy != ''"> and create_by = #{createBy}</if>
            <if test="params.beginCreateTime != null and params.beginCreateTime != ''"> and create_time &gt;= #{params.beginCreateTime}</if>
            <if test="params.endCreateTime != null and params.endCreateTime != ''"> and create_time &lt;= #{params.endCreateTime}</if>
            <if test="updateBy != null  and updateBy != ''"> and update_by = #{updateBy}</if>
            <if test="params.beginUpdateTime != null and params.beginUpdateTime != ''"> and update_time &gt;= #{params.beginUpdateTime}</if>
            <if test="params.endUpdateTime != null and params.endUpdateTime != ''"> and update_time &lt;= #{params.endUpdateTime}</if>
            <if test="remark != null  and remark != ''"> and remark = #{remark}</if>
        </where>
    </select>

    <select id="selectGxtMonthScoreLogById" parameterType="Long" resultMap="GxtMonthScoreLogResult">
        <include refid="selectGxtMonthScoreLogVo"/>
        where id = #{id}
    </select>

    <insert id="insertGxtMonthScoreLog" parameterType="GxtMonthScoreLog" useGeneratedKeys="true" keyProperty="id">
        insert into gxt_month_score_log
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="monthScoreId != null">month_score_id,</if>
            <if test="operator != null">operator,</if>
            <if test="previousStatus != null">previous_status,</if>
            <if test="presentStatus != null">present_status,</if>
            <if test="monthPeriod != null and monthPeriod != ''">month_period,</if>
            <if test="deptId != null">dept_id,</if>
            <if test="status != null">status,</if>
            <if test="explainCode != null and explainCode != ''">explain_code,</if>
            <if test="feedbackContent != null and feedbackContent != ''">feedback_content,</if>
            <if test="feedbackStatus != null">feedback_status,</if>
            <if test="createBy != null and createBy != ''">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null and updateBy != ''">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remark != null">remark,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="monthScoreId != null">#{monthScoreId},</if>
            <if test="operator != null">#{operator},</if>
            <if test="previousStatus != null">#{previousStatus},</if>
            <if test="presentStatus != null">#{presentStatus},</if>
            <if test="monthPeriod != null and monthPeriod != ''">#{monthPeriod},</if>
            <if test="deptId != null">#{deptId},</if>
            <if test="status != null">#{status},</if>
            <if test="explainCode != null and explainCode != ''">#{explainCode},</if>
            <if test="feedbackContent != null and feedbackContent != ''">#{feedbackContent},</if>
            <if test="feedbackStatus != null">#{feedbackStatus},</if>
            <if test="createBy != null and createBy != ''">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null and updateBy != ''">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remark != null">#{remark},</if>
         </trim>
    </insert>

    <update id="updateGxtMonthScoreLog" parameterType="GxtMonthScoreLog">
        update gxt_month_score_log
        <trim prefix="SET" suffixOverrides=",">
            <if test="monthScoreId != null">month_score_id = #{monthScoreId},</if>
            <if test="operator != null">operator = #{operator},</if>
            <if test="previousStatus != null">previous_status = #{previousStatus},</if>
            <if test="presentStatus != null">present_status = #{presentStatus},</if>
            <if test="monthPeriod != null and monthPeriod != ''">month_period = #{monthPeriod},</if>
            <if test="deptId != null">dept_id = #{deptId},</if>
            <if test="status != null">status = #{status},</if>
            <if test="explainCode != null and explainCode != ''">explain_code = #{explainCode},</if>
            <if test="feedbackContent != null and feedbackContent != ''">feedback_content = #{feedbackContent},</if>
            <if test="feedbackStatus != null">feedback_status = #{feedbackStatus},</if>
            <if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="remark != null">remark = #{remark},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteGxtMonthScoreLogById" parameterType="Long">
        delete from gxt_month_score_log where id = #{id}
    </delete>

    <delete id="deleteGxtMonthScoreLogByIds" parameterType="Long">
        delete from gxt_month_score_log where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>

</mapper>