<?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.baseinfo.mapper.BaseShiftInfoMapper">

    <resultMap type="BaseShiftInfo" id="BaseShiftInfoResult">
        <result property="objid"    column="objid"    />
        <result property="shiftid"    column="shiftid"    />
        <result property="shiftname"    column="shiftname"    />
        <result property="status"    column="status"    />
        <result property="remark"    column="remark"    />
        <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="delFlag"    column="del_flag"    />
    </resultMap>

    <sql id="selectBaseShiftInfoVo">
        select objid, shiftid, shiftname, status, remark, create_by, create_time, update_by, update_time, del_flag from base_shift_info
    </sql>

    <select id="selectBaseShiftInfoList" parameterType="BaseShiftInfo" resultMap="BaseShiftInfoResult">
        <include refid="selectBaseShiftInfoVo"/>
        <where>
            <if test="shiftid != null  and shiftid != ''"> and shiftid = #{shiftid}</if>
            <if test="shiftname != null  and shiftname != ''"> and shiftname like ('%' + #{shiftname} + '%')</if>
            <if test="status != null  and status != ''"> and status = #{status}</if>
        </where>
    </select>

    <select id="selectBaseShiftInfoById" parameterType="Long" resultMap="BaseShiftInfoResult">
        <include refid="selectBaseShiftInfoVo"/>
        where objid = #{objid}
    </select>

    <insert id="insertBaseShiftInfo" parameterType="BaseShiftInfo">
        insert into base_shift_info
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="objid != null">objid,</if>
            <if test="shiftid != null">shiftid,</if>
            <if test="shiftname != null">shiftname,</if>
            <if test="status != null">status,</if>
            <if test="remark != null">remark,</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="delFlag != null">del_flag,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="objid != null">#{objid},</if>
            <if test="shiftid != null">#{shiftid},</if>
            <if test="shiftname != null">#{shiftname},</if>
            <if test="status != null">#{status},</if>
            <if test="remark != null">#{remark},</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="delFlag != null">#{delFlag},</if>
         </trim>
    </insert>

    <update id="updateBaseShiftInfo" parameterType="BaseShiftInfo">
        update base_shift_info
        <trim prefix="SET" suffixOverrides=",">
            <if test="shiftid != null">shiftid = #{shiftid},</if>
            <if test="shiftname != null">shiftname = #{shiftname},</if>
            <if test="status != null">status = #{status},</if>
            <if test="remark != null">remark = #{remark},</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="delFlag != null">del_flag = #{delFlag},</if>
        </trim>
        where objid = #{objid}
    </update>

    <delete id="deleteBaseShiftInfoById" parameterType="Long">
        delete from base_shift_info where objid = #{objid}
    </delete>

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



</mapper>
