jiangqs
2023-05-03 00f3a60a31dd5f6bcc4a02f03beb15d91cd4b6f8
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?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.order.mapper.goods.GoodsTotalMapper">
 
    <resultMap type="GoodsTotal" id="GoodsTotalResult">
        <result property="goodsId"    column="goods_id"    />
        <result property="buyCount"    column="buy_count"    />
        <result property="buyNumCount"    column="buy_num_count"    />
        <result property="buyUserCount"    column="buy_user_count"    />
    </resultMap>
 
    <sql id="selectGoodsTotalVo">
        select goods_id, buy_count, buy_num_count, buy_user_count from t_goods_total
    </sql>
 
    <select id="selectGoodsTotalList" parameterType="GoodsTotal" resultMap="GoodsTotalResult">
        <include refid="selectGoodsTotalVo"/>
        <where>
            <if test="buyCount != null "> and buy_count = #{buyCount}</if>
            <if test="buyNumCount != null "> and buy_num_count = #{buyNumCount}</if>
            <if test="buyUserCount != null "> and buy_user_count = #{buyUserCount}</if>
        </where>
    </select>
 
    <select id="selectGoodsTotalByGoodsId" parameterType="String" resultMap="GoodsTotalResult">
        <include refid="selectGoodsTotalVo"/>
        where goods_id = #{goodsId}
    </select>
 
    <insert id="insertGoodsTotal" parameterType="GoodsTotal">
        insert into t_goods_total
        <trim prefix="(" suffix=")" suffixOverrides=",">
            <if test="goodsId != null">goods_id,</if>
            <if test="buyCount != null">buy_count,</if>
            <if test="buyNumCount != null">buy_num_count,</if>
            <if test="buyUserCount != null">buy_user_count,</if>
        </trim>
        <trim prefix="values (" suffix=")" suffixOverrides=",">
            <if test="goodsId != null">#{goodsId},</if>
            <if test="buyCount != null">#{buyCount},</if>
            <if test="buyNumCount != null">#{buyNumCount},</if>
            <if test="buyUserCount != null">#{buyUserCount},</if>
        </trim>
    </insert>
 
    <update id="updateGoodsTotal" parameterType="GoodsTotal">
        update t_goods_total
        <trim prefix="SET" suffixOverrides=",">
            <if test="buyCount != null">buy_count = #{buyCount},</if>
            <if test="buyNumCount != null">buy_num_count = #{buyNumCount},</if>
            <if test="buyUserCount != null">buy_user_count = #{buyUserCount},</if>
        </trim>
        where goods_id = #{goodsId}
    </update>
 
    <delete id="deleteGoodsTotalByGoodsId" parameterType="String">
        delete from t_goods_total where goods_id = #{goodsId}
    </delete>
 
    <delete id="deleteGoodsTotalByGoodsIds" parameterType="String">
        delete from t_goods_total where goods_id in
        <foreach item="goodsId" collection="array" open="(" separator="," close=")">
            #{goodsId}
        </foreach>
    </delete>
 
</mapper>