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

    <resultMap type="PostListInfo" id="PostListInfoResult">
        <result property="id"    column="id"    />
        <result property="status"    column="status"    />
        <result property="statusByUserId"    column="status_by_user_id"    />
        <result property="statusByUserName"    column="status_by_user_name"    />
        <result property="postListId"    column="post_list_id"    />
        <result property="type"    column="type"    />
        <result property="sequenceProject"    column="sequence_project"    />
        <result property="levelOne"    column="level_one"    />
        <result property="levelTwo"    column="level_two"    />
        <result property="levelThree"    column="level_three"    />
        <result property="levelFour"    column="level_four"    />
        <result property="levelFive"    column="level_five"    />
        <result property="workStandard"    column="work_standard"    />
        <result property="requirement"    column="requirement"    />
        <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"    />
    </resultMap>

    <sql id="selectPostListInfoVo">
        select
            id, status, status_by_user_id, status_by_user_name, post_list_id, type, sequence_project, level_one, level_two, level_three, level_four, level_five, work_standard,
            requirement, remark, del_flag, create_time, create_by, update_time, update_by, create_user_id
        from post_list_info
    </sql>

    <select id="selectPostListInfoList" parameterType="PostListInfo" resultMap="PostListInfoResult">
        <include refid="selectPostListInfoVo"/>
        <where>
            <if test="status != null "> and status = #{status}</if>
            <if test="statusByUserId != null "> and status_by_user_id = #{statusByUserId}</if>
            <if test="statusByUserName != null  and statusByUserName != ''"> and status_by_user_name like concat('%', #{statusByUserName}, '%')</if>
            <if test="postListId != null "> and post_list_id = #{postListId}</if>
            <if test="type != null "> and type = #{type}</if>
            <if test="sequenceProject != null "> and sequence_project = #{sequenceProject}</if>
            <if test="levelOne != null "> and level_one = #{levelOne}</if>
            <if test="levelTwo != null "> and level_two = #{levelTwo}</if>
            <if test="levelThree != null "> and level_three = #{levelThree}</if>
            <if test="levelFour != null "> and level_four = #{levelFour}</if>
            <if test="levelFive != null "> and level_five = #{levelFive}</if>
            <if test="workStandard != null  and workStandard != ''"> and work_standard = #{workStandard}</if>
            <if test="requirement != null  and requirement != ''"> and requirement = #{requirement}</if>
            <if test="createUserId != null "> and create_user_id = #{createUserId}</if>
        </where>
        order by id asc
    </select>

    <select id="selectPostListInfoById" parameterType="Long" resultMap="PostListInfoResult">
        <include refid="selectPostListInfoVo"/>
        where id = #{id}
    </select>

    <insert id="insertPostListInfo" parameterType="PostListInfo">
        insert into post_list_info
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="status != null">status,</if>
            <if test="statusByUserId != null">status_by_user_id,</if>
            <if test="statusByUserName != null">status_by_user_name,</if>
            <if test="postListId != null">post_list_id,</if>
            <if test="type != null">type,</if>
            <if test="sequenceProject != null">sequence_project,</if>
            <if test="levelOne != null">level_one,</if>
            <if test="levelTwo != null">level_two,</if>
            <if test="levelThree != null">level_three,</if>
            <if test="levelFour != null">level_four,</if>
            <if test="levelFive != null">level_five,</if>
            <if test="workStandard != null">work_standard,</if>
            <if test="requirement != null">requirement,</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>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="status != null">#{status},</if>
            <if test="statusByUserId != null">#{statusByUserId},</if>
            <if test="statusByUserName != null">#{statusByUserName},</if>
            <if test="postListId != null">#{postListId},</if>
            <if test="type != null">#{type},</if>
            <if test="sequenceProject != null">#{sequenceProject},</if>
            <if test="levelOne != null">#{levelOne},</if>
            <if test="levelTwo != null">#{levelTwo},</if>
            <if test="levelThree != null">#{levelThree},</if>
            <if test="levelFour != null">#{levelFour},</if>
            <if test="levelFive != null">#{levelFive},</if>
            <if test="workStandard != null">#{workStandard},</if>
            <if test="requirement != null">#{requirement},</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>
        </trim>
    </insert>

    <update id="updatePostListInfo" parameterType="PostListInfo">
        update post_list_info
        <trim prefix="SET" suffixOverrides=",">
            <if test="status != null">status = #{status},</if>
            <if test="statusByUserId != null">status_by_user_id = #{statusByUserId},</if>
            <if test="statusByUserName != null">status_by_user_name = #{statusByUserName},</if>
            <if test="postListId != null">post_list_id = #{postListId},</if>
            <if test="type != null">type = #{type},</if>
            <if test="sequenceProject != null">sequence_project = #{sequenceProject},</if>
            <if test="levelOne != null">level_one = #{levelOne},</if>
            <if test="levelTwo != null">level_two = #{levelTwo},</if>
            <if test="levelThree != null">level_three = #{levelThree},</if>
            <if test="levelFour != null">level_four = #{levelFour},</if>
            <if test="levelFive != null">level_five = #{levelFive},</if>
            <if test="workStandard != null">work_standard = #{workStandard},</if>
            <if test="requirement != null">requirement = #{requirement},</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>
        </trim>
        where id = #{id}
    </update>

    <delete id="deletePostListInfoById" parameterType="Long">
        delete from post_list_info where id = #{id}
    </delete>

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