<?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.model.mapper.WalletMapper">
    
    <resultMap type="Wallet" id="WalletResult">
        <result property="id"    column="id"    />
        <result property="price"    column="price"    />
        <result property="tid"    column="tid"    />
    </resultMap>

    <sql id="selectWalletVo">
        select id, price, tid from wallet
    </sql>

    <select id="selectWalletList" parameterType="Wallet" resultMap="WalletResult">
        <include refid="selectWalletVo"/>
        <where>  
            <if test="price != null "> and price = #{price}</if>
            <if test="tid != null "> and tid = #{tid}</if>
        </where>
    </select>
    
    <select id="selectWalletById" parameterType="Long" resultMap="WalletResult">
        <include refid="selectWalletVo"/>
        where id = #{id}
    </select>
    <select id="getWalletList" resultType="com.ruoyi.model.domain.Wallet">
        <include refid="selectWalletVo"/>
    </select>

    <insert id="insertWallet" parameterType="Wallet">
        insert into wallet
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="id != null">id,</if>
            <if test="price != null">price,</if>
            <if test="tid != null">tid,</if>
         </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="id != null">#{id},</if>
            <if test="price != null">#{price},</if>
            <if test="tid != null">#{tid},</if>
         </trim>
    </insert>

    <update id="updateWallet" parameterType="Wallet">
        update wallet
        <trim prefix="SET" suffixOverrides=",">
            <if test="price != null">price = #{price},</if>
            <if test="tid != null">tid = #{tid},</if>
        </trim>
        where id = #{id}
    </update>

    <delete id="deleteWalletById" parameterType="Long">
        delete from wallet where id = #{id}
    </delete>

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