Search in sources :

Example 11 with LambdaUpdateWrapper

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);
    }
}
Also used : UpdateWrapper(com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper) LambdaUpdateWrapper(com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper)

Example 12 with LambdaUpdateWrapper

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;
}
Also used : SysAnnouncementSend(org.jeecg.modules.system.entity.SysAnnouncementSend) UpdateWrapper(com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper) LambdaUpdateWrapper(com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper) LoginUser(org.jeecg.common.system.vo.LoginUser) Date(java.util.Date) Result(org.jeecg.common.api.vo.Result) PutMapping(org.springframework.web.bind.annotation.PutMapping)

Example 13 with LambdaUpdateWrapper

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;
}
Also used : LambdaUpdateWrapper(com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper) StoreDetail(cn.lili.modules.store.entity.dos.StoreDetail) ServiceException(cn.lili.common.exception.ServiceException) Store(cn.lili.modules.store.entity.dos.Store) Member(cn.lili.modules.member.entity.dos.Member) Transactional(org.springframework.transaction.annotation.Transactional)

Example 14 with LambdaUpdateWrapper

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;
}
Also used : LambdaUpdateWrapper(com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper) Goods(cn.lili.modules.goods.entity.dos.Goods) AuthUser(cn.lili.common.security.AuthUser)

Example 15 with LambdaUpdateWrapper

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));
    }
}
Also used : Order(cn.lili.modules.order.order.entity.dos.Order) LambdaUpdateWrapper(com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper) OrderItem(cn.lili.modules.order.order.entity.dos.OrderItem)

Aggregations

LambdaUpdateWrapper (com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper)47 Transactional (org.springframework.transaction.annotation.Transactional)11 UpdateWrapper (com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper)10 Date (java.util.Date)7 Result (org.jeecg.common.api.vo.Result)6 LoginUser (org.jeecg.common.system.vo.LoginUser)6 SysAnnouncementSend (org.jeecg.modules.system.entity.SysAnnouncementSend)6 Test (org.junit.jupiter.api.Test)6 SpringBootTest (org.springframework.boot.test.context.SpringBootTest)6 PutMapping (org.springframework.web.bind.annotation.PutMapping)6 OrderItem (cn.lili.modules.order.order.entity.dos.OrderItem)5 LambdaQueryWrapper (com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper)5 User (com.maxqiu.demo.entity.User)5 DateTime (cn.hutool.core.date.DateTime)4 UserFile (com.qiwenshare.file.domain.UserFile)4 ServiceException (cn.lili.common.exception.ServiceException)3 Order (cn.lili.modules.order.order.entity.dos.Order)3 SysOssConfig (com.ruoyi.system.domain.SysOssConfig)3 DistributionOrder (cn.lili.modules.distribution.entity.dos.DistributionOrder)2 GoodsSku (cn.lili.modules.goods.entity.dos.GoodsSku)2