add
yj
2024-12-05 b9900893177c78fc559223521fe839aa21000017
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
<?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.iotechn.unimall.data.mapper.CartMapper">
 
    <select id="countCart" resultType="java.lang.Integer">
        SELECT
            sum( c.num )
        FROM
            unimall_cart AS c
        WHERE
            c.user_id = #{userId}
    </select>
 
    <select id="getCartList" resultType="com.iotechn.unimall.data.dto.CartDTO">
        SELECT
            c.id,
            c.sku_id AS skuId,
            c.num,
            p.title,
            k.price,
            k.original_price AS originalPrice,
            k.vip_price AS vipPrice,
            k.title AS skuTitle,
            p.img AS spuImg,
            k.img AS skuImg,
            p.freight_template_id AS freightTemplateId,
            k.weight,
            k.stock,
            k.spu_id AS spuId,
            p.category_id AS categoryId,
            c.gmt_update AS gmtUpdate,
            c.gmt_create AS gmtCreate
        FROM
            unimall_cart AS c,
            unimall_sku AS k,
            unimall_spu AS p
        WHERE
            c.user_id = #{userId}
            AND c.sku_id = k.id
            AND k.spu_id = p.id
    </select>
 
</mapper>