class id 不允许null

This commit is contained in:
2026-08-25 14:50:17 +08:00
parent c038026121
commit 8a10bd2099
2 changed files with 20 additions and 4 deletions
@@ -8,6 +8,7 @@ import com.yunhai.bschclassmanage.model.vo.SelectIntVO;
import com.yunhai.bschclassmanage.service.IBaseSchsystemGradeService;
import com.yunhai.bschclassmanage.service.IStudentClassHistoryService;
import com.yunhai.bschclassmanage.utils.UserContext;
import com.yunhai.platform.utils.exception.DException;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -24,25 +25,37 @@ public class SchHistoryController {
private IStudentClassHistoryService studentClassHistoryService; // 使用接口
@GetMapping("getClass")
public HistorySchClassVO GetClassFirst(int classId) {
public HistorySchClassVO GetClassFirst(Integer classId) {
if (classId == null || classId <= 0) {
throw new DException("班级ID不允许为空");
}
return studentClassHistoryService.GetClassFirst(UserContext.getSchId(),classId);
}
//获取历史学生信息(逐年倒序)
@GetMapping("getHistoryClassStudent")
public List<HistorySchStudentVO> getHistoryClassStudent(int classId) {
public List<HistorySchStudentVO> getHistoryClassStudent(Integer classId) {
if (classId == null || classId <= 0) {
throw new DException("班级ID不允许为空");
}
return studentClassHistoryService.getHistoryClassStudent(UserContext.getSchId(),classId);
}
//获取历史任教信息
@GetMapping("getHistoryClassTeach")
public List<HistoryClassTeachVO> getHistoryClassTeach(int classId) {
public List<HistoryClassTeachVO> getHistoryClassTeach(Integer classId) {
if (classId == null || classId <= 0) {
throw new DException("班级ID不允许为空");
}
return studentClassHistoryService.getHistoryClassTeach(UserContext.getSchId(),classId);
}
//通过学生stuId获取历史任教信息
@GetMapping("getHistoryClassTeachByStuId")
public Map<String, Object> getHistoryClassTeachByStuId(int stuId) {
public Map<String, Object> getHistoryClassTeachByStuId(Integer stuId) {
if (stuId == null || stuId <= 0) {
throw new DException("学生ID不允许为空");
}
return studentClassHistoryService.getHistoryClassTeachByStuId(UserContext.getSchId(),stuId);
}
@@ -96,6 +96,9 @@ public class StudentClassHistoryService implements IStudentClassHistoryService {
public HistorySchClassVO GetClassFirst(Integer schId,Integer classId) {
if (classId == null || classId <= 0) {
throw new DException("班级ID不允许为空");
}
Integer schType=schBinSchsystemService.getSchType(schId);
Integer gradeId=null;
Optional<SchClass> classInfo= schClassService.getSchAllClassCacheFilter(schId,gradeId,classId).stream().findFirst();