用枚举来进行菜单和角色的绑定

2018-06-18 02:16:02来源:未知 阅读 ()

新老客户大回馈,云服务器低至5折

一级菜单:

@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum MethodMenuGroup {

tenant(true,0,"用户管理"),contractstats(false,1,"合同统计"),cert(true,2,"证书管理"),
system(true,3,"系统设置"),permission(true,4,"权限管理"),server(true,5,"服务管理"),systemaccess(false,6,"系统接入");

private Boolean visible;
private Integer order;
private String disName;

private MethodMenuGroup(Boolean visible,Integer order,String disName){
this.visible = visible;
this.order = order;
this.disName = disName;
}

public Boolean getVisible() {
return visible;
}

public Integer getOrder() {
return order;
}

public String getName(){
return disName;
}

public String getKey() {
return name();
}

}

 

二级菜单:

/**
* 菜单表的原始信息枚举
* @author xushuai
*
*/
@JsonFormat(shape = JsonFormat.Shape.OBJECT)
public enum ResourceMenu {
companyUser(0,MethodMenuGroup.tenant,"企业用户"),
companyAuthList(1,MethodMenuGroup.tenant,"企业认证"),
personUser(2,MethodMenuGroup.tenant,"个人用户"),
// personAuthList(3,MethodMenuGroup.tenant,"实名认证"),


contractStats(0,MethodMenuGroup.contractstats,"合同统计"),

certStats(0,MethodMenuGroup.cert,"证书统计"),
certManage(1,MethodMenuGroup.cert,"事件证书"),

commonSetting(0,MethodMenuGroup.system,"通用设置"),
paramSetting(1,MethodMenuGroup.system,"系统参数设置"),

accountManage(1,MethodMenuGroup.permission,"账号管理"),
roleManage(2,MethodMenuGroup.permission,"角色管理"),

systemLogs(0,MethodMenuGroup.server,"系统日志"),
monitClusters(1,MethodMenuGroup.server,"服务监控"),
serviceClusters(2,MethodMenuGroup.server,"服务集群"),

systemAccess(0,MethodMenuGroup.systemaccess,"系统接入");

private Integer order;
private MethodMenuGroup groupType;
private String menuName;

private ResourceMenu(Integer order,MethodMenuGroup groupType,String menuName){
this.order = order;
this.groupType = groupType;
this.menuName = menuName;
}



public Integer getOrder() {
return order;
}

 

public MethodMenuGroup getGroupType() {
return groupType;
}
public String getMenuName() {
return menuName;
}
public String getKey() {
return name();
}
}

 

 

将二级菜单 和 角色id关联一起 入库即可,节省很多的代码

标签:

版权申明:本站文章部分自网络,如有侵权,请联系:west999com@outlook.com
特别注意:本站所有转载文章言论不代表本站观点,本站所提供的摄影照片,插画,设计作品,如需使用,请与原作者联系,版权归原作者所有

上一篇:IntelliJ IDEA 创建Spring+SpringMVC+hibernate+maven项目

下一篇:List集合就这么简单【源码剖析】