<?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.srs.teacher.mapper.SysTeacherKpiFillingGraduationGuidanceMapper">

    <resultMap type="SysTeacherKpiFillingGraduationGuidance" id="SysTeacherKpiFillingGraduationGuidanceResult">
        <result property="id" column="id"/>
        <result property="gradFormAuditScoring" column="grad_form_audit_scoring"/>
        <result property="stuCareerConsultScoring" column="stu_career_consult_scoring"/>
        <result property="gradFormGuidanceScoring" column="grad_form_guidance_scoring"/>
        <result property="fdyName" column="fdy_name"/>
        <result property="fillingYear" column="filling_year"/>
        <result property="fillingMonth" column="filling_month"/>
        <result property="classType" column="class_type"/>
    </resultMap>

    <sql id="selectSysTeacherKpiFillingGraduationGuidanceVo">
        select id, grad_form_audit_scoring, stu_career_consult_scoring, grad_form_guidance_scoring, fdy_name, filling_year, filling_month, class_type
        from sys_teacher_kpi_filling_graduation_guidance
    </sql>

    <select id="selectSysTeacherKpiFillingGraduationGuidanceList" parameterType="SysTeacherKpiFillingGraduationGuidance"
            resultMap="SysTeacherKpiFillingGraduationGuidanceResult">
        <include refid="selectSysTeacherKpiFillingGraduationGuidanceVo"/>
        <where>
            <if test="gradFormAuditScoring != null ">and grad_form_audit_scoring = #{gradFormAuditScoring}</if>
            <if test="stuCareerConsultScoring != null ">and stu_career_consult_scoring = #{stuCareerConsultScoring}</if>
            <if test="gradFormGuidanceScoring != null ">and grad_form_guidance_scoring = #{gradFormGuidanceScoring}</if>
            <if test="fdyName != null  and fdyName != ''">and fdy_name like concat('%', #{fdyName}, '%')</if>
            <if test="fillingYear != null  and fillingYear != ''">and filling_year = #{fillingYear}</if>
            <if test="fillingMonth != null  and fillingMonth != ''">and filling_month = #{fillingMonth}</if>
            <if test="classType != null  and classType != ''">and class_type = #{classType}</if>
        </where>
        order by id desc
    </select>

    <!--根据名称、年份、月份查询-->
    <select id="selectSysTeacherKpiFillingGraduationGuidanceByFdyName" parameterType="String"
            resultMap="SysTeacherKpiFillingGraduationGuidanceResult">
        <include refid="selectSysTeacherKpiFillingGraduationGuidanceVo"/>
        <where>
            <if test="fdyName != null and fdyName != ''">
                and fdy_name = #{fdyName}
            </if>
            <if test="fillingYear != null and fillingYear != ''">
                and filling_year = #{fillingYear}
            </if>
            <if test="fillingMonth != null and fillingMonth != ''">
                and filling_month = #{fillingMonth}
            </if>
            <if test="classType != null and classType != ''">
                and class_type = #{classType}
            </if>
        </where>
        order by id desc
    </select>

    <select id="selectSysTeacherKpiFillingGraduationGuidanceById" parameterType="Long" resultMap="SysTeacherKpiFillingGraduationGuidanceResult">
        <include refid="selectSysTeacherKpiFillingGraduationGuidanceVo"/>
        where id = #{id}
    </select>

    <insert id="insertSysTeacherKpiFillingGraduationGuidance" parameterType="SysTeacherKpiFillingGraduationGuidance">
        insert into sys_teacher_kpi_filling_graduation_guidance
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="gradFormAuditScoring != null">grad_form_audit_scoring,</if>
            <if test="stuCareerConsultScoring != null">stu_career_consult_scoring,</if>
            <if test="gradFormGuidanceScoring != null">grad_form_guidance_scoring,</if>
            <if test="fdyName != null and fdyName != ''">fdy_name,</if>
            <if test="fillingYear != null and fillingYear != ''">filling_year,</if>
            <if test="fillingMonth != null and fillingMonth != ''">filling_month,</if>
            <if test="classType != null and classType != ''">class_type,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="gradFormAuditScoring != null">#{gradFormAuditScoring},</if>
            <if test="stuCareerConsultScoring != null">#{stuCareerConsultScoring},</if>
            <if test="gradFormGuidanceScoring != null">#{gradFormGuidanceScoring},</if>
            <if test="fdyName != null and fdyName != ''">#{fdyName},</if>
            <if test="fillingYear != null and fillingYear != ''">#{fillingYear},</if>
            <if test="fillingMonth != null and fillingMonth != ''">#{fillingMonth},</if>
            <if test="classType != null and classType != ''">#{classType},</if>
        </trim>
    </insert>

    <update id="updateSysTeacherKpiFillingGraduationGuidance" parameterType="SysTeacherKpiFillingGraduationGuidance">
        update sys_teacher_kpi_filling_graduation_guidance
        <trim prefix="SET" suffixOverrides=",">
            <if test="gradFormAuditScoring != null">grad_form_audit_scoring = #{gradFormAuditScoring},</if>
            <if test="stuCareerConsultScoring != null">stu_career_consult_scoring = #{stuCareerConsultScoring},</if>
            <if test="gradFormGuidanceScoring != null">grad_form_guidance_scoring = #{gradFormGuidanceScoring},</if>
            <if test="fdyName != null and fdyName != ''">fdy_name = #{fdyName},</if>
            <if test="fillingYear != null and fillingYear != ''">filling_year = #{fillingYear},</if>
            <if test="fillingMonth != null and fillingMonth != ''">filling_month = #{fillingMonth},</if>
            <if test="classType != null and classType != ''">class_type = #{classType},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteSysTeacherKpiFillingGraduationGuidanceById" parameterType="Long">
        delete
        from sys_teacher_kpi_filling_graduation_guidance
        where id = #{id}
    </delete>

    <delete id="deleteSysTeacherKpiFillingGraduationGuidanceByIds" parameterType="String">
        delete from sys_teacher_kpi_filling_graduation_guidance where id in
        <foreach item="id" collection="array" open="(" separator="," close=")">
            #{id}
        </foreach>
    </delete>
</mapper>
