From bd0ff253dab764de465591b78527b0a733e94e63 Mon Sep 17 00:00:00 2001 From: pd <2776455882@qq.com> Date: Wed, 12 Aug 2020 11:50:21 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AE=9E=E9=AA=8C=E7=8F=AD=E7=BA=A7=E6=B7=BB?= =?UTF-8?q?=E5=8A=A0=E8=AF=BE=E7=A8=8B=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ExperimentalClassController.java | 24 ++++++++++++------- .../mapper/ExperimentalClassMapper.java | 4 ++-- .../service/ExperimentalClassService.java | 10 ++++---- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/src/main/java/com/yipin/liuwanr/controller/ExperimentalClassController.java b/src/main/java/com/yipin/liuwanr/controller/ExperimentalClassController.java index 3f945e5..07440ab 100644 --- a/src/main/java/com/yipin/liuwanr/controller/ExperimentalClassController.java +++ b/src/main/java/com/yipin/liuwanr/controller/ExperimentalClassController.java @@ -5,6 +5,7 @@ import java.util.List; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; +import org.springframework.util.StringUtils; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -51,16 +52,21 @@ public class ExperimentalClassController { * @return */ @GetMapping("/queryExperimentalClass") - Response queryExperimentalClass(@RequestParam Integer schoolId) { + Response queryExperimentalClass(@RequestParam Integer schoolId,@RequestParam Integer courseId) { Response resp = new Response(); - HashMap ret=classService.queryExperimentalClass(schoolId); - int status = (int) ret.get("retcode"); - if (200 == status) { - resp.setStatus(status); - resp.setMessage(ret.get("retvalue")); - } else { - resp.setStatus(status); - resp.setErrmessage(ret.get("retvalue").toString()); + if(StringUtils.isEmpty(schoolId)){ + resp.setStatus(300); + resp.setErrmessage("学校信息为空"); + }else{ + HashMap ret=classService.queryExperimentalClass(schoolId,courseId); + int status = (int) ret.get("retcode"); + if (200 == status) { + resp.setStatus(status); + resp.setMessage(ret.get("retvalue")); + } else { + resp.setStatus(status); + resp.setErrmessage(ret.get("retvalue").toString()); + } } return resp; } diff --git a/src/main/java/com/yipin/liuwanr/mapper/ExperimentalClassMapper.java b/src/main/java/com/yipin/liuwanr/mapper/ExperimentalClassMapper.java index c54cc2f..2debfb9 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/ExperimentalClassMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/ExperimentalClassMapper.java @@ -31,9 +31,9 @@ public interface ExperimentalClassMapper { @Select({" "}) - List queryExperimentalClass(Integer schoolId); + List queryExperimentalClass(Integer schoolId,Integer courseId); //查询实验班级学生专业 @Select({"