<?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="org.springblade.modules.mall.mapper.ShoppingCartMapper">

    <select id="selectPage" resultType="org.springblade.modules.mall.vo.ShoppingCartVO">
        SELECT
            sc.id shoppingCartId,
            sc.goods_num goodsNum,
            gi.id goodsInfoId,
            gi.is_sale isSale,
            gi.goods_name goodsInfoName,
            gi.zone_type zoneType,
            gi.goods_cover goodsInfoImg,
            gs.sale_price salePrice,
            gs.id goodsSpecId,
            gs.spce_name goodsSpecName,
            gs.cover goodsSpecImg,
            gs.agreement_price agreementPrice,
            gi.is_activity isActivity
        FROM
            biz_shopping_cart sc
            LEFT JOIN biz_goods_info gi ON sc.goods_info_id = gi.id
            LEFT JOIN biz_goods_spec gs ON sc.goods_spec_id = gs.id
        WHERE
            sc.is_delete = 0 and gi.is_delete = 0
            AND user_id = #{userId}
        ORDER BY
            sc.create_time DESC
    </select>

</mapper>
