|
@@ -72,7 +72,6 @@ public class AuthorizeServiceImpl extends ServiceImpl<AuthorizeMapper, Authorize
|
|
|
private final MenuMapper menuMapper;
|
|
|
|
|
|
|
|
|
-
|
|
|
@Override
|
|
|
public PermissionVo getPermissions() {
|
|
|
|
|
@@ -113,7 +112,7 @@ public class AuthorizeServiceImpl extends ServiceImpl<AuthorizeMapper, Authorize
|
|
|
formList = menuFormMapper.selectList(null);
|
|
|
} else {
|
|
|
List<Authorize> authorizeList = authorizeMapper.selectList(Wrappers.lambdaQuery(Authorize.class)
|
|
|
- .in(roleIdList.size() > 0,Authorize::getRoleId, roleIdList)
|
|
|
+ .in(roleIdList.size() > 0, Authorize::getRoleId, roleIdList)
|
|
|
);
|
|
|
|
|
|
List<Long> buttonIds = authorizeList.stream().filter(x -> x.getAuthorizeType() == AuthorizeType.BUTTON.getCode()).map(Authorize::getObjectId).collect(Collectors.toList());
|
|
@@ -126,7 +125,7 @@ public class AuthorizeServiceImpl extends ServiceImpl<AuthorizeMapper, Authorize
|
|
|
List<Long> columnIds = authorizeList.stream().filter(x -> x.getAuthorizeType() == AuthorizeType.COLUMN.getCode()).map(Authorize::getObjectId).collect(Collectors.toList());
|
|
|
if (columnIds.size() > 0) {
|
|
|
LambdaQueryWrapper<MenuColumn> queryWrapper = Wrappers.lambdaQuery(MenuColumn.class);
|
|
|
- queryWrapper.in(MenuColumn::getId, columnIds).select(MenuColumn::getMenuId,MenuColumn::getCode);
|
|
|
+ queryWrapper.in(MenuColumn::getId, columnIds).select(MenuColumn::getMenuId, MenuColumn::getCode);
|
|
|
columnList = menuColumnMapper.selectList(queryWrapper);
|
|
|
}
|
|
|
|
|
@@ -147,7 +146,7 @@ public class AuthorizeServiceImpl extends ServiceImpl<AuthorizeMapper, Authorize
|
|
|
vo.setButtonAuthCode(buttonList.stream().filter(x -> x.getMenuId().equals(menu.getId())).map(MenuButton::getCode).collect(Collectors.toSet()));
|
|
|
vo.setColumnAuthCode(columnList.stream().filter(x -> x.getMenuId().equals(menu.getId())).map(MenuColumn::getCode).collect(Collectors.toSet()));
|
|
|
// 处理表单字段,可能存在子表的情况
|
|
|
- Set<Object> formAuthCodeList= new LinkedHashSet<>(formTreeVoList.size());
|
|
|
+ Set<Object> formAuthCodeList = new LinkedHashSet<>(formTreeVoList.size());
|
|
|
for (MenuFormTreeVo treeVo : formTreeVoList) {
|
|
|
if (treeVo.getMenuId().equals(menu.getId())) {
|
|
|
List<MenuFormTreeVo> children = treeVo.getChildren();
|
|
@@ -169,8 +168,13 @@ public class AuthorizeServiceImpl extends ServiceImpl<AuthorizeMapper, Authorize
|
|
|
}
|
|
|
|
|
|
// 自定义接口权限
|
|
|
- List<InterfaceAuth> interfaceAuthList = interfaceAuthMapper.selectList(Wrappers.lambdaQuery(InterfaceAuth.class)
|
|
|
- .in(InterfaceAuth::getRoleId, roleIdList));
|
|
|
+ List<InterfaceAuth> interfaceAuthList = new ArrayList<>();
|
|
|
+ if (roleIdList.size() > 0) { // 学生和家长 没有
|
|
|
+ interfaceAuthList = interfaceAuthMapper.selectList(Wrappers.lambdaQuery(InterfaceAuth.class)
|
|
|
+ .in(InterfaceAuth::getRoleId, roleIdList));
|
|
|
+ }
|
|
|
+// List<InterfaceAuth> interfaceAuthList = interfaceAuthMapper.selectList(Wrappers.lambdaQuery(InterfaceAuth.class)
|
|
|
+// .in(InterfaceAuth::getRoleId, roleIdList));
|
|
|
if (CollectionUtils.isNotEmpty(interfaceAuthList)) {
|
|
|
List<String> interfaceIdList = interfaceAuthList.stream().map(InterfaceAuth::getInterfaceId).collect(Collectors.toList());
|
|
|
tokenSession.set(GlobalConstant.LOGIN_USER_INTERFACE_AUTH_CODE_KEY, interfaceIdList);
|
|
@@ -301,7 +305,7 @@ public class AuthorizeServiceImpl extends ServiceImpl<AuthorizeMapper, Authorize
|
|
|
List<T> children = treeVo.getChildren();
|
|
|
if (CollectionUtils.isNotEmpty(children)) {
|
|
|
buildLastChildIds(children, idList, parentIdList);
|
|
|
- } else if (!parentIdList.contains(treeVo.getId())){
|
|
|
+ } else if (!parentIdList.contains(treeVo.getId())) {
|
|
|
idList.add(treeVo.getId());
|
|
|
}
|
|
|
}
|
|
@@ -323,10 +327,10 @@ public class AuthorizeServiceImpl extends ServiceImpl<AuthorizeMapper, Authorize
|
|
|
/**
|
|
|
* 构建授权数据
|
|
|
*
|
|
|
- * @param roleId 角色id
|
|
|
- * @param itemIdList 菜单id
|
|
|
- * @param itemType 菜单类型,0-菜单,1-按钮,2-列表字段,3-表单字段
|
|
|
- * @param authorizeList 构建的保存对象集合
|
|
|
+ * @param roleId 角色id
|
|
|
+ * @param itemIdList 菜单id
|
|
|
+ * @param itemType 菜单类型,0-菜单,1-按钮,2-列表字段,3-表单字段
|
|
|
+ * @param authorizeList 构建的保存对象集合
|
|
|
*/
|
|
|
private void buildAuthorize(Long roleId, List<Long> itemIdList, Integer itemType, List<Authorize> authorizeList) {
|
|
|
if (CollectionUtils.isNotEmpty(itemIdList)) {
|