当前自己写了一串代码先用着,但是总觉得很啰嗦
Subject subject = SecurityUtils.getSubject();
Sys_user curUser = (Sys_user) subject.getPrincipal();
List<String> codeList = suserService.getRoleCodeList(curUser);
int totalLvl = 0;
for(String code : codeList) {
List<Sys_role> roleList = Daos.ext(roleService.dao(), FieldFilter.create(Sys_role.class, "^id|name$")).query(Sys_role.class, Cnd.where("disabled", "=", 0).and("Code","=",code));
for (Sys_role role : roleList)
{
if(role.getName().equals("角色1")){
totalLvl = 1;
break;
} else if (role.getName().equals("角色2")) {
totalLvl = 2;
break;
}
}
if(totalLvl != 0)
{
break;
}
}