<?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.warehouseBusiness.mapper.BillnoDelMapper">

    <resultMap type="BillnoDel" id="BillnoDelResult">
        <result property="id" column="id"/>
        <result property="billType" column="bill_type"/>
        <result property="billNo" column="bill_no"/>
        <result property="remarks" column="remarks"/>
    </resultMap>

    <sql id="selectBillnoDelVo">
        select id, bill_type, bill_no, remarks from billno_del
    </sql>

    <select id="selectBillnoDelList" parameterType="BillnoDel" resultMap="BillnoDelResult">
        <include refid="selectBillnoDelVo"/>
        <where>
            <if test="billType != null  and billType != ''">and bill_type = #{billType}</if>
            <if test="billNo != null  and billNo != ''">and bill_no = #{billNo}</if>
            <if test="remarks != null  and remarks != ''">and remarks = #{remarks}</if>
        </where>
    </select>

    <select id="selectBillnoDelById" parameterType="Long" resultMap="BillnoDelResult">
        <include refid="selectBillnoDelVo"/>
        where id = #{id}
    </select>

    <select id="selectBillnoDelBillNo" parameterType="BillnoDel" resultMap="BillnoDelResult">
        select id, bill_type, bill_no from billno_del
        <where>
            <if test="billType != null  and billType != ''">and bill_type = #{billType}</if>
            <if test="billNo != null  and billNo != ''">and bill_no = #{billNo}</if>
            <if test="remarks != null  and remarks != ''">and remarks = #{remarks}</if>
        </where>
    </select>

    <insert id="insertBillnoDel" parameterType="BillnoDel" useGeneratedKeys="true" keyProperty="id">
        insert into billno_del
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="billType != null">bill_type,</if>
            <if test="billNo != null">bill_no,</if>
            <if test="remarks != null">remarks,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="billType != null">#{billType},</if>
            <if test="billNo != null">#{billNo},</if>
            <if test="remarks != null">#{remarks},</if>
        </trim>
    </insert>

    <update id="updateBillnoDel" parameterType="BillnoDel">
        update billno_del
        <trim prefix="SET" suffixOverrides=",">
            <if test="billType != null">bill_type = #{billType},</if>
            <if test="billNo != null">bill_no = #{billNo},</if>
            <if test="remarks != null">remarks = #{remarks},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteBillnoDelById" parameterType="Long">
        delete from billno_del where id = #{id}
    </delete>

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

</mapper>