<?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="postCheckedMethod"    column="post_checked_method"/>
        <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="statusTime"    column="status_time"    />
        <result property="reason"    column="reason"    />
        <result property="serialNumber"    column="serial_number"    />
    </resultMap>

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

    <select id="selectPostListInfoList" parameterType="PostListInfo" resultMap="PostListInfoResult">
        <include refid="selectPostListInfoVo"/>
        <where>
            <if test="status != null "> and status = #{status}</if>
            <if test="reason != null  and reason != ''"> and reason like concat('%', #{reason}, '%')</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="statusTime != null">status_time,</if>
            <if test="reason != null">reason,</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="postCheckedMethod != null">post_checked_method,</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="serialNumber != null">serial_number,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="status != null">#{status},</if>
            <if test="statusTime != null">#{statusTime},</if>
            <if test="reason != null">#{reason},</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="postCheckedMethod != null">#{post_checked_method},</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="serialNumber != null">#{serialNumber},</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="statusTime != null">status_time = #{statusTime},</if>
            <if test="reason != null">reason = #{reason},</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="postCheckedMethod != null">post_checked_method = #{postCheckedMethod},</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="serialNumber != null">serial_number = #{serialNumber},</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>
