<?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.postCheck.mapper.PostProgrammeMapper">

    <resultMap type="PostProgramme" id="PostProgrammeResult">
        <result property="id"    column="id"    />
        <result property="name"    column="name"    />
        <result property="submitDate"    column="submit_date"    />
        <result property="statusHr"    column="status_hr"    />
        <result property="dateHr"    column="date_hr"    />
        <result property="reasonHr"    column="reason_hr"    />
        <result property="statusIcfa"    column="status_icfa"    />
        <result property="dateIcfa"    column="date_icfa"    />
        <result property="reasonIcfa"    column="reason_icfa"    />
        <result property="remark"    column="remark"    />
        <result property="delFlag"    column="del_flag"    />
        <result property="createTime"    column="create_time"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="createUserId"    column="create_user_id"    />
        <result property="diskPath"    column="disk_path"    />
        <result property="deptId"    column="dept_id"    />
        <result property="deptName"    column="dept_name"    />
        <result property="status"    column="status"    />
        <result property="statusTime"    column="status_time"    />
        <result property="statusUserId"    column="status_user_id"    />
        <result property="statusIcfaUserId"    column="status_icfa_user_id"    />
        <result property="statusHrUserId"    column="status_hr_user_id"    />
    </resultMap>

    <sql id="selectPostProgrammeVo">
        select
            t1.id,
            t1.name,
            t1.submit_date,
            t1.status_hr,
            t1.date_hr,
            t1.reason_hr,
            t1.status_icfa,
            t1.date_icfa,
            t1.reason_icfa,
            t1.remark,
            t1.del_flag,
            t1.create_time,
            t1.create_by,
            t1.update_time,
            t1.update_by,
            t1.create_user_id,
            t1.disk_path,
            t1.dept_id,
            t1.dept_name,
            t1.status,
            t1.status_time,
            t1.status_user_id,
            t1.status_icfa_user_id,
            t1.status_hr_user_id
        from post_programme t1
    </sql>

    <select id="selectPostProgrammeList" parameterType="PostProgramme" resultMap="PostProgrammeResult">
        <include refid="selectPostProgrammeVo"/>
        <where>
            <if test="name != null  and name != ''"> and name like concat('%', #{name}, '%')</if>
            <if test="submitDate != null  and submitDate != ''"> and submit_date = #{submitDate}</if>
            <if test="statusHr != null "> and status_hr = #{statusHr}</if>
            <if test="dateHr != null"> and date_hr = #{dateHr}</if>
            <if test="reasonHr != null  and reasonHr != ''"> and reason_hr = #{reasonHr}</if>
            <if test="statusIcfa != null "> and status_icfa = #{statusIcfa}</if>
            <if test="dateIcfa != null  and dateIcfa != ''"> and date_icfa = #{dateIcfa}</if>
            <if test="reasonIcfa != null  and reasonIcfa != ''"> and reason_icfa = #{reasonIcfa}</if>
            <if test="createUserId != null "> and create_user_id = #{createUserId}</if>
            <if test="diskPath != null  and diskPath != ''"> and disk_path = #{diskPath}</if>
            <if test="deptId != null "> and dept_id = #{deptId}</if>
            <if test="deptName != null  and deptName != ''"> and dept_name like concat('%', #{deptName}, '%')</if>
            <if test="status != null "> and status = #{status}</if>
            <if test="statusTime != null "> and status_time = #{statusTime}</if>
            <if test="statusUserId != null "> and status_user_id = #{statusUserId}</if>
            <if test="statusIcfaUserId != null "> and status_icfa_user_id = #{statusIcfaUserId}</if>
            <if test="statusHrUserId != null "> and status_hr_user_id = #{statusHrUserId}</if>
        </where>
    </select>

    <select id="selectPostProgrammeById" parameterType="Long" resultMap="PostProgrammeResult">
        <include refid="selectPostProgrammeVo"/>
        where id = #{id}
    </select>

    <insert id="insertPostProgramme" parameterType="PostProgramme">
        insert into post_programme
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="name != null">name,</if>
            <if test="submitDate != null">submit_date,</if>
            <if test="statusHr != null">status_hr,</if>
            <if test="dateHr != null">date_hr,</if>
            <if test="reasonHr != null">reason_hr,</if>
            <if test="statusIcfa != null">status_icfa,</if>
            <if test="dateIcfa != null">date_icfa,</if>
            <if test="reasonIcfa != null">reason_icfa,</if>
            <if test="remark != null">remark,</if>
            <if test="delFlag != null and delFlag != ''">del_flag,</if>
            <if test="createTime != null">create_time,</if>
            <if test="createBy != null and createBy != ''">create_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="updateBy != null and updateBy != ''">update_by,</if>
            <if test="createUserId != null">create_user_id,</if>
            <if test="diskPath != null and diskPath != ''">disk_path,</if>
            <if test="deptId != null">dept_id,</if>
            <if test="deptName != null">dept_name,</if>
            <if test="status != null">status,</if>
            <if test="statusTime != null">status_time,</if>
            <if test="statusUserId != null">status_user_id,</if>
            <if test="statusIcfaUserId != null">status_icfa_user_id,</if>
            <if test="statusHrUserId != null">status_hr_user_id,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="name != null">#{name},</if>
            <if test="submitDate != null">#{submitDate},</if>
            <if test="statusHr != null">#{statusHr},</if>
            <if test="dateHr != null">#{dateHr},</if>
            <if test="reasonHr != null">#{reasonHr},</if>
            <if test="statusIcfa != null">#{statusIcfa},</if>
            <if test="dateIcfa != null">#{dateIcfa},</if>
            <if test="reasonIcfa != null">#{reasonIcfa},</if>
            <if test="remark != null">#{remark},</if>
            <if test="delFlag != null and delFlag != ''">#{delFlag},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="createBy != null and createBy != ''">#{createBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="updateBy != null and updateBy != ''">#{updateBy},</if>
            <if test="createUserId != null">#{createUserId},</if>
            <if test="diskPath != null and diskPath != ''">#{diskPath},</if>
            <if test="deptId != null">#{deptId},</if>
            <if test="deptName != null">#{deptName},</if>
            <if test="status != null">#{status},</if>
            <if test="statusTime != null">#{statusTime},</if>
            <if test="statusUserId != null">#{statusUserId},</if>
            <if test="statusIcfaUserId != null">#{statusIcfaUserId},</if>
            <if test="statusHrUserId != null">#{statusHrUserId},</if>
        </trim>
    </insert>

    <update id="updatePostProgramme" parameterType="PostProgramme">
        update post_programme
        <trim prefix="SET" suffixOverrides=",">
            <if test="name != null">name = #{name},</if>
            <if test="submitDate != null">submit_date = #{submitDate},</if>
            <if test="statusHr != null">status_hr = #{statusHr},</if>
            <if test="dateHr != null">date_hr = #{dateHr},</if>
            <if test="reasonHr != null">reason_hr = #{reasonHr},</if>
            <if test="statusIcfa != null">status_icfa = #{statusIcfa},</if>
            <if test="dateIcfa != null">date_icfa = #{dateIcfa},</if>
            <if test="reasonIcfa != null">reason_icfa = #{reasonIcfa},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="delFlag != null and delFlag != ''">del_flag = #{delFlag},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="createBy != null and createBy != ''">create_by = #{createBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="updateBy != null and updateBy != ''">update_by = #{updateBy},</if>
            <if test="createUserId != null">create_user_id = #{createUserId},</if>
            <if test="diskPath != null and diskPath != ''">disk_path = #{diskPath},</if>
            <if test="deptId != null">dept_id = #{deptId},</if>
            <if test="deptName != null">dept_name = #{deptName},</if>
            <if test="status != null">status = #{status},</if>
            <if test="statusTime != null">status_time = #{statusTime},</if>
            <if test="statusUserId != null">status_user_id = #{statusUserId},</if>
            <if test="statusIcfaUserId != null">status_icfa_user_id = #{statusIcfaUserId},</if>
            <if test="statusHrUserId != null">status_hr_user_id = #{statusHrUserId},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deletePostProgrammeById" parameterType="Long">
        delete from post_programme where id = #{id}
    </delete>

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