Search in sources :

Example 1 with FilePermission

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();
}
Also used : CommonFile(com.qiwenshare.file.domain.CommonFile) ArrayList(java.util.ArrayList) FilePermission(com.qiwenshare.file.domain.FilePermission) Operation(io.swagger.v3.oas.annotations.Operation) MyLog(com.qiwenshare.common.anno.MyLog)

Aggregations

MyLog (com.qiwenshare.common.anno.MyLog)1 CommonFile (com.qiwenshare.file.domain.CommonFile)1 FilePermission (com.qiwenshare.file.domain.FilePermission)1 Operation (io.swagger.v3.oas.annotations.Operation)1 ArrayList (java.util.ArrayList)1