use of com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper in project lilishop by lilishop.
the class StoreCollectionServiceImpl method addStoreCollection.
@Override
@Transactional(rollbackFor = Exception.class)
public StoreCollection addStoreCollection(String storeId) {
if (this.getOne(new LambdaUpdateWrapper<StoreCollection>().eq(StoreCollection::getMemberId, UserContext.getCurrentUser().getId()).eq(StoreCollection::getStoreId, storeId)) == null) {
StoreCollection storeCollection = new StoreCollection(UserContext.getCurrentUser().getId(), storeId);
this.save(storeCollection);
storeService.updateStoreCollectionNum(new CollectionDTO(storeId, 1));
return storeCollection;
}
throw new ServiceException(ResultCode.USER_COLLECTION_EXIST);
}
use of com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper in project lilishop by lilishop.
the class GoodsSkuServiceImpl method updateGoodsSkuStatus.
/**
* 更新商品sku状态
*
* @param goods 商品信息(Id,MarketEnable/AuthFlag)
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void updateGoodsSkuStatus(Goods goods) {
LambdaUpdateWrapper<GoodsSku> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(CharSequenceUtil.isNotEmpty(goods.getId()), GoodsSku::getGoodsId, goods.getId());
updateWrapper.eq(CharSequenceUtil.isNotEmpty(goods.getStoreId()), GoodsSku::getStoreId, goods.getStoreId());
updateWrapper.set(GoodsSku::getMarketEnable, goods.getMarketEnable());
updateWrapper.set(GoodsSku::getAuthFlag, goods.getAuthFlag());
updateWrapper.set(GoodsSku::getDeleteFlag, goods.getDeleteFlag());
boolean update = this.update(updateWrapper);
if (Boolean.TRUE.equals(update)) {
List<GoodsSku> goodsSkus = this.getGoodsSkuListByGoodsId(goods.getId());
for (GoodsSku sku : goodsSkus) {
cache.remove(GoodsSkuService.getCacheKeys(sku.getId()));
cache.put(GoodsSkuService.getCacheKeys(sku.getId()), sku);
}
if (!goodsSkus.isEmpty()) {
generateEs(goods);
}
}
}
use of com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper in project lilishop by lilishop.
the class GoodsSkuServiceImpl method updateGoodsSkuStatusByStoreId.
/**
* 更新商品sku状态根据店铺id
*
* @param storeId 店铺id
* @param marketEnable 市场启用状态
* @param authFlag 审核状态
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void updateGoodsSkuStatusByStoreId(String storeId, String marketEnable, String authFlag) {
LambdaUpdateWrapper<GoodsSku> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(GoodsSku::getStoreId, storeId);
updateWrapper.set(CharSequenceUtil.isNotEmpty(marketEnable), GoodsSku::getMarketEnable, marketEnable);
updateWrapper.set(CharSequenceUtil.isNotEmpty(authFlag), GoodsSku::getAuthFlag, authFlag);
boolean update = this.update(updateWrapper);
if (Boolean.TRUE.equals(update)) {
if (GoodsStatusEnum.UPPER.name().equals(marketEnable)) {
applicationEventPublisher.publishEvent(new GeneratorEsGoodsIndexEvent("生成店铺商品", GoodsTagsEnum.GENERATOR_STORE_GOODS_INDEX.name(), storeId));
} else if (GoodsStatusEnum.DOWN.name().equals(marketEnable)) {
cache.vagueDel(CachePrefix.GOODS_SKU.getPrefix());
applicationEventPublisher.publishEvent(new GeneratorEsGoodsIndexEvent("删除店铺商品", GoodsTagsEnum.STORE_GOODS_DELETE.name(), storeId));
}
}
}
use of com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper in project lilishop by lilishop.
the class OrderServiceImpl method deleteOrder.
@Override
@Transactional(rollbackFor = Exception.class)
public void deleteOrder(String sn) {
Order order = this.getBySn(sn);
if (order == null) {
log.error("订单号为" + sn + "的订单不存在!");
throw new ServiceException();
}
LambdaUpdateWrapper<Order> updateWrapper = new LambdaUpdateWrapper<>();
updateWrapper.eq(Order::getSn, sn).set(Order::getDeleteFlag, true);
this.update(updateWrapper);
LambdaUpdateWrapper<OrderItem> orderItemLambdaUpdateWrapper = new LambdaUpdateWrapper<>();
orderItemLambdaUpdateWrapper.eq(OrderItem::getOrderSn, sn).set(OrderItem::getDeleteFlag, true);
this.orderItemService.update(orderItemLambdaUpdateWrapper);
}
use of com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper in project lilishop by lilishop.
the class AfterSaleServiceImpl method updateOrderItem.
/**
* 功能描述: 修改orderItem订单
*
* @param orderItem
* @return void
* @author ftyy
*/
private void updateOrderItem(OrderItem orderItem) {
// 订单状态不能为新订单,已失效订单或未申请订单才可以去修改订单信息
OrderItemAfterSaleStatusEnum afterSaleTypeEnum = OrderItemAfterSaleStatusEnum.valueOf(orderItem.getAfterSaleStatus());
switch(afterSaleTypeEnum) {
// 售后状态为:未申请 部分售后 已申请
case NOT_APPLIED:
case PART_AFTER_SALE:
case ALREADY_APPLIED:
{
// 通过正在售后商品总数修改订单售后状态
if (orderItem.getReturnGoodsNumber().equals(orderItem.getNum())) {
// 修改订单的售后状态--已申请
orderItem.setAfterSaleStatus(OrderItemAfterSaleStatusEnum.ALREADY_APPLIED.name());
} else if (orderItem.getReturnGoodsNumber().equals(0)) {
// 修改订单的售后状态--未申请
orderItem.setAfterSaleStatus(OrderItemAfterSaleStatusEnum.NOT_APPLIED.name());
} else {
// 修改订单的售后状态--部分售后
orderItem.setAfterSaleStatus(OrderItemAfterSaleStatusEnum.PART_AFTER_SALE.name());
}
break;
}
default:
break;
}
orderItemService.update(new LambdaUpdateWrapper<OrderItem>().eq(OrderItem::getSn, orderItem.getSn()).set(OrderItem::getAfterSaleStatus, orderItem.getAfterSaleStatus()).set(OrderItem::getReturnGoodsNumber, orderItem.getReturnGoodsNumber()));
}
Aggregations