<?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.voluntary.mapper.BBusiEcardPriceMapper">
    
    <resultMap type="BBusiEcardPrice" id="BBusiEcardPriceResult">
        <result property="id"    column="id"    />
        <result property="greadId"    column="greadId"    />
        <result property="price"    column="price"    />
        <result property="year"    column="year"    />
        <result property="outTime"    column="outTime"    />
    </resultMap>

    <sql id="selectBBusiEcardPriceVo">
        select id, greadId, price, year, outTime from b_busi_ecard_price
    </sql>

    <select id="selectBBusiEcardPriceList" parameterType="BBusiEcardPrice" resultMap="BBusiEcardPriceResult">
        <include refid="selectBBusiEcardPriceVo"/>
        <where>  
            <if test="greadId != null "> and greadId = #{greadId}</if>
            <if test="price != null "> and price = #{price}</if>
            <if test="year != null "> and year = #{year}</if>
            <if test="outTime != null "> and outTime = #{outTime}</if>
        </where>
    </select>
    
    <select id="selectBBusiEcardPriceById" parameterType="Long" resultMap="BBusiEcardPriceResult">
        <include refid="selectBBusiEcardPriceVo"/>
        where id = #{id}
    </select>
        
    <insert id="insertBBusiEcardPrice" parameterType="BBusiEcardPrice" useGeneratedKeys="true" keyProperty="id">
        insert into b_busi_ecard_price
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="greadId != null">greadId,</if>
            <if test="price != null">price,</if>
            <if test="year != null">year,</if>
            <if test="outTime != null">outTime,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="greadId != null">#{greadId},</if>
            <if test="price != null">#{price},</if>
            <if test="year != null">#{year},</if>
            <if test="outTime != null">#{outTime},</if>
         </trim>
    </insert>

    <update id="updateBBusiEcardPrice" parameterType="BBusiEcardPrice">
        update b_busi_ecard_price
        <trim prefix="SET" suffixOverrides=",">
            <if test="greadId != null">greadId = #{greadId},</if>
            <if test="price != null">price = #{price},</if>
            <if test="year != null">year = #{year},</if>
            <if test="outTime != null">outTime = #{outTime},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteBBusiEcardPriceById" parameterType="Long">
        delete from b_busi_ecard_price where id = #{id}
    </delete>

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