<?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.ruoyi.system.mapper.InterviewTableMapper">
    
    <resultMap type="InterviewTable" id="InterviewTableResult">
        <result property="interviewId"    column="interview_id"    />
        <result property="equipmentId"    column="equipment_id"    />
        <result property="interviewTime"    column="interview_time"    />
        <result property="year"    column="year"    />
        <result property="month"    column="month"    />
        <result property="day"    column="day"    />
        <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="selectInterviewTableVo">
        select interview_id, equipment_id, interview_time, year, month, day, create_by, create_time, update_by, update_time, remark from interview_table
    </sql>

    <select id="selectInterviewTableList" parameterType="InterviewTable" resultMap="InterviewTableResult">
        <include refid="selectInterviewTableVo"/>
        <where>  
            <if test="equipmentId != null  and equipmentId != ''"> and equipment_id = #{equipmentId}</if>
            <if test="interviewTime != null  and interviewTime != ''"> and interview_time = #{interviewTime}</if>
            <if test="year != null  and year != ''"> and year = #{year}</if>
            <if test="month != null  and month != ''"> and month = #{month}</if>
            <if test="day != null  and day != ''"> and day = #{day}</if>
        </where>
    </select>
    
    <select id="selectInterviewTableByInterviewId" parameterType="Long" resultMap="InterviewTableResult">
        <include refid="selectInterviewTableVo"/>
        where interview_id = #{interviewId}
    </select>
        
    <insert id="insertInterviewTable" parameterType="InterviewTable" useGeneratedKeys="true" keyProperty="interviewId">
        insert into interview_table
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="equipmentId != null">equipment_id,</if>
            <if test="interviewTime != null">interview_time,</if>
            <if test="year != null">year,</if>
            <if test="month != null">month,</if>
            <if test="day != null">day,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remark != null">remark,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="equipmentId != null">#{equipmentId},</if>
            <if test="interviewTime != null">#{interviewTime},</if>
            <if test="year != null">#{year},</if>
            <if test="month != null">#{month},</if>
            <if test="day != null">#{day},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remark != null">#{remark},</if>
         </trim>
    </insert>

    <update id="updateInterviewTable" parameterType="InterviewTable">
        update interview_table
        <trim prefix="SET" suffixOverrides=",">
            <if test="equipmentId != null">equipment_id = #{equipmentId},</if>
            <if test="interviewTime != null">interview_time = #{interviewTime},</if>
            <if test="year != null">year = #{year},</if>
            <if test="month != null">month = #{month},</if>
            <if test="day != null">day = #{day},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="remark != null">remark = #{remark},</if>
        </trim>
        where interview_id = #{interviewId}
    </update>

    <delete id="deleteInterviewTableByInterviewId" parameterType="Long">
        delete from interview_table where interview_id = #{interviewId}
    </delete>

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