增加部门删选核查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

@@ -38,4 +38,6 @@ public interface CourseService extends IService<Course> {
void updateClassHour(Integer courseId, Integer classHour);
void removeCategoryIdRelate(Integer categoryId);
List<Course> chunks(List<Integer> ids, List<String> fields);
}

View File

@@ -33,4 +33,8 @@ public interface DepartmentService extends IService<Department> {
void remoteRelateUsersByDepId(Integer depId);
List<Integer> getUserIdsByDepId(Integer depId);
List<Integer> getCourseIdsByDepId(Integer depId);
}

View File

@@ -36,4 +36,6 @@ public interface UserService extends IService<User> {
List<Integer> getDepIdsByUserId(Integer userId);
void passwordChange(User user, String oldPassword, String newPassword) throws ServiceException;
List<User> chunks(List<Integer> ids, List<String> fields);
}

View File

@@ -193,6 +193,11 @@ public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> impleme
public void removeCategoryIdRelate(Integer categoryId) {
courseCategoryService.removeByCategoryId(categoryId);
}
@Override
public List<Course> chunks(List<Integer> ids, List<String> fields) {
return list(query().getWrapper().in("id", ids).select(fields));
}
}

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();
}
}

View File

@@ -215,6 +215,11 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
setPassword(HelperUtil.MD5(newPassword + user.getSalt()));
}});
}
@Override
public List<User> chunks(List<Integer> ids, List<String> fields) {
return list(query().getWrapper().in("id", ids).select(fields));
}
}