Search in sources :

Example 6 with LambdaUpdateWrapper

use of com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper in project qiwen-file by qiwenshare.

the class FileController method renameFile.

@Operation(summary = "文件重命名", description = "文件重命名", tags = { "file" })
@RequestMapping(value = "/renamefile", method = RequestMethod.POST)
@MyLog(operation = "文件重命名", module = CURRENT_MODULE)
@ResponseBody
public RestResult<String> renameFile(@RequestBody RenameFileDTO renameFileDto) {
    JwtUser sessionUserBean = SessionUtil.getSession();
    UserFile userFile = userFileService.getById(renameFileDto.getUserFileId());
    List<UserFile> userFiles = userFileService.selectUserFileByNameAndPath(renameFileDto.getFileName(), userFile.getFilePath(), sessionUserBean.getUserId());
    if (userFiles != null && !userFiles.isEmpty()) {
        return RestResult.fail().message("同名文件已存在");
    }
    LambdaUpdateWrapper<UserFile> lambdaUpdateWrapper = new LambdaUpdateWrapper<>();
    lambdaUpdateWrapper.set(UserFile::getFileName, renameFileDto.getFileName()).set(UserFile::getUploadTime, DateUtil.getCurrentTime()).eq(UserFile::getUserFileId, renameFileDto.getUserFileId());
    userFileService.update(lambdaUpdateWrapper);
    if (1 == userFile.getIsDir()) {
        List<UserFile> list = userFileService.selectFileListLikeRightFilePath(userFile.getFilePath() + userFile.getFileName() + "/", sessionUserBean.getUserId());
        for (UserFile newUserFile : list) {
            newUserFile.setFilePath(newUserFile.getFilePath().replaceFirst(userFile.getFilePath() + userFile.getFileName() + "/", userFile.getFilePath() + renameFileDto.getFileName() + "/"));
            userFileService.updateById(newUserFile);
        }
    }
    fileDealComp.uploadESByUserFileId(renameFileDto.getUserFileId());
    return RestResult.success();
}
Also used : LambdaUpdateWrapper(com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper) UserFile(com.qiwenshare.file.domain.UserFile) JwtUser(com.qiwenshare.common.util.security.JwtUser) Operation(io.swagger.v3.oas.annotations.Operation) MyLog(com.qiwenshare.common.anno.MyLog)

Example 7 with LambdaUpdateWrapper

use of com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper in project qiwen-file by qiwenshare.

the class UserFileService method updateFileDeleteStateByFilePath.

private void updateFileDeleteStateByFilePath(String filePath, String deleteBatchNum, Long userId) {
    executor.execute(() -> {
        List<UserFile> fileList = selectFileListLikeRightFilePath(filePath, userId);
        for (int i = 0; i < fileList.size(); i++) {
            UserFile userFileTemp = fileList.get(i);
            // 标记删除标志
            LambdaUpdateWrapper<UserFile> userFileLambdaUpdateWrapper1 = new LambdaUpdateWrapper<>();
            userFileLambdaUpdateWrapper1.set(UserFile::getDeleteFlag, RandomUtil.randomInt(FileConstant.deleteFileRandomSize)).set(UserFile::getDeleteTime, DateUtil.getCurrentTime()).set(UserFile::getDeleteBatchNum, deleteBatchNum).eq(UserFile::getUserFileId, userFileTemp.getUserFileId()).eq(UserFile::getDeleteFlag, 0);
            userFileMapper.update(null, userFileLambdaUpdateWrapper1);
        }
    });
}
Also used : LambdaUpdateWrapper(com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper) UserFile(com.qiwenshare.file.domain.UserFile)

Example 8 with LambdaUpdateWrapper

use of com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper in project jeeagile by jeeagile.

the class AgileSysDictTypeServiceImpl method updateModel.

@Override
public boolean updateModel(AgileSysDictType agileSysDictType) {
    this.validateData(agileSysDictType);
    AgileSysDictType oldAgileSysDictType = this.getById(agileSysDictType.getId());
    if (oldAgileSysDictType.getDictType() != agileSysDictType.getDictType()) {
        LambdaUpdateWrapper<AgileSysDictData> lambdaUpdateWrapper = new UpdateWrapper().lambda();
        lambdaUpdateWrapper.set(AgileSysDictData::getDictType, agileSysDictType.getDictType());
        lambdaUpdateWrapper.eq(AgileSysDictData::getDictType, oldAgileSysDictType.getDictType());
        agileSysDictDataService.update(lambdaUpdateWrapper);
    }
    return this.updateById(agileSysDictType);
}
Also used : AgileSysDictData(com.jeeagile.system.entity.AgileSysDictData) UpdateWrapper(com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper) LambdaUpdateWrapper(com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper) AgileSysDictType(com.jeeagile.system.entity.AgileSysDictType)

Example 9 with LambdaUpdateWrapper

use of com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper in project kms 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 10 with LambdaUpdateWrapper

use of com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper in project RuoYi-Vue-Plus by JavaLionLi.

the class SysOssConfigServiceImpl method updateByBo.

@Override
public Boolean updateByBo(SysOssConfigBo bo) {
    SysOssConfig config = BeanUtil.toBean(bo, SysOssConfig.class);
    validEntityBeforeSave(config);
    LambdaUpdateWrapper<SysOssConfig> luw = new LambdaUpdateWrapper<>();
    luw.set(StringUtils.isBlank(config.getPrefix()), SysOssConfig::getPrefix, "");
    luw.set(StringUtils.isBlank(config.getRegion()), SysOssConfig::getRegion, "");
    luw.set(StringUtils.isBlank(config.getExt1()), SysOssConfig::getExt1, "");
    luw.eq(SysOssConfig::getOssConfigId, config.getOssConfigId());
    return setConfigCache(baseMapper.update(config, luw) > 0, config);
}
Also used : LambdaUpdateWrapper(com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper) SysOssConfig(com.ruoyi.system.domain.SysOssConfig)

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