feat:收藏页数据接口设置权限
This commit is contained in:
parent
52e58019fc
commit
d549cc6b73
|
|
@ -6,6 +6,7 @@ import lombok.Data;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public class FileInfoVO {
|
public class FileInfoVO {
|
||||||
|
|
@ -53,4 +54,7 @@ public class FileInfoVO {
|
||||||
|
|
||||||
// 是否是个人数据,1是,0否
|
// 是否是个人数据,1是,0否
|
||||||
private Integer isPersonal;
|
private Integer isPersonal;
|
||||||
|
|
||||||
|
// 文件权限
|
||||||
|
private Map<String,Boolean> permissions;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,18 @@
|
||||||
package com.electromagnetic.industry.software.manage.service;
|
package com.electromagnetic.industry.software.manage.service;
|
||||||
|
|
||||||
|
import com.electromagnetic.industry.software.common.enums.FilePermission;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
|
||||||
public interface PermissionService {
|
public interface PermissionService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户对个人数据拥有所有权限
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Map<String, Boolean> getPersonalPermission();
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询当前用户在当前目录的功能权限
|
* 查询当前用户在当前目录的功能权限
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -20,6 +20,7 @@ import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.electromagnetic.industry.software.common.enums.*;
|
import com.electromagnetic.industry.software.common.enums.*;
|
||||||
|
import com.electromagnetic.industry.software.common.enums.FilePermission;
|
||||||
import com.electromagnetic.industry.software.common.exception.BizException;
|
import com.electromagnetic.industry.software.common.exception.BizException;
|
||||||
import com.electromagnetic.industry.software.common.exception.PermissionDeniedException;
|
import com.electromagnetic.industry.software.common.exception.PermissionDeniedException;
|
||||||
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
import com.electromagnetic.industry.software.common.resp.ElectromagneticResult;
|
||||||
|
|
@ -1420,6 +1421,11 @@ public class EdFileInfoServiceImpl extends ServiceImpl<EdFileInfoMapper, EdFileI
|
||||||
e.setFileSizeShow(EleCommonUtil.convertFileSize(e.getFileSize()));
|
e.setFileSizeShow(EleCommonUtil.convertFileSize(e.getFileSize()));
|
||||||
e.setIsFavorite(isFavorite(UserThreadLocal.getUserId(), e.getId()) ? 1 : 0);
|
e.setIsFavorite(isFavorite(UserThreadLocal.getUserId(), e.getId()) ? 1 : 0);
|
||||||
e.setIsPersonal(e.getCreatedBy() == UserThreadLocal.getUserId() ? 1 : 0);
|
e.setIsPersonal(e.getCreatedBy() == UserThreadLocal.getUserId() ? 1 : 0);
|
||||||
|
// 设置权限
|
||||||
|
Map<String, Boolean> permissions = (e.getIsPersonal() == 1)
|
||||||
|
? permissionService.getPersonalPermission()
|
||||||
|
: permissionService.getUserPermission(UserThreadLocal.getUserId(), e.getId(), false);
|
||||||
|
e.setPermissions(permissions);
|
||||||
});
|
});
|
||||||
UserThreadLocal.setSuccessInfo("", "", "查询了收藏列表");
|
UserThreadLocal.setSuccessInfo("", "", "查询了收藏列表");
|
||||||
return fileInfoVOIPage;
|
return fileInfoVOIPage;
|
||||||
|
|
|
||||||
|
|
@ -30,6 +30,15 @@ public class PermissionServiceImpl implements PermissionService {
|
||||||
@Resource
|
@Resource
|
||||||
EdFileInfoMapper edFileInfoMapper;
|
EdFileInfoMapper edFileInfoMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户对个人数据拥有所有权限
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public Map<String, Boolean> getPersonalPermission() {
|
||||||
|
return transToMap(FilePermission.getAllCodes(), true);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询当前用户在当前目录的功能权限
|
* 查询当前用户在当前目录的功能权限
|
||||||
*
|
*
|
||||||
|
|
@ -122,7 +131,7 @@ public class PermissionServiceImpl implements PermissionService {
|
||||||
@Override
|
@Override
|
||||||
public Map<String, Boolean> transToMap(List<String> permissionCodes, Boolean includeView) {
|
public Map<String, Boolean> transToMap(List<String> permissionCodes, Boolean includeView) {
|
||||||
Map<String, Boolean> result = new HashMap<>();
|
Map<String, Boolean> result = new HashMap<>();
|
||||||
List<String> allCodes = new ArrayList<>();
|
List<String> allCodes;
|
||||||
if (includeView.equals(Boolean.TRUE)) {
|
if (includeView.equals(Boolean.TRUE)) {
|
||||||
allCodes = FilePermission.getAllCodes();
|
allCodes = FilePermission.getAllCodes();
|
||||||
} else {
|
} else {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue