<?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.api.manage.dao.operationManagement.SysInterviewDao">

    <select id="list" parameterType="com.api.model.operationManagement.SearchInterview" resultType="com.api.vo.operationManagement.VoInterview">
        select si.*,su1.actual_name as interviewers_name,su2.actual_name as create_name
        from sys_interview as si,sys_user as su1,sys_user as su2
        <where>
            si.interviewers = su1.id
            and si.create_id = su2.id
            and si.is_delete = 1
            <if test="tel != null and tel != ''">
                and si.tel like concat('%',#{tel},'%')
            </if>
            <if test="status != null">
                and si.status = #{status}
            </if>
        </where>
        order by si.create_date desc
    </select>

    <insert id="insert" parameterType="com.api.model.operationManagement.SearchInterview">
        insert into sys_interview(
            name,
            tel,
            interviewers,
            content,
            status,
            interview_date,
            create_id,
            create_date,
            is_delete
        )values (
            #{name},
            #{tel},
            #{interviewers},
            #{content},
            #{status},
            #{interviewDate},
            #{createId},
            #{createDate},
            #{isDelete}
        )
    </insert>

    <update id="delete" parameterType="java.lang.Integer">
        update sys_interview
        set is_delete = 0
        where id = #{d}
    </update>

</mapper>