分支测试
This commit is contained in:
@@ -4,6 +4,7 @@ import com.backend.webbackend.Service.courseService;
|
||||
import com.backend.webbackend.Vo.ResultVo;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
@@ -19,13 +20,29 @@ public class CourseController {
|
||||
return ResultVo.Success("",courseService.getAllCourseInfo());
|
||||
}
|
||||
|
||||
//返回所有课程类型
|
||||
@GetMapping("getCourseTypes")
|
||||
public ResultVo getCourseTypes() {
|
||||
return ResultVo.Success("", courseService.getCourseTypes());
|
||||
}
|
||||
|
||||
//返回课程资源
|
||||
@GetMapping("getResources")
|
||||
public ResultVo getCourseResources() {
|
||||
return ResultVo.Success("", courseService.getCourseResources());
|
||||
}
|
||||
|
||||
//用户上传课程资源
|
||||
|
||||
//新增课程信息
|
||||
@PostMapping("addCourse")
|
||||
public ResultVo addCourse() {
|
||||
|
||||
return ResultVo.Success("","新增成功");
|
||||
}
|
||||
|
||||
//新增课程资源
|
||||
@PostMapping("addResource")
|
||||
public ResultVo addResource() {
|
||||
|
||||
return ResultVo.Success("","新增成功");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,10 @@
|
||||
package com.backend.webbackend.Service.Impl;
|
||||
|
||||
import com.backend.webbackend.domain.Course;
|
||||
import com.backend.webbackend.domain.CourseType;
|
||||
import com.backend.webbackend.domain.TrainingResource;
|
||||
import com.backend.webbackend.mapper.CourseMapper;
|
||||
import com.backend.webbackend.mapper.CourseTypeMapper;
|
||||
import com.backend.webbackend.mapper.TrainingResourceMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -12,9 +14,11 @@ import java.util.List;
|
||||
@Service
|
||||
public class courseServiceImpl implements com.backend.webbackend.Service.courseService {
|
||||
@Autowired
|
||||
CourseMapper courseMapper;
|
||||
CourseMapper courseMapper; //管理课程信息
|
||||
@Autowired
|
||||
TrainingResourceMapper trainingResourceMapper;
|
||||
CourseTypeMapper courseTypeMapper; //管理课程类型信息
|
||||
@Autowired
|
||||
TrainingResourceMapper trainingResourceMapper; //管理课程资源信息
|
||||
|
||||
// 返回课程信息
|
||||
@Override
|
||||
@@ -27,4 +31,17 @@ public class courseServiceImpl implements com.backend.webbackend.Service.courseS
|
||||
public List<TrainingResource> getCourseResources(){
|
||||
return trainingResourceMapper.getAllTraningResources();
|
||||
}
|
||||
|
||||
//获取课程类型
|
||||
@Override
|
||||
public List<CourseType> getCourseTypes() {
|
||||
return courseTypeMapper.selectAllCourseTypes();
|
||||
}
|
||||
|
||||
//新增课程信息
|
||||
@Override
|
||||
public int addCourse(Course course) {
|
||||
courseMapper.insertCourse(course);
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.backend.webbackend.Service;
|
||||
|
||||
import com.backend.webbackend.domain.Course;
|
||||
import com.backend.webbackend.domain.CourseType;
|
||||
import com.backend.webbackend.domain.TrainingResource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -10,4 +11,6 @@ import java.util.List;
|
||||
public interface courseService {
|
||||
List<Course> getAllCourseInfo();
|
||||
List<TrainingResource> getCourseResources();
|
||||
List<CourseType> getCourseTypes();
|
||||
int addCourse(Course course);
|
||||
}
|
||||
|
||||
@@ -16,6 +16,8 @@ public interface CourseMapper {
|
||||
|
||||
int insert(Course record);
|
||||
|
||||
int insertCourse(Course record);
|
||||
|
||||
int insertSelective(Course record);
|
||||
|
||||
Course selectByPrimaryKey(Long id);
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.backend.webbackend.mapper;
|
||||
|
||||
import com.backend.webbackend.domain.CourseType;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Quella
|
||||
* @description 针对表【course_type】的数据库操作Mapper
|
||||
@@ -22,4 +24,5 @@ public interface CourseTypeMapper {
|
||||
|
||||
int updateByPrimaryKey(CourseType record);
|
||||
|
||||
List<CourseType> selectAllCourseTypes();
|
||||
}
|
||||
|
||||
@@ -57,6 +57,10 @@
|
||||
<if test="courseCategory != null">#{courseCategory},</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<insert id="insertCourse">
|
||||
insert into course (course_name, course_code, course_desc, course_category, course_ico)
|
||||
values (#{courseName}, #{courseCode}, #{courseDesc}, #{courseCategory}, #{courseIco})
|
||||
</insert>
|
||||
|
||||
<update id="updateByPrimaryKeySelective" parameterType="com.backend.webbackend.domain.Course">
|
||||
update course
|
||||
|
||||
@@ -19,6 +19,11 @@
|
||||
from course_type
|
||||
where id = #{id}
|
||||
</select>
|
||||
<select id="selectAllCourseTypes" resultType="com.backend.webbackend.domain.CourseType">
|
||||
select
|
||||
<include refid="Base_Column_List" />
|
||||
from course_type
|
||||
</select>
|
||||
|
||||
<delete id="deleteByPrimaryKey" parameterType="java.lang.Long">
|
||||
delete from course_type
|
||||
|
||||
Reference in New Issue
Block a user