| | |
| | | package com.ruoyi.project.system.service.impl;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.Iterator;
|
| | | import java.util.List;
|
| | | import java.util.stream.Collectors;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.stereotype.Service;
|
| | | import com.ruoyi.common.constant.UserConstants;
|
| | | import com.ruoyi.common.core.text.Convert;
|
| | | import com.ruoyi.common.exception.ServiceException;
|
| | |
| | | import com.ruoyi.project.system.mapper.SysDeptMapper;
|
| | | import com.ruoyi.project.system.mapper.SysRoleMapper;
|
| | | import com.ruoyi.project.system.service.ISysDeptService;
|
| | | import lombok.RequiredArgsConstructor;
|
| | | import org.springframework.stereotype.Service;
|
| | |
|
| | | import java.util.ArrayList;
|
| | | import java.util.Iterator;
|
| | | import java.util.List;
|
| | | import java.util.stream.Collectors;
|
| | |
|
| | | /**
|
| | | * 部门管理 服务实现
|
| | | * |
| | | *
|
| | | * @author ruoyi
|
| | | */
|
| | | @Service
|
| | | @RequiredArgsConstructor
|
| | | public class SysDeptServiceImpl implements ISysDeptService
|
| | | {
|
| | | @Autowired
|
| | | private SysDeptMapper deptMapper;
|
| | | |
| | | @Autowired
|
| | | private SysRoleMapper roleMapper;
|
| | | private final SysDeptMapper deptMapper;
|
| | | private final SysRoleMapper roleMapper;
|
| | |
|
| | | /**
|
| | | * 查询部门管理数据
|
| | | * |
| | | *
|
| | | * @param dept 部门信息
|
| | | * @return 部门信息集合
|
| | | */
|
| | |
| | | {
|
| | | return deptMapper.selectDeptList(dept);
|
| | | }
|
| | | |
| | |
|
| | | /**
|
| | | * 查询部门树结构信息
|
| | | * |
| | | *
|
| | | * @param dept 部门信息
|
| | | * @return 部门树信息集合
|
| | | */
|
| | |
| | |
|
| | | /**
|
| | | * 构建前端所需要树结构
|
| | | * |
| | | *
|
| | | * @param depts 部门列表
|
| | | * @return 树结构列表
|
| | | */
|
| | |
| | |
|
| | | /**
|
| | | * 构建前端所需要下拉树结构
|
| | | * |
| | | *
|
| | | * @param depts 部门列表
|
| | | * @return 下拉树结构列表
|
| | | */
|
| | |
| | |
|
| | | /**
|
| | | * 根据角色ID查询部门树信息
|
| | | * |
| | | *
|
| | | * @param roleId 角色ID
|
| | | * @return 选中部门列表
|
| | | */
|
| | |
| | |
|
| | | /**
|
| | | * 根据部门ID查询信息
|
| | | * |
| | | *
|
| | | * @param deptId 部门ID
|
| | | * @return 部门信息
|
| | | */
|
| | |
| | |
|
| | | /**
|
| | | * 根据ID查询所有子部门(正常状态)
|
| | | * |
| | | *
|
| | | * @param deptId 部门ID
|
| | | * @return 子部门数
|
| | | */
|
| | |
| | |
|
| | | /**
|
| | | * 是否存在子节点
|
| | | * |
| | | *
|
| | | * @param deptId 部门ID
|
| | | * @return 结果
|
| | | */
|
| | |
| | |
|
| | | /**
|
| | | * 查询部门是否存在用户
|
| | | * |
| | | *
|
| | | * @param deptId 部门ID
|
| | | * @return 结果 true 存在 false 不存在
|
| | | */
|
| | |
| | |
|
| | | /**
|
| | | * 校验部门名称是否唯一
|
| | | * |
| | | *
|
| | | * @param dept 部门信息
|
| | | * @return 结果
|
| | | */
|
| | |
| | |
|
| | | /**
|
| | | * 校验部门是否有数据权限
|
| | | * |
| | | *
|
| | | * @param deptId 部门id
|
| | | */
|
| | | @Override
|
| | |
| | |
|
| | | /**
|
| | | * 新增保存部门信息
|
| | | * |
| | | *
|
| | | * @param dept 部门信息
|
| | | * @return 结果
|
| | | */
|
| | |
| | |
|
| | | /**
|
| | | * 修改保存部门信息
|
| | | * |
| | | *
|
| | | * @param dept 部门信息
|
| | | * @return 结果
|
| | | */
|
| | |
| | |
|
| | | /**
|
| | | * 修改该部门的父级部门状态
|
| | | * |
| | | *
|
| | | * @param dept 当前部门
|
| | | */
|
| | | private void updateParentDeptStatusNormal(SysDept dept)
|
| | |
| | |
|
| | | /**
|
| | | * 修改子元素关系
|
| | | * |
| | | *
|
| | | * @param deptId 被修改的部门ID
|
| | | * @param newAncestors 新的父ID集合
|
| | | * @param oldAncestors 旧的父ID集合
|
| | |
| | |
|
| | | /**
|
| | | * 删除部门管理信息
|
| | | * |
| | | *
|
| | | * @param deptId 部门ID
|
| | | * @return 结果
|
| | | */
|
| | |
| | | }
|
| | | }
|
| | |
|
| | | @Override
|
| | | public SysDept selectDeptByDeptName(String deptName) {
|
| | | return deptMapper.selectDeptByDeptName(deptName);
|
| | | }
|
| | |
|
| | | /**
|
| | | * 得到子节点列表
|
| | | */
|