<?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.system.mapper.BomanReservatConfigMapper">
    
    <resultMap type="BomanReservatConfig" id="BomanReservatConfigResult">
        <result property="reservatConfigId"    column="reservat_config_id"    />
        <result property="reservatConfigWeek"    column="reservat_config_week"    />
        <result property="reservatConfigHoliday"    column="reservat_config_holiday"    />
        <result property="createDept"    column="create_dept"    />
        <result property="createBy"    column="create_by"    />
        <result property="createTime"    column="create_time"    />
        <result property="updateBy"    column="update_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="remark"    column="remark"    />
    </resultMap>

    <sql id="selectBomanReservatConfigVo">
        select reservat_config_id, reservat_config_week, reservat_config_holiday, create_dept, create_by, create_time, update_by, update_time, remark from boman_reservat_config
    </sql>

    <select id="selectBomanReservatConfigList" parameterType="BomanReservatConfig" resultMap="BomanReservatConfigResult">
        <include refid="selectBomanReservatConfigVo"/>
        <where>  
            <if test="reservatConfigWeek != null  and reservatConfigWeek != ''"> and reservat_config_week = #{reservatConfigWeek}</if>
            <if test="reservatConfigHoliday != null  and reservatConfigHoliday != ''"> and reservat_config_holiday = #{reservatConfigHoliday}</if>
            <if test="createDept != null "> and create_dept = #{createDept}</if>
        </where>
    </select>
    
    <select id="selectBomanReservatConfigByReservatConfigId" parameterType="Long" resultMap="BomanReservatConfigResult">
        <include refid="selectBomanReservatConfigVo"/>
        where reservat_config_id = #{reservatConfigId}
    </select>
        
    <insert id="insertBomanReservatConfig" parameterType="BomanReservatConfig">
        insert into boman_reservat_config
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="reservatConfigId != null">reservat_config_id,</if>
            <if test="reservatConfigWeek != null">reservat_config_week,</if>
            <if test="reservatConfigHoliday != null">reservat_config_holiday,</if>
            <if test="createDept != null">create_dept,</if>
            <if test="createBy != null">create_by,</if>
            <if test="createTime != null">create_time,</if>
            <if test="updateBy != null">update_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="remark != null">remark,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="reservatConfigId != null">#{reservatConfigId},</if>
            <if test="reservatConfigWeek != null">#{reservatConfigWeek},</if>
            <if test="reservatConfigHoliday != null">#{reservatConfigHoliday},</if>
            <if test="createDept != null">#{createDept},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="remark != null">#{remark},</if>
         </trim>
    </insert>

    <update id="updateBomanReservatConfig" parameterType="BomanReservatConfig">
        update boman_reservat_config
        <trim prefix="SET" suffixOverrides=",">
            <if test="reservatConfigWeek != null">reservat_config_week = #{reservatConfigWeek},</if>
            <if test="reservatConfigHoliday != null">reservat_config_holiday = #{reservatConfigHoliday},</if>
            <if test="createDept != null">create_dept = #{createDept},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="remark != null">remark = #{remark},</if>
        </trim>
        where reservat_config_id = #{reservatConfigId}
    </update>

    <delete id="deleteBomanReservatConfigByReservatConfigId" parameterType="Long">
        delete from boman_reservat_config where reservat_config_id = #{reservatConfigId}
    </delete>

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