diff --git a/src/main/java/com/yipin/liuwanr/controller/ProjectAndCourseController.java b/src/main/java/com/yipin/liuwanr/controller/ProjectAndCourseController.java index e48f01c..4ebd58f 100644 --- a/src/main/java/com/yipin/liuwanr/controller/ProjectAndCourseController.java +++ b/src/main/java/com/yipin/liuwanr/controller/ProjectAndCourseController.java @@ -2,6 +2,7 @@ package com.yipin.liuwanr.controller; import java.util.HashMap; +import com.yipin.liuwanr.entity.CourseSchedule; import com.yipin.liuwanr.vo.CourseAndProjectVo; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.util.StringUtils; @@ -109,7 +110,22 @@ public class ProjectAndCourseController { resp.setStatus(status); resp.setErrmessage(ret.get("retvalue").toString()); } + return resp; + } + //添加课程进度 + @PostMapping("/addCourseSchedule") + Response addCourseSchedule(@RequestBody CourseSchedule courseSchedule) { + Response resp = new Response(); + HashMap ret = service.addCourseSchedule(courseSchedule); + 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/entity/CourseSchedule.java b/src/main/java/com/yipin/liuwanr/entity/CourseSchedule.java new file mode 100644 index 0000000..ab0bef2 --- /dev/null +++ b/src/main/java/com/yipin/liuwanr/entity/CourseSchedule.java @@ -0,0 +1,44 @@ +package com.yipin.liuwanr.entity; + +/** + * 课程进度 + */ +public class CourseSchedule { + + private Integer scheduleId; + private Integer courseId; + private Integer experimentalClassId; + private Integer projectId; + + public Integer getScheduleId() { + return scheduleId; + } + + public void setScheduleId(Integer scheduleId) { + this.scheduleId = scheduleId; + } + + public Integer getCourseId() { + return courseId; + } + + public void setCourseId(Integer courseId) { + this.courseId = courseId; + } + + public Integer getExperimentalClassId() { + return experimentalClassId; + } + + public void setExperimentalClassId(Integer experimentalClassId) { + this.experimentalClassId = experimentalClassId; + } + + public Integer getProjectId() { + return projectId; + } + + public void setProjectId(Integer projectId) { + this.projectId = projectId; + } +} diff --git a/src/main/java/com/yipin/liuwanr/mapper/TeacherProjectAndCourseMapper.java b/src/main/java/com/yipin/liuwanr/mapper/TeacherProjectAndCourseMapper.java index 0a09f51..b64d3a8 100644 --- a/src/main/java/com/yipin/liuwanr/mapper/TeacherProjectAndCourseMapper.java +++ b/src/main/java/com/yipin/liuwanr/mapper/TeacherProjectAndCourseMapper.java @@ -2,6 +2,7 @@ package com.yipin.liuwanr.mapper; import java.util.List; +import com.yipin.liuwanr.entity.CourseSchedule; import com.yipin.liuwanr.vo.CourseAndProjectVo; import org.apache.ibatis.annotations.Insert; import org.apache.ibatis.annotations.Param; @@ -58,4 +59,8 @@ public interface TeacherProjectAndCourseMapper { ""}) void addBatchTeachProject(@Param("experimentalClassId") Integer experimentalClassId,@Param("courseId") Integer courseId,@Param("projectIds") List projectIds); + + //添加课程进度 + @Insert("insert into hr_course_schedule (courseId,experimentalClassId,projectId) VALUES (#{courseId},#{experimentalClassId},#{projectId})") + void addCourseSchedule(CourseSchedule courseSchedule); } diff --git a/src/main/java/com/yipin/liuwanr/service/ProjectAndCourseService.java b/src/main/java/com/yipin/liuwanr/service/ProjectAndCourseService.java index 4977124..8a643a7 100644 --- a/src/main/java/com/yipin/liuwanr/service/ProjectAndCourseService.java +++ b/src/main/java/com/yipin/liuwanr/service/ProjectAndCourseService.java @@ -5,6 +5,7 @@ import java.util.List; import com.github.pagehelper.PageHelper; import com.github.pagehelper.PageInfo; +import com.yipin.liuwanr.entity.CourseSchedule; import com.yipin.liuwanr.entity.PageResult; import com.yipin.liuwanr.mapper.ExperimentallearningMapper; import com.yipin.liuwanr.vo.CourseAndProjectVo; @@ -129,6 +130,19 @@ public class ProjectAndCourseService { return resp; } - + //添加课程进度 + public HashMap addCourseSchedule(CourseSchedule courseSchedule){ + HashMap resp = new HashMap(); + try { + mapper.addCourseSchedule(courseSchedule); + resp.put("retcode", 200); + }catch (Exception e){ + logger.error(e.getMessage()); + resp.put("retcode", 500); + resp.put("retvalue", "查询失败"); + return resp; + } + return resp; + } }