Search in sources :

Example 1 with AppDefine

use of com.ibeiliao.deployment.admin.vo.account.AppDefine in project Corgi by kevinYin.

the class EditRoleController method listAllAppMenu.

/**
 * 读取所有APP的菜单,及角色的菜单权限
 * @param roleId 角色ID
 * @return
 */
@MenuResource("读取角色菜单")
@RequestMapping("allAppMenus")
@ResponseBody
public Map<String, Object> listAllAppMenu(int roleId) {
    Map<String, Object> map = new HashMap<>(4);
    List<AppDefine> apps = appService.listAll();
    List<MenuItem> appMenus = new ArrayList<>(apps.size());
    for (AppDefine app : apps) {
        appMenus.add(menuService.getMenuTree(app.getAppId()));
    }
    map.put("success", Boolean.TRUE);
    map.put("appList", apps);
    map.put("appMenus", appMenus);
    if (roleId > 0) {
        List<RoleMenuRelation> menuIds = roleService.listRoleMenus(roleId);
        map.put("menuIds", menuIds);
        Role role = roleService.getById(roleId);
        map.put("role", role);
        List<RoleResRelation> resList = roleService.listRoleResources(roleId);
        map.put("resIds", resList);
    }
    return map;
}
Also used : HashMap(java.util.HashMap) ArrayList(java.util.ArrayList) MenuItem(com.ibeiliao.deployment.admin.utils.resource.MenuItem) Role(com.ibeiliao.deployment.admin.vo.account.Role) RoleResRelation(com.ibeiliao.deployment.admin.vo.account.RoleResRelation) AppDefine(com.ibeiliao.deployment.admin.vo.account.AppDefine) RoleMenuRelation(com.ibeiliao.deployment.admin.vo.account.RoleMenuRelation) MenuResource(com.ibeiliao.deployment.admin.utils.resource.MenuResource) RequestMapping(org.springframework.web.bind.annotation.RequestMapping) ResponseBody(org.springframework.web.bind.annotation.ResponseBody)

Aggregations

MenuItem (com.ibeiliao.deployment.admin.utils.resource.MenuItem)1 MenuResource (com.ibeiliao.deployment.admin.utils.resource.MenuResource)1 AppDefine (com.ibeiliao.deployment.admin.vo.account.AppDefine)1 Role (com.ibeiliao.deployment.admin.vo.account.Role)1 RoleMenuRelation (com.ibeiliao.deployment.admin.vo.account.RoleMenuRelation)1 RoleResRelation (com.ibeiliao.deployment.admin.vo.account.RoleResRelation)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 RequestMapping (org.springframework.web.bind.annotation.RequestMapping)1 ResponseBody (org.springframework.web.bind.annotation.ResponseBody)1