<?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.logistics.mapper.BizMonthQrcodeRecordMapper">
    
    <resultMap type="BizMonthQrcodeRecord" id="BizMonthQrcodeRecordResult">
        <result property="qrcodeId"    column="qrcode_id"    />
        <result property="qrcodeContent"    column="qrcode_content"    />
        <result property="userId"    column="user_id"    />
        <result property="deptId"    column="dept_id"    />
        <result property="source"    column="source"    />
        <result property="isVerify"    column="is_verify"    />
        <result property="createTime"    column="create_time"    />
        <result property="createBy"    column="create_by"    />
        <result property="updateTime"    column="update_time"    />
        <result property="updateBy"    column="update_by"    />
    </resultMap>

    <sql id="selectBizMonthQrcodeRecordVo">
        select qrcode_id, qrcode_content, user_id, dept_id, source, is_verify, create_time, create_by, update_time, update_by from biz_month_qrcode_record
    </sql>

    <select id="selectBizMonthQrcodeRecordList" parameterType="BizMonthQrcodeRecord" resultMap="BizMonthQrcodeRecordResult">
        <include refid="selectBizMonthQrcodeRecordVo"/>
        <where>  
            <if test="qrcodeContent != null  and qrcodeContent != ''"> and qrcode_content = #{qrcodeContent}</if>
            <if test="userId != null "> and user_id = #{userId}</if>
            <if test="deptId != null "> and dept_id = #{deptId}</if>
            <if test="source != null "> and source = #{source}</if>
            <if test="isVerify != null "> and is_verify = #{isVerify}</if>
        </where>
    </select>
    
    <select id="selectBizMonthQrcodeRecordByQrcodeId" parameterType="Long" resultMap="BizMonthQrcodeRecordResult">
        <include refid="selectBizMonthQrcodeRecordVo"/>
        where qrcode_id = #{qrcodeId}
    </select>

    <insert id="insertBizMonthQrcodeRecord" parameterType="BizMonthQrcodeRecord" useGeneratedKeys="true" keyProperty="qrcodeId">
        insert into biz_month_qrcode_record
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="qrcodeContent != null">qrcode_content,</if>
            <if test="userId != null">user_id,</if>
            <if test="deptId != null">dept_id,</if>
            <if test="source != null">source,</if>
            <if test="isVerify != null">is_verify,</if>
            <if test="createTime != null">create_time,</if>
            <if test="createBy != null">create_by,</if>
            <if test="updateTime != null">update_time,</if>
            <if test="updateBy != null">update_by,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="qrcodeContent != null">#{qrcodeContent},</if>
            <if test="userId != null">#{userId},</if>
            <if test="deptId != null">#{deptId},</if>
            <if test="source != null">#{source},</if>
            <if test="isVerify != null">#{isVerify},</if>
            <if test="createTime != null">#{createTime},</if>
            <if test="createBy != null">#{createBy},</if>
            <if test="updateTime != null">#{updateTime},</if>
            <if test="updateBy != null">#{updateBy},</if>
         </trim>
    </insert>

    <update id="updateBizMonthQrcodeRecord" parameterType="BizMonthQrcodeRecord">
        update biz_month_qrcode_record
        <trim prefix="SET" suffixOverrides=",">
            <if test="qrcodeContent != null">qrcode_content = #{qrcodeContent},</if>
            <if test="userId != null">user_id = #{userId},</if>
            <if test="deptId != null">dept_id = #{deptId},</if>
            <if test="source != null">source = #{source},</if>
            <if test="isVerify != null">is_verify = #{isVerify},</if>
            <if test="createTime != null">create_time = #{createTime},</if>
            <if test="createBy != null">create_by = #{createBy},</if>
            <if test="updateTime != null">update_time = #{updateTime},</if>
            <if test="updateBy != null">update_by = #{updateBy},</if>
        </trim>
        where qrcode_id = #{qrcodeId}
    </update>

    <delete id="deleteBizMonthQrcodeRecordByQrcodeId" parameterType="Long">
        delete from biz_month_qrcode_record where qrcode_id = #{qrcodeId}
    </delete>

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