订单下单

This commit is contained in:
2025-02-21 18:37:58 +08:00
parent 16ef1edc6b
commit 03217ee2ab
21 changed files with 466 additions and 228 deletions

View File

@@ -5,12 +5,44 @@
<mapper namespace="com.czg.service.order.mapper.CashierCartMapper">
<select id="getCartByTableCode" resultType="com.czg.order.entity.OrderDetail">
select cart.shop_id as shopId,
cart.product_id as productId,
pros.product_name as productName,
cart.sku_id as skuId,
skus.spec_info as skuName,
cart.number as number,
select cart.shop_id as shopId,
cart.number as number,
pros.pack_fee as packAmount,
cart.pack_number as packNumber,
cart.is_temporary as isTemporary,
cart.discount_sale_note as discountSaleNote,
cart.is_print as isPrint,
cart.is_wait_call as isWaitCall,
cart.pro_group_info as proGroupInfo,
cart.remark as remark,
cart.product_id as productId,
pros.cover_img as productImg,
pros.type as productType,
cart.sku_id as skuId,
skus.spec_info as skuName,
'wait-pay' as status,
#{placeNum} as placeNum,
#{dineMode} as dineMode,
case cart.is_temporary
when 1 then cart.product_name
else pros.name
end as productName,
case cart.is_gift
when 1 then 0
else
CASE
cart.is_temporary
WHEN 1 THEN
cart.discount_sale_amount
ELSE
IF(cart.discount_sale_amount > 0,
cart.discount_sale_amount,
CASE #{isUseVip}
WHEN 1 THEN skus.member_price
ELSE skus.sale_price END)
end
END as price
from tb_cashier_cart cart
left join tb_product pros on cart.product_id = pros.id
left join tb_prod_sku skus on cart.sku_id = skus.id

View File

@@ -4,4 +4,20 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.czg.service.order.mapper.OrderDetailMapper">
<insert id="createOrderDetails">
INSERT INTO tb_order_detail(order_id, shop_id, product_id, product_img, product_name, product_type, sku_id,
sku_name, price, discount_amount, pack_amount, pay_amount, return_amount, num, pack_number, coupon_num,
return_num, refund_num, refund_no, discount_sale_note, status, place_num, is_temporary, is_print, is_wait_call,
pro_group_info, remark, refund_remark, create_time, update_time)
VALUES
<foreach collection="orderDetails" item="entity" separator=",">
(#{orderId}, #{entity.shopId}, #{entity.productId}, #{entity.productImg}, #{entity.productName},
#{entity.productType}, #{entity.skuId}, #{entity.skuName}, #{entity.price}, #{entity.discountAmount},
#{entity.packAmount}, #{entity.payAmount}, #{entity.returnAmount}, #{entity.num}, #{entity.packNumber},
#{entity.couponNum}, #{entity.returnNum}, #{entity.refundNum}, #{entity.refundNo},
#{entity.discountSaleNote}, #{entity.status}, #{entity.placeNum}, #{entity.isTemporary}, #{entity.isPrint},
#{entity.isWaitCall}, #{entity.proGroupInfo}, #{entity.remark}, #{entity.refundRemark},
#{entity.createTime}, #{entity.updateTime})
</foreach>
</insert>
</mapper>