use of com.qiwenshare.file.domain.FilePermission in project qiwen-file by qiwenshare.
the class CommonFileController method commonFile.
@Operation(summary = "共享文件", description = "共享文件统一接口", tags = { "common" })
@PostMapping(value = "/commonfile")
@MyLog(operation = "共享文件", module = CURRENT_MODULE)
@ResponseBody
public RestResult<String> commonFile(@RequestBody CommonFileDTO commonFileDTO) {
CommonFile commonFile = new CommonFile();
commonFile.setUserFileId(commonFileDTO.getUserFileId());
commonFileService.save(commonFile);
List<Long> list = JSON.parseArray(commonFileDTO.getCommonUserIds(), Long.class);
List<FilePermission> filePermissionList = new ArrayList<>();
for (Long userId : list) {
FilePermission filePermission = new FilePermission();
filePermission.setUserId(Long.parseLong(commonFileDTO.getCommonUserIds()));
filePermission.setCommonFileId(commonFile.commonFileId);
filePermission.setFilePermissionCode(commonFileDTO.getPermissionCode());
filePermissionList.add(filePermission);
}
filePermissionService.saveBatch(filePermissionList);
return RestResult.success();
}
Aggregations