<?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.PostPlanInfoMapper">

    <resultMap type="PostPlanInfo" id="PostPlanInfoResult">
        <result property="id"    column="id"    />
        <result property="postPlanId"    column="post_plan_id"    />
        <result property="checkedDeptId"    column="checked_dept_id"    />
        <result property="checkTime"    column="check_time"    />
        <result property="checkedPostId"    column="checked_post_id"    />
        <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="checkedImg"    column="checked_img"    />
        <result property="createUserId"    column="create_user_id"    />
        <result property="checkedTime"    column="checked_time"    />
    </resultMap>

    <sql id="selectPostPlanInfoVo">
        select
            id, post_plan_id, checked_dept_id, check_time, checked_post_id, remark, del_flag, create_time, create_by, update_time, update_by, create_user_id
        from post_plan_info
    </sql>

    <select id="selectPostPlanInfoList" parameterType="PostPlanInfo" resultMap="PostPlanInfoResult">
        <include refid="selectPostPlanInfoVo"/>
        <where>
            <if test="postPlanId != null "> and post_plan_id = #{postPlanId}</if>
            <if test="checkedDeptId != null "> and checked_dept_id = #{checkedDeptId}</if>
            <if test="checkTime != null "> and check_time = #{checkTime}</if>
            <if test="checkedPostId != null "> and checked_post_id = #{checkedPostId}</if>
            <if test="createUserId != null "> and create_user_id = #{createUserId}</if>
        </where>
    </select>

    <select id="selectPostPlanInfoById" parameterType="Long" resultMap="PostPlanInfoResult">
        <include refid="selectPostPlanInfoVo"/>
        where id = #{id}
    </select>

    <insert id="insertPostPlanInfo" parameterType="PostPlanInfo">
        insert into post_plan_info
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="postPlanId != null">post_plan_id,</if>
            <if test="checkedDeptId != null">checked_dept_id,</if>
            <if test="checkTime != null">check_time,</if>
            <if test="checkedPostId != null">checked_post_id,</if>
            <if test="remark != null">remark,</if>
            <if test="delFlag != null">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>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="postPlanId != null">#{postPlanId},</if>
            <if test="checkedDeptId != null">#{checkedDeptId},</if>
            <if test="checkTime != null">#{checkTime},</if>
            <if test="checkedPostId != null">#{checkedPostId},</if>
            <if test="remark != null">#{remark},</if>
            <if test="delFlag != null">#{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>
         </trim>
    </insert>

    <update id="updatePostPlanInfo" parameterType="PostPlanInfo">
        update post_plan_info
        <trim prefix="SET" suffixOverrides=",">
            <if test="postPlanId != null">post_plan_id = #{postPlanId},</if>
            <if test="checkedDeptId != null">checked_dept_id = #{checkedDeptId},</if>
            <if test="checkTime != null">check_time = #{checkTime},</if>
            <if test="checkedPostId != null">checked_post_id = #{checkedPostId},</if>
            <if test="remark != null">remark = #{remark},</if>
            <if test="delFlag != null">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="checkedImg != null">checked_img = #{checkedImg},</if>
            <if test="createUserId != null">create_user_id = #{createUserId},</if>
            <if test="checkedTime != null">checked_time = #{checkedTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deletePostPlanInfoById" parameterType="Long">
        delete from post_plan_info where id = #{id}
    </delete>

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