新增菜单tab页

This commit is contained in:
2023-04-03 09:52:50 +08:00
parent 1875e1e117
commit 4dcad30d5d
5 changed files with 36 additions and 5 deletions

View File

@@ -23,7 +23,7 @@ public interface FunctionState {
String DRIVER_NAME = "/home";
/**
* 权限资源类型 0-菜单、1-按钮、2-公共资源、3-服务间调用资源
* 权限资源类型 0-菜单、1-按钮、2-公共资源、3-服务间调用资源、4-tab页面
*/
int MENU = 0;
@@ -33,4 +33,6 @@ public interface FunctionState {
int IN_SERVICE = 3;
int TAB = 4;
}

View File

@@ -50,7 +50,7 @@ public class FunctionParam {
@ApiModelProperty("资源类型")
@NotNull(message = UserValidMessage.TYPE_NOT_BLANK)
@Range(min = 0, max = 3, message = UserValidMessage.PARAM_FORMAT_ERROR)
@Range(min = 0, max = 4, message = UserValidMessage.PARAM_FORMAT_ERROR)
private Integer type;
@ApiModelProperty("描述")

View File

@@ -49,4 +49,7 @@ public class FunctionVO implements Serializable {
@ApiModelProperty("子级")
List<FunctionVO> children;
@ApiModelProperty("tab数据")
List<FunctionVO> userTab;
}

View File

@@ -14,7 +14,7 @@
FROM
sys_function
WHERE
STATE = 1 AND Type IN(0,1)
STATE = 1 AND Type IN(0,1,4)
</select>
<select id="getFunctionsByList" resultType="FunctionVO">
@@ -29,7 +29,7 @@
FROM
sys_function
WHERE
STATE = 1 AND Type = 0
STATE = 1 AND Type IN (0,4)
AND
Id in
<foreach item="item" index="index" collection="list" open="(" separator="," close=")">

View File

@@ -165,7 +165,8 @@ public class FunctionServiceImpl extends ServiceImpl<FunctionMapper, Function> i
@Override
public List<Function> getButtonsById(String id) {
return this.lambdaQuery().eq(Function::getPid,id).eq(Function::getType,FunctionState.BUTTON).eq(Function::getState,FunctionState.ENABLE).list();
List<Integer> typeList = Arrays.asList(FunctionState.BUTTON,FunctionState.PUBLIC,FunctionState.TAB);
return this.lambdaQuery().eq(Function::getPid,id).in(Function::getType,typeList).eq(Function::getState,FunctionState.ENABLE).orderByAsc(Function::getType).list();
}
@Override
@@ -190,6 +191,8 @@ public class FunctionServiceImpl extends ServiceImpl<FunctionMapper, Function> i
.collect(Collectors.toList());
//组装驾驶舱
setDriverChildren(result);
//处理tab页
setTab(result);
return result;
}
@@ -278,6 +281,29 @@ public class FunctionServiceImpl extends ServiceImpl<FunctionMapper, Function> i
});
}
/**
* 处理tab页
*/
private void setTab(List<FunctionVO> list) {
if (!CollectionUtils.isEmpty(list)){
list.forEach(item->{
List<FunctionVO> children = item.getChildren();
if (!CollectionUtils.isEmpty(children)){
for (FunctionVO child : children) {
List<FunctionVO> children2 = child.getChildren();
if (!CollectionUtils.isEmpty(children2)){
setTab(children2);
} else if (Objects.equals(child.getType(),4)){
item.setUserTab(item.getChildren());
item.setChildren(new ArrayList<>());
break;
}
}
}
});
}
}
/**
* 校验参数,
* 1.检查是否存在相同名称的菜单