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

    <resultMap type="PostCheckedItems" id="PostCheckedItemsResult">
        <result property="id"    column="id"    />
        <result property="postCheckedId"    column="post_checked_id"    />
        <result property="type"    column="type"    />
        <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="postCheckedContent"    column="post_checked_content"    />
        <result property="postCheckedStandard"    column="post_checked_standard"    />
        <result property="postCheckedMethod"    column="post_checked_method"/>
        <result property="postCheckedResult"    column="post_checked_result"    />
        <result property="childrenTypeId"    column="children_type_id"    />
        <result property="serialNumber"    column="serial_number"    />
    </resultMap>

    <sql id="selectPostCheckedItemsVo">
        select
            id, post_checked_id, type, children_type_id, remark, del_flag, create_time, create_by, update_time, update_by, create_user_id, post_checked_content, post_checked_standard, post_checked_method, post_checked_result,serial_number
        from post_checked_items
    </sql>

    <select id="selectPostCheckedItemsList" parameterType="PostCheckedItems" resultMap="PostCheckedItemsResult">
        <include refid="selectPostCheckedItemsVo"/>
        <where>
            <if test="postCheckedId != null "> and post_checked_id = #{postCheckedId}</if>
            <if test="type != null "> and type = #{type}</if>
            <if test="childrenTypeId != null "> and children_type_id = #{childrenTypeId}</if>
            <if test="createUserId != null "> and create_user_id = #{createUserId}</if>
            <if test="postCheckedContent != null  and postCheckedContent != ''"> and post_checked_content = #{postCheckedContent}</if>
            <if test="postCheckedStandard != null  and postCheckedStandard != ''"> and post_checked_standard = #{postCheckedStandard}</if>
            <if test="postCheckedMethod != null  and postCheckedMethod != ''"> and post_checked_method = #{postCheckedMethod}</if>
            <if test="postCheckedResult != null  and postCheckedResult != ''"> and post_checked_result = #{postCheckedResult}</if>
        </where>
    </select>

    <select id="selectPostCheckedItemsById" parameterType="Long" resultMap="PostCheckedItemsResult">
        <include refid="selectPostCheckedItemsVo"/>
        where id = #{id}
    </select>

    <insert id="insertPostCheckedItems" parameterType="PostCheckedItems">
        insert into post_checked_items
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="postCheckedId != null">post_checked_id,</if>
            <if test="type != null">type,</if>
            <if test="childrenTypeId != null">children_type_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>
            <if test="postCheckedContent != null">post_checked_content,</if>
            <if test="postCheckedStandard != null">post_checked_standard,</if>
            <if test="postCheckedMethod != null and postCheckedMethod != ''">post_checked_method,</if>
            <if test="postCheckedResult != null">post_checked_result,</if>
            <if test="serialNumber != null">serial_number,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="postCheckedId != null">#{postCheckedId},</if>
            <if test="type != null">#{type},</if>
            <if test="childrenTypeId != null">#{childrenTypeId},</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>
            <if test="postCheckedContent != null">#{postCheckedContent},</if>
            <if test="postCheckedStandard != null">#{postCheckedStandard},</if>
            <if test="postCheckedMethod != null and postCheckedMethod != ''">#{postCheckedMethod},</if>
            <if test="postCheckedResult != null">#{postCheckedResult},</if>
            <if test="serialNumber != null">#{serialNumber},</if>
         </trim>
    </insert>

    <update id="updatePostCheckedItems" parameterType="PostCheckedItems">
        update post_checked_items
        <trim prefix="SET" suffixOverrides=",">
            <if test="postCheckedId != null">post_checked_id = #{postCheckedId},</if>
            <if test="type != null">type = #{type},</if>
            <if test="childrenTypeId != null">children_type_id = #{childrenTypeId},</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="createUserId != null">create_user_id = #{createUserId},</if>
            <if test="postCheckedContent != null">post_checked_content = #{postCheckedContent},</if>
            <if test="postCheckedStandard != null">post_checked_standard = #{postCheckedStandard},</if>
            <if test="postCheckedMethod != null and postCheckedMethod != ''">post_checked_method = #{postCheckedMethod},</if>
            <if test="postCheckedResult != null">post_checked_result = #{postCheckedResult},</if>
            <if test="serialNumber != null">serial_number = #{serialNumber},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deletePostCheckedItemsById" parameterType="Long">
        delete from post_checked_items where id = #{id}
    </delete>

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