diff --git a/src/main/java/com/yunhai/bschclassmanage/controller/api/SchHistoryController.java b/src/main/java/com/yunhai/bschclassmanage/controller/api/SchHistoryController.java index c891507..b9f7bdb 100644 --- a/src/main/java/com/yunhai/bschclassmanage/controller/api/SchHistoryController.java +++ b/src/main/java/com/yunhai/bschclassmanage/controller/api/SchHistoryController.java @@ -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 getHistoryClassStudent(int classId) { + public List getHistoryClassStudent(Integer classId) { + if (classId == null || classId <= 0) { + throw new DException("班级ID不允许为空"); + } return studentClassHistoryService.getHistoryClassStudent(UserContext.getSchId(),classId); } //获取历史任教信息 @GetMapping("getHistoryClassTeach") - public List getHistoryClassTeach(int classId) { + public List getHistoryClassTeach(Integer classId) { + if (classId == null || classId <= 0) { + throw new DException("班级ID不允许为空"); + } return studentClassHistoryService.getHistoryClassTeach(UserContext.getSchId(),classId); } //通过学生stuId获取历史任教信息 @GetMapping("getHistoryClassTeachByStuId") - public Map getHistoryClassTeachByStuId(int stuId) { + public Map getHistoryClassTeachByStuId(Integer stuId) { + if (stuId == null || stuId <= 0) { + throw new DException("学生ID不允许为空"); + } return studentClassHistoryService.getHistoryClassTeachByStuId(UserContext.getSchId(),stuId); } diff --git a/src/main/java/com/yunhai/bschclassmanage/service/impl/StudentClassHistoryService.java b/src/main/java/com/yunhai/bschclassmanage/service/impl/StudentClassHistoryService.java index 371e4ec..a1182a7 100644 --- a/src/main/java/com/yunhai/bschclassmanage/service/impl/StudentClassHistoryService.java +++ b/src/main/java/com/yunhai/bschclassmanage/service/impl/StudentClassHistoryService.java @@ -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 classInfo= schClassService.getSchAllClassCacheFilter(schId,gradeId,classId).stream().findFirst();