use of com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper in project lilishop by lilishop.
the class CategoryServiceImpl method updateCategory.
@Override
@Transactional(rollbackFor = Exception.class)
public void updateCategory(Category category) {
// 判断分类佣金是否正确
if (category.getCommissionRate() < 0) {
throw new ServiceException(ResultCode.CATEGORY_COMMISSION_RATE_ERROR);
}
// 判断父分类与子分类的状态是否一致
if (category.getParentId() != null && !"0".equals(category.getParentId())) {
Category parentCategory = this.getById(category.getParentId());
if (!parentCategory.getDeleteFlag().equals(category.getDeleteFlag())) {
throw new ServiceException(ResultCode.CATEGORY_DELETE_FLAG_ERROR);
}
}
UpdateWrapper<Category> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("id", category.getId()).set("name", category.getName()).set("image", category.getImage()).set("sort_order", category.getSortOrder()).set(DELETE_FLAG_COLUMN, category.getDeleteFlag()).set("commission_rate", category.getCommissionRate());
this.baseMapper.update(category, updateWrapper);
removeCache();
}
use of com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper in project lilishop by lilishop.
the class GoodsGalleryServiceImpl method add.
@Override
@Transactional(rollbackFor = Exception.class)
public void add(List<String> goodsGalleryList, String goodsId) {
// 删除原来商品相册信息
this.baseMapper.delete(new UpdateWrapper<GoodsGallery>().eq("goods_id", goodsId));
// 确定好图片选择器后进行处理
int i = 0;
for (String origin : goodsGalleryList) {
// 获取带所有缩略的相册
GoodsGallery galley = this.getGoodsGallery(origin);
galley.setGoodsId(goodsId);
// 默认第一个为默认图片
galley.setIsDefault(i == 0 ? 1 : 0);
i++;
this.baseMapper.insert(galley);
}
}
use of com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper in project lilishop by lilishop.
the class MemberNoticeManagerController method read.
@ApiOperation(value = "阅读消息")
@PostMapping("/read/{ids}")
public ResultMessage<Object> read(@PathVariable List ids) {
UpdateWrapper updateWrapper = new UpdateWrapper();
updateWrapper.in("id", ids);
updateWrapper.set("is_read", true);
memberNoticeService.update(updateWrapper);
return ResultUtil.success();
}
use of com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper in project lilishop by lilishop.
the class SeckillServiceImpl method updateEsGoodsSeckill.
/**
* 更新商品索引限时抢购信息
*
* @param seckill 限时抢购信息
*/
@Override
@Transactional(rollbackFor = Exception.class)
public void updateEsGoodsSeckill(Seckill seckill, List<SeckillApply> seckillApplies) {
if (seckillApplies != null && !seckillApplies.isEmpty()) {
// 更新促销范围
seckill.setScopeId(ArrayUtil.join(seckillApplies.stream().map(SeckillApply::getSkuId).toArray(), ","));
UpdateWrapper<Seckill> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("id", seckill.getId());
updateWrapper.set("scope_id", seckill.getScopeId());
this.update(updateWrapper);
// 循环秒杀商品数据,将数据按照时间段进行存储
for (SeckillApply seckillApply : seckillApplies) {
if (seckillApply.getPromotionApplyStatus().equals(PromotionsApplyStatusEnum.PASS.name())) {
this.setSeckillApplyTime(seckill, seckillApply);
}
}
if (!seckillApplies.isEmpty()) {
this.updateEsGoodsIndex(seckill);
}
}
}
use of com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper in project shopzz by whoiszxl.
the class PurchaseOrderServiceImpl method updateFinishedBySupplierId.
@Override
public boolean updateFinishedBySupplierId(Long id) {
UpdateWrapper<PurchaseOrder> updateWrapper = new UpdateWrapper<>();
updateWrapper.eq("supplier_id", id);
PurchaseOrder purchaseOrder = new PurchaseOrder();
purchaseOrder.setSupplierId(id);
purchaseOrder.setPurchaseOrderStatus(PurchaseOrderStatusConstants.FINISHED);
return this.update(purchaseOrder, updateWrapper);
}
Aggregations