| | |
| | | package kr.wisestone.owl.service.impl; |
| | | |
| | | import kr.wisestone.owl.domain.Department; |
| | | import kr.wisestone.owl.domain.UserDepartment; |
| | | import kr.wisestone.owl.domain.UserLevel; |
| | | import kr.wisestone.owl.mapper.DepartmentMapper; |
| | | import kr.wisestone.owl.service.UserDepartmentService; |
| | | import kr.wisestone.owl.service.UserService; |
| | | import kr.wisestone.owl.web.condition.DepartmentCondition; |
| | | import kr.wisestone.owl.web.condition.UserCondition; |
| | |
| | | private DepartmentMapper departmentMapper; |
| | | |
| | | @Autowired |
| | | private UserService userService; |
| | | private DepartmentService departmentService; |
| | | |
| | | @Autowired |
| | | private UserDepartmentService userDepartmentService; |
| | | |
| | | @Autowired |
| | | private WorkspaceService workspaceService; |
| | |
| | | } |
| | | |
| | | for (Long id : departmentForm.getRemoveIds()) { |
| | | this.departmentRepository.deleteById(id); |
| | | this.departmentRepository.flush(); |
| | | if (!this.departmentService.countInDepartment(id)) { |
| | | this.departmentRepository.deleteById(id); |
| | | } else { |
| | | throw new OwlRuntimeException( |
| | | this.messageAccessor.getMessage(MsgConstants.DEPARTMENT_ALREADY_IN_USE)); |
| | | } |
| | | } |
| | | this.departmentRepository.flush(); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | } |
| | | |
| | | @Override |
| | | public boolean countInDepartment(Long id) { |
| | | return this.departmentMapper.countInDepartment(id) > 0; |
| | | } |
| | | |
| | | |
| | | // 사용자 부서 ID로 조회한다. |
| | | @Override |
| | | public Department getDepartment(Long id) { |
| | |
| | | } |
| | | |
| | | return department; |
| | | } |
| | | |
| | | // 삭제 할 부서 유저가 사용하고 있는지 확인 |
| | | @Override |
| | | public boolean department(Long Id) { |
| | | return this.departmentMapper.findBydepartmentId(Id) > 0; |
| | | } |
| | | |
| | | @Override |