| | |
| | | package com.project.system.service.impl; |
| | | |
| | | import cn.hutool.core.convert.Convert; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.project.common.core.domain.entity.SysDept; |
| | | import com.project.common.exception.base.BaseException; |
| | | import com.project.common.utils.StringUtils; |
| | | import com.project.system.domain.SysUserDept; |
| | | import com.project.system.domain.bo.editBo.UserDeptBo; |
| | | import com.project.system.domain.vo.SysUserDeptTreeVo; |
| | | import com.project.system.domain.vo.UserDeptVo; |
| | | import com.project.system.mapper.SysUserDeptMapper; |
| | | import com.project.system.service.ISysDeptService; |
| | | import com.project.system.service.ISysUserDeptService; |
| | | import lombok.RequiredArgsConstructor; |
| | | import org.springframework.beans.factory.annotation.Autowired; |
| | |
| | | @Service |
| | | @RequiredArgsConstructor(onConstructor_ = @Autowired) |
| | | public class SysUserDeptServiceImpl extends ServiceImpl<SysUserDeptMapper, SysUserDept> implements ISysUserDeptService { |
| | | |
| | | private final ISysDeptService deptService; |
| | | |
| | | |
| | | /** |
| | |
| | | } |
| | | return this.saveBatch(saveList); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 用户多机构树 |
| | | * @param deptId 参数 |
| | | * @return 结果 |
| | | */ |
| | | @Override |
| | | public SysUserDeptTreeVo batchUserDeptTree(Long deptId) |
| | | { |
| | | Long checkDeptIdByLoginDeptId = deptService.getCheckDeptIdByLoginDeptId(deptId); |
| | | return getDeptTree(checkDeptIdByLoginDeptId); |
| | | } |
| | | |
| | | |
| | | /** |
| | | * 获取审批及其下级部门 |
| | | * @param deptId 审批部门id |
| | | * @return 机构树 |
| | | */ |
| | | private SysUserDeptTreeVo getDeptTree(Long deptId) |
| | | { |
| | | SysUserDeptTreeVo vo = new SysUserDeptTreeVo(); |
| | | SysDept sysDept = deptService.selectDeptById(deptId); |
| | | vo.setDeptId(sysDept.getDeptId()); |
| | | vo.setDeptName(sysDept.getDeptName()); |
| | | |
| | | List<SysDept> list = deptService.list(deptService.lq().eq(SysDept::getParentId, deptId)); |
| | | List<SysUserDeptTreeVo> child = Convert.toList(SysUserDeptTreeVo.class, list); |
| | | vo.setChild(child); |
| | | return vo; |
| | | } |
| | | } |