增加部门删选核查api

This commit is contained in:
none
2023-03-13 14:48:09 +08:00
parent e16212e5ad
commit a3bb8be72e
7 changed files with 70 additions and 0 deletions

View File

@@ -5,9 +5,11 @@ import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import xyz.playedu.api.domain.CourseDepartment;
import xyz.playedu.api.domain.Department;
import xyz.playedu.api.domain.UserDepartment;
import xyz.playedu.api.exception.NotFoundException;
import xyz.playedu.api.service.CourseDepartmentService;
import xyz.playedu.api.service.DepartmentService;
import xyz.playedu.api.mapper.DepartmentMapper;
import org.springframework.stereotype.Service;
@@ -29,6 +31,9 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
@Autowired
private UserDepartmentService userDepartmentService;
@Autowired
private CourseDepartmentService courseDepartmentService;
@Override
public List<Department> listByParentId(Integer id) {
return list(query().getWrapper().eq("parent_id", id).orderByAsc("sort"));
@@ -176,6 +181,16 @@ public class DepartmentServiceImpl extends ServiceImpl<DepartmentMapper, Departm
QueryWrapper<UserDepartment> wrapper = userDepartmentService.query().getWrapper().eq("dep_id", depId);
userDepartmentService.remove(wrapper);
}
@Override
public List<Integer> getUserIdsByDepId(Integer depId) {
return userDepartmentService.list(userDepartmentService.query().getWrapper().eq("dep_id", depId)).stream().map(UserDepartment::getUserId).toList();
}
@Override
public List<Integer> getCourseIdsByDepId(Integer depId) {
return courseDepartmentService.list(courseDepartmentService.query().getWrapper().eq("dep_id", depId)).stream().map(CourseDepartment::getCourseId).toList();
}
}