<?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.project.benyi.mapper.ByDayFlowUnscrambleMapper">

    <resultMap type="ByDayFlowUnscramble" id="ByDayFlowUnscrambleResult">
        <result property="id" column="id"/>
        <result property="standardId" column="standard_id"/>
        <result property="content" column="content"/>
        <result property="sort" column="sort"/>
        <result property="remark" column="remark"/>
        <result property="createuserid" column="createuserid"/>
        <result property="createTime" column="create_time"/>
    </resultMap>

    <sql id="selectByDayFlowUnscrambleVo">
        select id, standard_id, content, sort, remark, createuserid, create_time from by_day_flow_unscramble
    </sql>

    <select id="selectByDayFlowUnscrambleList" parameterType="ByDayFlowUnscramble"
            resultMap="ByDayFlowUnscrambleResult">
        <include refid="selectByDayFlowUnscrambleVo"/>
        <where>
            <if test="standardId != null ">and standard_id = #{standardId}</if>
            <if test="content != null  and content != ''">and content = #{content}</if>
            <if test="sort != null ">and sort = #{sort}</if>
            <if test="createuserid != null ">and createuserid = #{createuserid}</if>
        </where>
    </select>

    <select id="selectByDayFlowUnscrambleById" parameterType="Long" resultMap="ByDayFlowUnscrambleResult">
        <include refid="selectByDayFlowUnscrambleVo"/>
        where id = #{id}
    </select>

    <insert id="insertByDayFlowUnscramble" parameterType="ByDayFlowUnscramble" useGeneratedKeys="true" keyProperty="id">
        insert into by_day_flow_unscramble
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="standardId != null ">standard_id,</if>
            <if test="content != null  and content != ''">content,</if>
            <if test="sort != null ">sort,</if>
            <if test="remark != null  and remark != ''">remark,</if>
            <if test="createuserid != null ">createuserid,</if>
            <if test="createTime != null ">create_time,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="standardId != null ">#{standardId},</if>
            <if test="content != null  and content != ''">#{content},</if>
            <if test="sort != null ">#{sort},</if>
            <if test="remark != null  and remark != ''">#{remark},</if>
            <if test="createuserid != null ">#{createuserid},</if>
            <if test="createTime != null ">#{createTime},</if>
        </trim>
    </insert>

    <update id="updateByDayFlowUnscramble" parameterType="ByDayFlowUnscramble">
        update by_day_flow_unscramble
        <trim prefix="SET" suffixOverrides=",">
            <if test="standardId != null ">standard_id = #{standardId},</if>
            <if test="content != null  and content != ''">content = #{content},</if>
            <if test="sort != null ">sort = #{sort},</if>
            <if test="remark != null  and remark != ''">remark = #{remark},</if>
            <if test="createuserid != null ">createuserid = #{createuserid},</if>
            <if test="createTime != null ">create_time = #{createTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteByDayFlowUnscrambleById" parameterType="Long">
        delete from by_day_flow_unscramble where id = #{id}
    </delete>

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

</mapper>