Search in sources :

Example 6 with GroupZtreeVo

use of com.paascloud.provider.model.vo.GroupZtreeVo in project paascloud-master by paascloud.

the class UacGroupServiceImpl method getGroupTreeListByUserId.

@Override
@Transactional(readOnly = true, rollbackFor = Exception.class)
public List<MenuVo> getGroupTreeListByUserId(Long userId) {
    UacGroupUser groupUser = uacGroupUserMapper.getByUserId(userId);
    Long groupId = groupUser.getGroupId();
    // 查询当前登陆人所在的组织信息
    UacGroup currentUserUacGroup = uacGroupMapper.selectByPrimaryKey(groupId);
    // 获取当前所选组织的所有子节点
    List<GroupZtreeVo> childUacGroupList = this.getGroupTree(currentUserUacGroup.getId());
    return this.buildGroupTree(childUacGroupList, groupId);
}
Also used : GroupZtreeVo(com.paascloud.provider.model.vo.GroupZtreeVo) UacGroup(com.paascloud.provider.model.domain.UacGroup) UacGroupUser(com.paascloud.provider.model.domain.UacGroupUser) Transactional(org.springframework.transaction.annotation.Transactional)

Example 7 with GroupZtreeVo

use of com.paascloud.provider.model.vo.GroupZtreeVo in project paascloud-master by paascloud.

the class UacGroupServiceImpl method getGroupTree.

@Override
@Transactional(readOnly = true, rollbackFor = Exception.class)
public List<GroupZtreeVo> getGroupTree(Long groupId) {
    // 1. 如果是仓库则 直接把仓库信息封装成ztreeVo返回
    List<GroupZtreeVo> tree = Lists.newArrayList();
    UacGroup uacGroup = uacGroupMapper.selectByPrimaryKey(groupId);
    GroupZtreeVo zTreeMenuVo = buildGroupZTreeVoByGroup(uacGroup);
    if (0L == uacGroup.getPid()) {
        zTreeMenuVo.setOpen(true);
    }
    tree.add(zTreeMenuVo);
    // 2.如果是组织id则遍历组织+仓库的树结构
    // 如果是组织 则查询父id为
    UacGroup uacGroupQuery = new UacGroup();
    uacGroupQuery.setPid(groupId);
    List<UacGroup> groupList = uacGroupMapper.select(uacGroupQuery);
    if (PublicUtil.isNotEmpty(groupList)) {
        tree = buildNode(groupList, tree);
    }
    return tree;
}
Also used : GroupZtreeVo(com.paascloud.provider.model.vo.GroupZtreeVo) UacGroup(com.paascloud.provider.model.domain.UacGroup) Transactional(org.springframework.transaction.annotation.Transactional)

Aggregations

GroupZtreeVo (com.paascloud.provider.model.vo.GroupZtreeVo)7 UacGroup (com.paascloud.provider.model.domain.UacGroup)5 UacGroupUser (com.paascloud.provider.model.domain.UacGroupUser)2 Transactional (org.springframework.transaction.annotation.Transactional)2 LoginAuthDto (com.paascloud.base.dto.LoginAuthDto)1 UacBizException (com.paascloud.provider.model.exceptions.UacBizException)1 MenuVo (com.paascloud.provider.model.vo.MenuVo)1 ApiOperation (io.swagger.annotations.ApiOperation)1