角色列表,功能权限,英文转换成中文
This commit is contained in:
parent
39e8afee9c
commit
fa44e8b7da
|
|
@ -30,10 +30,7 @@ import org.springframework.stereotype.Service;
|
||||||
import org.springframework.transaction.annotation.Transactional;
|
import org.springframework.transaction.annotation.Transactional;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
import static com.electromagnetic.industry.software.common.cons.ElectromagneticConstants.PRJ_PARENT_ID;
|
import static com.electromagnetic.industry.software.common.cons.ElectromagneticConstants.PRJ_PARENT_ID;
|
||||||
|
|
@ -235,7 +232,14 @@ public class RoleServiceImpl extends ServiceImpl<RoleMapper, Role> implements Ro
|
||||||
if (StringUtils.isNotBlank(rolePageDTO.getRoleName())) {
|
if (StringUtils.isNotBlank(rolePageDTO.getRoleName())) {
|
||||||
queryWrapper.eq("r.role_name", rolePageDTO.getRoleName());
|
queryWrapper.eq("r.role_name", rolePageDTO.getRoleName());
|
||||||
}
|
}
|
||||||
return roleMapper.getPageRoleDTO(page, queryWrapper);
|
IPage<RoleDTO> result = roleMapper.getPageRoleDTO(page, queryWrapper);
|
||||||
|
for (RoleDTO roleDTO : result.getRecords()) {
|
||||||
|
if (roleDTO.getAllowedActions() != null ) {
|
||||||
|
String chineseString = Arrays.stream(roleDTO.getAllowedActions().split(",")).map(FilePermission::toDescription).collect(Collectors.joining(","));
|
||||||
|
roleDTO.setAllowedActions(chineseString);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -6,14 +6,14 @@ import java.util.List;
|
||||||
public enum FilePermission {
|
public enum FilePermission {
|
||||||
|
|
||||||
// 权限枚举值
|
// 权限枚举值
|
||||||
VIEW("view", "查看文件"),
|
VIEW("view", "查看"),
|
||||||
MOVE("move", "移动/复制文件"),
|
MOVE("move", "移动/复制"),
|
||||||
EDIT("edit", "编辑文件"),
|
EDIT("edit", "编辑"),
|
||||||
DELETE("delete", "删除文件"),
|
DELETE("delete", "删除"),
|
||||||
UPLOAD("upload", "上传文件"),
|
UPLOAD("upload", "上传"),
|
||||||
DOWNLOAD("download", "下载文件"),
|
DOWNLOAD("download", "下载"),
|
||||||
IMPORT("import", "导入文件"),
|
IMPORT("import", "导入"),
|
||||||
EXPORT("export", "导出文件");
|
EXPORT("export", "导出");
|
||||||
|
|
||||||
// 枚举属性
|
// 枚举属性
|
||||||
private final String code; // 权限代码
|
private final String code; // 权限代码
|
||||||
|
|
@ -53,5 +53,10 @@ public enum FilePermission {
|
||||||
public String getDescription() {
|
public String getDescription() {
|
||||||
return description;
|
return description;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 转换成权限描述
|
||||||
|
public static String toDescription(String code) {
|
||||||
|
return fromCode(code).getDescription();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue