|
@@ -402,13 +402,22 @@ public class SysFileServiceImpl extends ServiceImpl<SysFileDao, SysFile> impleme
|
|
|
List<Long> ids = sysFile.getIds();
|
|
|
Long category_id = sysFile.getCategory_id();
|
|
|
|
|
|
- // 判断文件是否存在
|
|
|
+ // 判断 文件分类ID 是否存在
|
|
|
+ Boolean isExist = sysFileCategoryDao.exists(new LambdaQueryWrapper<SysFileCategory>().eq(SysFileCategory::getId, category_id));
|
|
|
+ if (!isExist) throw new CustException("文件分类不存在");
|
|
|
+
|
|
|
+ // [DB] 批量更新 分类ID
|
|
|
+ SysFile entity = new SysFile();
|
|
|
+ entity.setCategory_id(category_id);
|
|
|
+
|
|
|
+ // 查询条件 (当前用户, ids)
|
|
|
LambdaQueryWrapper<SysFile> wrapperFile = new LambdaQueryWrapper<>();
|
|
|
wrapperFile.eq(SysFile::getUser_id, sysFile.getUser_id());
|
|
|
-// wrapperFile.in(ids);
|
|
|
- List<SysFile> sysFileList = sysFileDao.selectList(wrapperFile);
|
|
|
+ wrapperFile.in(SysFile::getId, ids);
|
|
|
+
|
|
|
+ sysFileDao.update(entity, wrapperFile);
|
|
|
|
|
|
- return null;
|
|
|
+ return Map.of("ids", ids);
|
|
|
}
|
|
|
|
|
|
}
|