Search in sources :

Example 1 with SysFunc

use of com.artlongs.sys.model.SysFunc in project act-eagle-allone by mailtous.

the class SysFuncController method onOff.

private R onOff(Long funcId, int onOff) {
    SysFunc sysFunc = sysFuncService.get(funcId);
    if (null != sysFunc) {
        sysFunc.setAction(onOff);
        sysFuncService.update(sysFunc);
        sysFuncService.clearMap();
        return new R<>().setSuccess("功能项的状态已变更!");
    }
    return new R<>().setFail("找不到对应的功能或菜单!");
}
Also used : SysFunc(com.artlongs.sys.model.SysFunc)

Example 2 with SysFunc

use of com.artlongs.sys.model.SysFunc in project act-eagle-allone by mailtous.

the class SysFuncService method getParentStackOfNodeId.

/**
 * 按当前节点找出所有父节点,保存到stack
 * @param parentId
 * @return
 */
public Stack<SysFunc> getParentStackOfNodeId(Long nodeId) {
    Stack<SysFunc> funcStacks = new Stack<>();
    while (nodeId.intValue() > 0) {
        SysFunc node = getNodeByTreeMap(nodeId);
        if (node != null) {
            funcStacks.push(node);
            nodeId = node.getParentId();
        } else {
            break;
        }
    }
    return funcStacks;
}
Also used : SysFunc(com.artlongs.sys.model.SysFunc)

Example 3 with SysFunc

use of com.artlongs.sys.model.SysFunc in project act-eagle-allone by mailtous.

the class SysFuncService method buildFuncTree.

/**
 * 构造所有菜单的子菜单
 * @param moduleMap
 * @return
 */
public SysFunc buildFuncTree(Map<Long, List<SysFunc>> moduleMap) {
    SysFunc topMenu = SysFunc.blankTopMenu();
    List<SysFunc> allFuncList = getAllFuncOfMap(moduleMap);
    if (C.notEmpty(allFuncList)) {
        for (SysFunc sysFunc : allFuncList) {
            // 构建每层子菜单
            List<SysFunc> childs = moduleMap.get(sysFunc.getId());
            if (C.notEmpty(childs)) {
                sysFunc.setChilds(childs);
                sysFunc.hasChilds = true;
            }
        }
        // 设置顶层的子菜单
        List<SysFunc> topMenuChilds = moduleMap.get(topMenu.getId());
        topMenu.setChilds(topMenuChilds);
    }
    return topMenu;
}
Also used : SysFunc(com.artlongs.sys.model.SysFunc)

Example 4 with SysFunc

use of com.artlongs.sys.model.SysFunc in project act-eagle-allone by mailtous.

the class SysFuncService method parseListToTreeMap.

/**
 * 将模块(功能)列表转化为MAP
 *
 * @param sysFuncList
 * @return
 */
public Map<Long, List<SysFunc>> parseListToTreeMap(List<SysFunc> sysFuncList) {
    Map<Long, List<SysFunc>> map = new HashMap<Long, List<SysFunc>>();
    if (C.notEmpty(sysFuncList)) {
        for (SysFunc func : sysFuncList) {
            List<SysFunc> list = map.containsKey(func.getParentId()) ? map.get(func.getParentId()) : new ArrayList<SysFunc>();
            list.add(func);
            map.put(func.getParentId(), list);
        }
    }
    // 标记父节点
    markHasChild(map);
    // 排序
    sortChilds(map);
    return map;
}
Also used : SysFunc(com.artlongs.sys.model.SysFunc) ConcurrentHashMap(java.util.concurrent.ConcurrentHashMap)

Example 5 with SysFunc

use of com.artlongs.sys.model.SysFunc in project act-eagle-allone by mailtous.

the class SysMenuService method getMyMenu.

/**
 * 按 sysUserId 获取自己拥有的菜单
 * @param sysUserId
 * @return
 */
public SysFunc getMyMenu(Integer sysUserId) {
    SysFunc menu = myMenu.get(sysUserId);
    if (null == menu) {
        menu = SysFunc.blankTopMenu();
        List<SysFunc> myActionFuncs = getMyActionFunc(sysUserId);
        List<SysFunc> myTopMenus = getTopMenu(myActionFuncs);
        menu.setChilds(myTopMenus);
        getChildMenu(menu, myActionFuncs);
        myMenu.putIfAbsent(sysUserId, menu);
    }
    return menu;
}
Also used : SysFunc(com.artlongs.sys.model.SysFunc)

Aggregations

SysFunc (com.artlongs.sys.model.SysFunc)11 GetAction (org.osgl.mvc.annotation.GetAction)3 List (java.util.List)2 R (com.artlongs.framework.vo.R)1 SysPermission (com.artlongs.sys.model.SysPermission)1 SysRole (com.artlongs.sys.model.SysRole)1 ConcurrentHashMap (java.util.concurrent.ConcurrentHashMap)1 PostAction (org.osgl.mvc.annotation.PostAction)1