<?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.SysTeacherAchievementcheckMapper">
    
    <resultMap type="SysTeacherAchievementcheck" id="SysTeacherAchievementcheckResult">
        <result property="checkId"    column="check_id"    />
        <result property="teacherId"    column="teacher_id"    />
        <result property="teacherName"    column="teacher_name"    />
        <result property="teacherCollege"    column="teacher_college"    />
        <result property="thesisTitle"    column="thesis_title"    />
        <result property="thesisPublication"    column="thesis_publication"    />
        <result property="researchName"    column="research_name"    />
        <result property="researchLevel"    column="research_level"    />
        <result property="workexampleName"    column="workexample_name"    />
        <result property="workexampleLevel"    column="workexample_level"    />
        <result property="guidanceProject"    column="guidance_project"    />
        <result property="guidanceAwardlevel"    column="guidance_awardLevel"    />
        <result property="contestProject"    column="contest_project"    />
        <result property="contestAwardlevel"    column="contest_awardLevel"    />
        <result property="honorName"    column="honor_name"    />
        <result property="honorLevel"    column="honor_level"    />
        <result property="checkStatus"    column="check_status"    />
        <result property="checkYear"    column="check_year"    />
        <result property="checkPerson"    column="check_person"    />
        <result property="thesisId"    column="thesis_id"    />
        <result property="researchId"    column="research_id"    />
        <result property="workexampleId"    column="workexample_id"    />
        <result property="guidanceId"    column="guidance_id"    />
        <result property="contestId"    column="contest_id"    />
        <result property="honorId"    column="honor_id"    />
        <result property="returnReason"    column="returnReason"    />
        <result property="submitTime"    column="submitTime"    />
        <result property="lastTime"    column="lastTime"    />
    </resultMap>

    <sql id="selectSysTeacherAchievementcheckVo">
        select check_id, teacher_id, teacher_name, teacher_college, thesis_title, thesis_publication, research_name, research_level, workexample_name, workexample_level, guidance_project, guidance_awardLevel, contest_project, contest_awardLevel, honor_name, honor_level, check_status, check_year, check_person, thesis_id, research_id, workexample_id, guidance_id, contest_id, honor_id, returnReason, submitTime, lastTime from sys_teacher_achievementcheck
    </sql>

    <select id="selectSysTeacherAchievementcheckList" parameterType="SysTeacherAchievementcheck" resultMap="SysTeacherAchievementcheckResult">
        <include refid="selectSysTeacherAchievementcheckVo"/>
        <where>  
            <if test="teacherId != null "> and teacher_id = #{teacherId}</if>
            <if test="teacherName != null  and teacherName != ''"> and teacher_name like concat('%', #{teacherName}, '%')</if>
            <if test="teacherCollege != null  and teacherCollege != ''"> and teacher_college = #{teacherCollege}</if>
            <if test="thesisTitle != null  and thesisTitle != ''"> and thesis_title = #{thesisTitle}</if>
            <if test="thesisPublication != null  and thesisPublication != ''"> and thesis_publication like concat('%', #{thesisPublication}, '%')</if>
            <if test="researchName != null  and researchName != ''"> and research_name like concat('%', #{researchName}, '%')</if>
            <if test="researchLevel != null  and researchLevel != ''"> and research_level = #{researchLevel}</if>
            <if test="workexampleName != null  and workexampleName != ''"> and workexample_name like concat('%', #{workexampleName}, '%')</if>
            <if test="workexampleLevel != null  and workexampleLevel != ''"> and workexample_level = #{workexampleLevel}</if>
            <if test="guidanceProject != null  and guidanceProject != ''"> and guidance_project = #{guidanceProject}</if>
            <if test="guidanceAwardlevel != null  and guidanceAwardlevel != ''"> and guidance_awardLevel = #{guidanceAwardlevel}</if>
            <if test="contestProject != null  and contestProject != ''"> and contest_project = #{contestProject}</if>
            <if test="contestAwardlevel != null  and contestAwardlevel != ''"> and contest_awardLevel = #{contestAwardlevel}</if>
            <if test="honorName != null  and honorName != ''"> and honor_name like concat('%', #{honorName}, '%')</if>
            <if test="honorLevel != null  and honorLevel != ''"> and honor_level = #{honorLevel}</if>
            <if test="checkStatus != null  and checkStatus != ''"> and check_status = #{checkStatus}</if>
            <if test="checkYear != null  and checkYear != ''"> and check_year = #{checkYear}</if>
            <if test="checkPerson != null  and checkPerson != ''"> and check_person = #{checkPerson}</if>
            <if test="thesisId != null "> and thesis_id = #{thesisId}</if>
            <if test="researchId != null "> and research_id = #{researchId}</if>
            <if test="workexampleId != null "> and workexample_id = #{workexampleId}</if>
            <if test="guidanceId != null "> and guidance_id = #{guidanceId}</if>
            <if test="contestId != null "> and contest_id = #{contestId}</if>
            <if test="honorId != null "> and honor_id = #{honorId}</if>
            <if test="returnReason != null  and returnReason != ''"> and returnReason = #{returnReason}</if>
            <if test="submitTime != null  and submitTime != ''"> and submitTime = #{submitTime}</if>
            <if test="lastTime != null  and lastTime != ''"> and lastTime = #{lastTime}</if>
        </where>
    </select>
    
    <select id="selectSysTeacherAchievementcheckByCheckId" parameterType="Long" resultMap="SysTeacherAchievementcheckResult">
        <include refid="selectSysTeacherAchievementcheckVo"/>
        where check_id = #{checkId}
    </select>
        
    <insert id="insertSysTeacherAchievementcheck" parameterType="SysTeacherAchievementcheck" useGeneratedKeys="true" keyProperty="checkId">
        insert into sys_teacher_achievementcheck
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="teacherId != null">teacher_id,</if>
            <if test="teacherName != null">teacher_name,</if>
            <if test="teacherCollege != null">teacher_college,</if>
            <if test="thesisTitle != null">thesis_title,</if>
            <if test="thesisPublication != null">thesis_publication,</if>
            <if test="researchName != null">research_name,</if>
            <if test="researchLevel != null">research_level,</if>
            <if test="workexampleName != null">workexample_name,</if>
            <if test="workexampleLevel != null">workexample_level,</if>
            <if test="guidanceProject != null">guidance_project,</if>
            <if test="guidanceAwardlevel != null">guidance_awardLevel,</if>
            <if test="contestProject != null">contest_project,</if>
            <if test="contestAwardlevel != null">contest_awardLevel,</if>
            <if test="honorName != null">honor_name,</if>
            <if test="honorLevel != null">honor_level,</if>
            <if test="checkStatus != null">check_status,</if>
            <if test="checkYear != null">check_year,</if>
            <if test="checkPerson != null">check_person,</if>
            <if test="thesisId != null">thesis_id,</if>
            <if test="researchId != null">research_id,</if>
            <if test="workexampleId != null">workexample_id,</if>
            <if test="guidanceId != null">guidance_id,</if>
            <if test="contestId != null">contest_id,</if>
            <if test="honorId != null">honor_id,</if>
            <if test="returnReason != null">returnReason,</if>
            <if test="submitTime != null">submitTime,</if>
            <if test="lastTime != null">lastTime,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="teacherId != null">#{teacherId},</if>
            <if test="teacherName != null">#{teacherName},</if>
            <if test="teacherCollege != null">#{teacherCollege},</if>
            <if test="thesisTitle != null">#{thesisTitle},</if>
            <if test="thesisPublication != null">#{thesisPublication},</if>
            <if test="researchName != null">#{researchName},</if>
            <if test="researchLevel != null">#{researchLevel},</if>
            <if test="workexampleName != null">#{workexampleName},</if>
            <if test="workexampleLevel != null">#{workexampleLevel},</if>
            <if test="guidanceProject != null">#{guidanceProject},</if>
            <if test="guidanceAwardlevel != null">#{guidanceAwardlevel},</if>
            <if test="contestProject != null">#{contestProject},</if>
            <if test="contestAwardlevel != null">#{contestAwardlevel},</if>
            <if test="honorName != null">#{honorName},</if>
            <if test="honorLevel != null">#{honorLevel},</if>
            <if test="checkStatus != null">#{checkStatus},</if>
            <if test="checkYear != null">#{checkYear},</if>
            <if test="checkPerson != null">#{checkPerson},</if>
            <if test="thesisId != null">#{thesisId},</if>
            <if test="researchId != null">#{researchId},</if>
            <if test="workexampleId != null">#{workexampleId},</if>
            <if test="guidanceId != null">#{guidanceId},</if>
            <if test="contestId != null">#{contestId},</if>
            <if test="honorId != null">#{honorId},</if>
            <if test="returnReason != null">#{returnReason},</if>
            <if test="submitTime != null">#{submitTime},</if>
            <if test="lastTime != null">#{lastTime},</if>
         </trim>
    </insert>

    <update id="updateSysTeacherAchievementcheck" parameterType="SysTeacherAchievementcheck">
        update sys_teacher_achievementcheck
        <trim prefix="SET" suffixOverrides=",">
            <if test="teacherId != null">teacher_id = #{teacherId},</if>
            <if test="teacherName != null">teacher_name = #{teacherName},</if>
            <if test="teacherCollege != null">teacher_college = #{teacherCollege},</if>
            <if test="thesisTitle != null">thesis_title = #{thesisTitle},</if>
            <if test="thesisPublication != null">thesis_publication = #{thesisPublication},</if>
            <if test="researchName != null">research_name = #{researchName},</if>
            <if test="researchLevel != null">research_level = #{researchLevel},</if>
            <if test="workexampleName != null">workexample_name = #{workexampleName},</if>
            <if test="workexampleLevel != null">workexample_level = #{workexampleLevel},</if>
            <if test="guidanceProject != null">guidance_project = #{guidanceProject},</if>
            <if test="guidanceAwardlevel != null">guidance_awardLevel = #{guidanceAwardlevel},</if>
            <if test="contestProject != null">contest_project = #{contestProject},</if>
            <if test="contestAwardlevel != null">contest_awardLevel = #{contestAwardlevel},</if>
            <if test="honorName != null">honor_name = #{honorName},</if>
            <if test="honorLevel != null">honor_level = #{honorLevel},</if>
            <if test="checkStatus != null">check_status = #{checkStatus},</if>
            <if test="checkYear != null">check_year = #{checkYear},</if>
            <if test="checkPerson != null">check_person = #{checkPerson},</if>
            <if test="thesisId != null">thesis_id = #{thesisId},</if>
            <if test="researchId != null">research_id = #{researchId},</if>
            <if test="workexampleId != null">workexample_id = #{workexampleId},</if>
            <if test="guidanceId != null">guidance_id = #{guidanceId},</if>
            <if test="contestId != null">contest_id = #{contestId},</if>
            <if test="honorId != null">honor_id = #{honorId},</if>
            <if test="returnReason != null">returnReason = #{returnReason},</if>
            <if test="submitTime != null">submitTime = #{submitTime},</if>
            <if test="lastTime != null">lastTime = #{lastTime},</if>
        </trim>
        where check_id = #{checkId}
    </update>

    <delete id="deleteSysTeacherAchievementcheckByCheckId" parameterType="Long">
        delete from sys_teacher_achievementcheck where check_id = #{checkId}
    </delete>
    <delete id="deleteSysTeacherAchievementcheckByteacherId" parameterType="Long">
        delete from sys_teacher_achievementcheck where teacher_id = #{teacherId}
    </delete>

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