master:下单后,删除用户进货车接口;

pull/1121/head
liujiang 2025-10-09 15:07:49 +08:00
parent f5dd315ca4
commit ac1dcb9e20
3 changed files with 40 additions and 3 deletions

View File

@ -32,8 +32,6 @@ public class QuickFunctionController extends XktBaseController {
final IQuickFunctionService quickFuncService;
final ISysMenuService menuService;
private static final String MENU_TYPE_C = "C";
@PreAuthorize("@ss.hasAnyRoles('admin,general_admin,seller,agent,store')")
@ApiOperation(value = "档口或电商卖家选择的快捷功能", httpMethod = "GET", response = R.class)
@GetMapping("/selected")

View File

@ -54,7 +54,7 @@ public interface IShoppingCartService {
Integer delete(ShopCartDeleteDTO deleteDTO);
/**
* storeProdid
* storeProdId
*
* @param listDTO ID
* @return ShoppingCartDTO
@ -75,4 +75,14 @@ public interface IShoppingCartService {
* @return Integer
*/
Integer updateDetailQuantity(ShopCartDetailQuantityUpdateDTO updateQuantityDTO);
/**
*
*
* @param storeProdId ID
* @param userId ID
* @return Integer
*/
Integer removeShoppingCart(Long storeProdId, Long userId);
}

View File

@ -330,6 +330,35 @@ public class ShoppingCartServiceImpl implements IShoppingCartService {
return this.shopCartDetailMapper.updateById(detail);
}
/**
*
*
* @param storeProdId ID
* @param userId ID
* @return Integer
*/
@Override
@Transactional
public Integer removeShoppingCart(Long storeProdId, Long userId) {
// 用户进货车是否存在该商品
ShoppingCart shoppingCart = this.shopCartMapper.selectOne(new LambdaQueryWrapper<ShoppingCart>()
.eq(ShoppingCart::getStoreProdId, storeProdId).eq(ShoppingCart::getUserId, userId)
.eq(ShoppingCart::getDelFlag, Constants.UNDELETED));
if (ObjectUtils.isEmpty(shoppingCart)) {
return 0;
}
shoppingCart.setDelFlag(DELETED);
int count = this.shopCartMapper.updateById(shoppingCart);
// 找到进货车明细
List<ShoppingCartDetail> detailList = this.shopCartDetailMapper.selectList(new LambdaQueryWrapper<ShoppingCartDetail>()
.eq(ShoppingCartDetail::getShoppingCartId, shoppingCart.getId()).eq(ShoppingCartDetail::getDelFlag, Constants.UNDELETED));
if (CollectionUtils.isNotEmpty(detailList)) {
detailList.forEach(detail -> detail.setDelFlag(DELETED));
this.shopCartDetailMapper.updateById(detailList);
}
return count;
}
/**
*
*