苍穹外卖--查看购物车

This commit is contained in:
2025-11-24 16:34:31 +08:00
parent 1c2e6f1509
commit a79ed0b649
3 changed files with 31 additions and 4 deletions

View File

@@ -1,10 +1,18 @@
package com.sky.service;
import com.sky.dto.ShoppingCartDTO;
import com.sky.entity.ShoppingCart;
import java.util.List;
public interface ShoppingCartService {
/*
添加购物车
*/
void addShoppingCart(ShoppingCartDTO shoppingCartDTO);
/*
查看购物车
*/
List<ShoppingCart> showShoppingCart();
}

View File

@@ -92,4 +92,16 @@ public class ShoppingCartServiceImpl implements ShoppingCartService {
}
/*
查看购物车
*/
@Override
public List<ShoppingCart> showShoppingCart() {
ShoppingCart cart = ShoppingCart.builder()
.userId(BaseContext.getCurrentId())
.build();
return shoppingCartMapper.list(cart);
}
}