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();
}
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);
}
});
}
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);
}
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);
}
}
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);
}
Aggregations