use of com.paascloud.provider.model.domain.UacGroup in project paascloud-master by paascloud.
the class UacGroupServiceImpl method deleteUacGroupById.
@Override
public int deleteUacGroupById(Long id) {
Preconditions.checkArgument(id != null, "组织id为空");
Preconditions.checkArgument(!Objects.equals(id, GlobalConstant.Sys.SUPER_MANAGER_GROUP_ID), "该组织不能删除");
// 根据前台传入的组织参数校验该组织是否存在
UacGroup uacGroup = uacGroupMapper.selectByPrimaryKey(id);
if (PublicUtil.isEmpty(uacGroup)) {
throw new UacBizException(ErrorCodeEnum.UAC10015004, id);
}
// 判断该组织下是否存在子节点
UacGroup childGroup = new UacGroup();
childGroup.setPid(id);
List<UacGroup> childGroupList = uacGroupMapper.select(childGroup);
if (PublicUtil.isNotEmpty(childGroupList)) {
throw new UacBizException(ErrorCodeEnum.UAC10015007, id);
}
// 判断该组织下是否存在用户
UacGroupUser uacGroupUser = new UacGroupUser();
uacGroupUser.setGroupId(id);
List<UacGroupUser> uacGroupUserList = uacGroupUserMapper.select(uacGroupUser);
if (PublicUtil.isNotEmpty(uacGroupUserList)) {
throw new UacBizException(ErrorCodeEnum.UAC10015008, id);
}
return mapper.deleteByPrimaryKey(id);
}
use of com.paascloud.provider.model.domain.UacGroup 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;
}
Aggregations