From 3492011da8483c9b2b85ec4e8d51c0c56f9e38a4 Mon Sep 17 00:00:00 2001 From: pd <2776455882@qq.com> Date: Thu, 6 Aug 2020 15:43:46 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AD=A6=E7=94=9F=E7=AB=AF=E3=80=81=E6=95=99?= =?UTF-8?q?=E5=B8=88=E7=AB=AF=E8=AF=BE=E7=A8=8B=E8=BF=9B=E5=BA=A6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ProjectAndCourseController.java | 33 ++++++++----------- .../service/ProjectAndCourseService.java | 32 +++++++++++------- 2 files changed, 34 insertions(+), 31 deletions(-) diff --git a/src/main/java/com/yipin/liuwanr/controller/ProjectAndCourseController.java b/src/main/java/com/yipin/liuwanr/controller/ProjectAndCourseController.java index 7267c66..76b244a 100644 --- a/src/main/java/com/yipin/liuwanr/controller/ProjectAndCourseController.java +++ b/src/main/java/com/yipin/liuwanr/controller/ProjectAndCourseController.java @@ -5,11 +5,7 @@ import java.util.HashMap; import com.yipin.liuwanr.vo.CourseAndProjectVo; import org.springframework.beans.factory.annotation.Autowired; 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; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import com.yipin.liuwanr.entity.Project_Management; import com.yipin.liuwanr.entity.Response; @@ -29,7 +25,7 @@ public class ProjectAndCourseController { * @return */ @GetMapping("/queryProject") - Response queryProject(Integer courseId,Integer experimentalClassId) { + Response queryProject(@RequestParam Integer courseId,@RequestParam Integer experimentalClassId) { Response resp = new Response(); if(StringUtils.isEmpty(experimentalClassId)){ resp.setStatus(300); @@ -100,22 +96,19 @@ public class ProjectAndCourseController { //课程进度 @GetMapping("/getCourseSchedule") - Response getCourseSchedule(Integer courseId,Integer experimentalClassId) { + Response getCourseSchedule(@RequestParam Integer courseId,@RequestParam Integer experimentalClassId,@RequestParam Integer studentId) { Response resp = new Response(); - if(StringUtils.isEmpty(experimentalClassId)){ - resp.setStatus(300); - resp.setErrmessage("实验班级为空"); - }else{ - HashMap ret = service.getCourseSchedule(courseId,experimentalClassId); - int status = (int) ret.get("retcode"); - if (status == 200) { - resp.setStatus(status); - resp.setMessage(ret.get("retvalue")); - } else { - resp.setStatus(status); - resp.setErrmessage(ret.get("retvalue").toString()); - } + + HashMap ret = service.getCourseSchedule(courseId,experimentalClassId,studentId); + int status = (int) ret.get("retcode"); + if (status == 200) { + 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/service/ProjectAndCourseService.java b/src/main/java/com/yipin/liuwanr/service/ProjectAndCourseService.java index 22519ac..2e74202 100644 --- a/src/main/java/com/yipin/liuwanr/service/ProjectAndCourseService.java +++ b/src/main/java/com/yipin/liuwanr/service/ProjectAndCourseService.java @@ -3,6 +3,7 @@ package com.yipin.liuwanr.service; import java.util.HashMap; import java.util.List; +import com.yipin.liuwanr.mapper.ExperimentallearningMapper; import com.yipin.liuwanr.vo.CourseAndProjectVo; import org.jboss.logging.Logger; import org.springframework.beans.factory.annotation.Autowired; @@ -24,7 +25,8 @@ public class ProjectAndCourseService { @Autowired private TeacherProjectAndCourseMapper mapper; - + @Autowired + private ExperimentallearningMapper experimentallearningMapper; /** * 根据课程查询实验项目信息 @@ -80,21 +82,29 @@ public class ProjectAndCourseService { return resp; } - public HashMap getCourseSchedule(Integer courseId,Integer experimentalClassId) { + public HashMap getCourseSchedule(Integer courseId,Integer experimentalClassId,Integer studentId) { HashMap resp = new HashMap(); HashMap obj = new HashMap(); try { if(!StringUtils.isEmpty(courseId)){ - //完成的课程项目 - Integer number=mapper.getCourseSchedule(courseId); - //总项目数量 - List project=mapper.getBySystemId(courseId,experimentalClassId); - obj.put("total",project.size()); - if(number!=null){ - obj.put("number",number); - }else{ - obj.put("number",0); + if(StringUtils.isEmpty(experimentalClassId)){ + if(!StringUtils.isEmpty(studentId)){ + experimentalClassId=experimentallearningMapper.queryExperimentalClassId(courseId,studentId); + } } + if(!StringUtils.isEmpty(experimentalClassId)){ + //完成的课程项目 + Integer number=mapper.getCourseSchedule(courseId); + //总项目数量 + List project=mapper.getBySystemId(courseId,experimentalClassId); + obj.put("total",project.size()); + if(number!=null){ + obj.put("number",number); + }else{ + obj.put("number",0); + } + } + } resp.put("retcode", 200); resp.put("retvalue",obj);