订单相关

This commit is contained in:
litianxiang
2026-05-20 15:33:22 +08:00
parent d004dc75f5
commit 45885bf509
9 changed files with 169 additions and 5 deletions

View File

@@ -64,6 +64,7 @@ CREATE TABLE seller_orders (
seller_id BIGINT NOT NULL COMMENT '卖家ID',
buyer_id BIGINT NOT NULL COMMENT '买家ID',
status INT DEFAULT 0 COMMENT '订单状态: 0-未支付, 1-已支付, 2-已取消',
shop_name VARCHAR(100) COMMENT '店铺名称',
total_price DECIMAL(10,2) COMMENT '订单总金额(HK$)',
buyer_username VARCHAR(100) COMMENT '买家账号',
total_items INT COMMENT '商品总数量',

View File

@@ -0,0 +1,50 @@
<?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.aida.seller.module.order.mapper.OrderItemMapper">
<select id="selectAssetsPage" resultType="com.aida.seller.module.order.vo.AssetsItemVO">
SELECT
soi.listing_id,
soi.listing_name,
soi.thumbnail_url,
soi.price,
soi.create_time
FROM seller_order_item soi
INNER JOIN seller_orders so ON soi.order_id = so.id
INNER JOIN seller_listing l ON soi.listing_id = l.id
WHERE soi.deleted = 0
AND so.deleted = 0
AND so.buyer_id = #{dto.buyerId}
AND so.status = 1
<if test="dto.categories != null and dto.categories.size() > 0">
<foreach collection="dto.categories" item="cat">
AND JSON_CONTAINS(soi.product_category, #{cat})
</foreach>
</if>
<if test="dto.designFor != null and dto.designFor != '' and dto.designFor != 'all'">
AND l.design_for = #{dto.designFor}
</if>
ORDER BY soi.create_time DESC
LIMIT #{offset}, #{size}
</select>
<select id="selectAssetsCount" resultType="java.lang.Long">
SELECT COUNT(*)
FROM seller_order_item soi
INNER JOIN seller_orders so ON soi.order_id = so.id
INNER JOIN seller_listing l ON soi.listing_id = l.id
WHERE soi.deleted = 0
AND so.deleted = 0
AND so.buyer_id = #{dto.buyerId}
AND so.status = 1
<if test="dto.categories != null and dto.categories.size() > 0">
<foreach collection="dto.categories" item="cat">
AND JSON_CONTAINS(soi.product_category, #{cat})
</foreach>
</if>
<if test="dto.designFor != null and dto.designFor != '' and dto.designFor != 'all'">
AND l.design_for = #{dto.designFor}
</if>
</select>
</mapper>