新增返回课程类型信息

This commit is contained in:
2026-01-15 15:20:30 +08:00
parent 4e0f46105a
commit 3b76d7c660
5 changed files with 49 additions and 3 deletions

View File

@@ -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;
@@ -25,7 +26,21 @@ public class CourseController {
return ResultVo.Success("", courseService.getCourseResources());
}
//用户上传课程资源
@GetMapping("getCourseTypes")
public ResultVo getAllCourseTypes() {
return ResultVo.Success("", courseService.getAllCourseTypes());
}
//新增课程信息
@PostMapping("addCourse")
public ResultVo addCourse() {
return ResultVo.Success("", "新增课程成功");
}
//新增课程资源
@PostMapping("addCourseResource")
public ResultVo addCourseResource() {
return ResultVo.Success("", "新增课程资源成功");
}
}

View File

@@ -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,19 @@ public class courseServiceImpl implements com.backend.webbackend.Service.courseS
public List<TrainingResource> getCourseResources(){
return trainingResourceMapper.getAllTraningResources();
}
@Override
public List<CourseType> getAllCourseTypes() {
return courseTypeMapper.selectAllCourseTypes();
}
//新增课程信息
@Override
public int addCourse(Course course) {
return 0;
}
}

View File

@@ -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>getAllCourseTypes();
int addCourse(Course course);
}

View File

@@ -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
@@ -18,6 +20,8 @@ public interface CourseTypeMapper {
CourseType selectByPrimaryKey(Long id);
List<CourseType> selectAllCourseTypes();
int updateByPrimaryKeySelective(CourseType record);
int updateByPrimaryKey(CourseType record);

View File

@@ -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