use of com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper in project kykms by mahonelau.
the class SysBaseApiImpl method updateSysAnnounReadFlag.
@Override
public void updateSysAnnounReadFlag(String busType, String busId) {
SysAnnouncement announcement = sysAnnouncementMapper.selectOne(new QueryWrapper<SysAnnouncement>().eq("bus_type", busType).eq("bus_id", busId));
if (announcement != null) {
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String userId = sysUser.getId();
LambdaUpdateWrapper<SysAnnouncementSend> updateWrapper = new UpdateWrapper().lambda();
updateWrapper.set(SysAnnouncementSend::getReadFlag, CommonConstant.HAS_READ_FLAG);
updateWrapper.set(SysAnnouncementSend::getReadTime, new Date());
updateWrapper.last("where annt_id ='" + announcement.getId() + "' and user_id ='" + userId + "'");
SysAnnouncementSend announcementSend = new SysAnnouncementSend();
sysAnnouncementSendMapper.update(announcementSend, updateWrapper);
}
}
use of com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper in project kykms by mahonelau.
the class SysAnnouncementSendController method readAll.
/**
* @功能:一键已读
* @return
*/
@PutMapping(value = "/readAll")
public Result<SysAnnouncementSend> readAll() {
Result<SysAnnouncementSend> result = new Result<SysAnnouncementSend>();
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
String userId = sysUser.getId();
LambdaUpdateWrapper<SysAnnouncementSend> updateWrapper = new UpdateWrapper().lambda();
updateWrapper.set(SysAnnouncementSend::getReadFlag, CommonConstant.HAS_READ_FLAG);
updateWrapper.set(SysAnnouncementSend::getReadTime, new Date());
updateWrapper.last("where user_id ='" + userId + "'");
SysAnnouncementSend announcementSend = new SysAnnouncementSend();
sysAnnouncementSendService.update(announcementSend, updateWrapper);
result.setSuccess(true);
result.setMessage("全部已读");
return result;
}
use of com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper in project lilishop by lilishop.
the class StoreServiceImpl method add.
@Override
@Transactional(rollbackFor = Exception.class)
public Store add(AdminStoreApplyDTO adminStoreApplyDTO) {
// 判断店铺名称是否存在
QueryWrapper<Store> queryWrapper = Wrappers.query();
queryWrapper.eq("store_name", adminStoreApplyDTO.getStoreName());
if (this.getOne(queryWrapper) != null) {
throw new ServiceException(ResultCode.STORE_NAME_EXIST_ERROR);
}
Member member = memberService.getById(adminStoreApplyDTO.getMemberId());
// 判断用户是否存在
if (member == null) {
throw new ServiceException(ResultCode.USER_NOT_EXIST);
}
// 判断是否拥有店铺
if (Boolean.TRUE.equals(member.getHaveStore())) {
throw new ServiceException(ResultCode.STORE_APPLY_DOUBLE_ERROR);
}
// 添加店铺
Store store = new Store(member, adminStoreApplyDTO);
this.save(store);
// 判断是否存在店铺详情,如果没有则进行新建,如果存在则进行修改
StoreDetail storeDetail = new StoreDetail(store, adminStoreApplyDTO);
storeDetailService.save(storeDetail);
// 设置会员-店铺信息
memberService.update(new LambdaUpdateWrapper<Member>().eq(Member::getId, member.getId()).set(Member::getHaveStore, true).set(Member::getStoreId, store.getId()));
return store;
}
use of com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper in project lilishop by lilishop.
the class GoodsServiceImpl method getUpdateWrapperByStoreAuthority.
/**
* 获取UpdateWrapper(检查用户越权)
*
* @return updateWrapper
*/
private LambdaUpdateWrapper<Goods> getUpdateWrapperByStoreAuthority() {
LambdaUpdateWrapper<Goods> updateWrapper = new LambdaUpdateWrapper<>();
AuthUser authUser = this.checkStoreAuthority();
if (authUser != null) {
updateWrapper.eq(Goods::getStoreId, authUser.getStoreId());
}
return updateWrapper;
}
use of com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper in project lilishop by lilishop.
the class VerificationOrderExecute method orderChange.
@Override
public void orderChange(OrderMessage orderMessage) {
// 订单状态为待核验,添加订单添加核验码
if (orderMessage.getNewStatus().equals(OrderStatusEnum.TAKE)) {
// 获取订单信息
Order order = orderService.getBySn(orderMessage.getOrderSn());
// 获取随机数,判定是否存在
String code = getCode(order.getStoreId());
// 设置订单验证码
orderService.update(new LambdaUpdateWrapper<Order>().set(Order::getVerificationCode, code).eq(Order::getSn, orderMessage.getOrderSn()));
// 修改虚拟订单货物可以进行售后、投诉
orderItemService.update(new LambdaUpdateWrapper<OrderItem>().eq(OrderItem::getOrderSn, orderMessage.getOrderSn()).set(OrderItem::getAfterSaleStatus, OrderItemAfterSaleStatusEnum.NOT_APPLIED).set(OrderItem::getCommentStatus, OrderComplaintStatusEnum.NO_APPLY));
}
}
Aggregations