增加课程资源接口
This commit is contained in:
@@ -13,8 +13,15 @@ public class CourseController {
|
||||
@Autowired
|
||||
private courseService courseService;
|
||||
|
||||
// 返回课程信息
|
||||
@GetMapping("getAll")
|
||||
public ResultVo getAllCourses() {
|
||||
return ResultVo.Success("",courseService.getAllCourseInfo());
|
||||
}
|
||||
|
||||
//返回课程资源
|
||||
@GetMapping("getResources")
|
||||
public ResultVo getCourseResources() {
|
||||
return ResultVo.Success("", courseService.getCourseResources());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
package com.backend.webbackend.Service.Impl;
|
||||
|
||||
import com.backend.webbackend.domain.Course;
|
||||
import com.backend.webbackend.domain.TrainingResource;
|
||||
import com.backend.webbackend.mapper.CourseMapper;
|
||||
import com.backend.webbackend.mapper.TrainingResourceMapper;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
@@ -9,15 +11,20 @@ import java.util.List;
|
||||
|
||||
@Service
|
||||
public class courseServiceImpl implements com.backend.webbackend.Service.courseService {
|
||||
|
||||
@Autowired
|
||||
CourseMapper courseMapper;
|
||||
@Autowired
|
||||
TrainingResourceMapper trainingResourceMapper;
|
||||
|
||||
// 返回课程信息
|
||||
@Override
|
||||
public List<Course> getAllCourseInfo() {
|
||||
// List<Course> courses = courseMapper.selectAllCourses();
|
||||
// String path = courses.get(0).getCourseIco().trim()+"/"+courses.get(0).getCourseName().trim();
|
||||
// System.out.println("path:"+path);
|
||||
return courseMapper.selectAllCourses();
|
||||
}
|
||||
|
||||
//返回课程资源
|
||||
@Override
|
||||
public List<TrainingResource> getCourseResources(){
|
||||
return trainingResourceMapper.getAllTraningResources();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.backend.webbackend.Service;
|
||||
|
||||
import com.backend.webbackend.domain.Course;
|
||||
import com.backend.webbackend.domain.TrainingResource;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
@@ -8,4 +9,5 @@ import java.util.List;
|
||||
@Service
|
||||
public interface courseService {
|
||||
List<Course> getAllCourseInfo();
|
||||
List<TrainingResource> getCourseResources();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
package com.backend.webbackend.domain;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @TableName resourse_type
|
||||
*/
|
||||
@Data
|
||||
public class ResourseType {
|
||||
private Integer id;
|
||||
|
||||
private String resourseTypeName;
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
package com.backend.webbackend.mapper;
|
||||
|
||||
import com.backend.webbackend.domain.ResourseType;
|
||||
import com.backend.webbackend.domain.TrainingResource;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Quella
|
||||
* @description 针对表【resourse_type(资源类型)】的数据库操作Mapper
|
||||
* @createDate 2026-01-13 15:57:20
|
||||
* @Entity com.backend.webbackend.domain.ResourseType
|
||||
*/
|
||||
public interface ResourseTypeMapper {
|
||||
|
||||
int deleteByPrimaryKey(Long id);
|
||||
|
||||
int insert(ResourseType record);
|
||||
|
||||
int insertSelective(ResourseType record);
|
||||
|
||||
ResourseType selectByPrimaryKey(Long id);
|
||||
|
||||
int updateByPrimaryKeySelective(ResourseType record);
|
||||
|
||||
int updateByPrimaryKey(ResourseType record);
|
||||
|
||||
}
|
||||
@@ -2,6 +2,8 @@ package com.backend.webbackend.mapper;
|
||||
|
||||
import com.backend.webbackend.domain.TrainingResource;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author Quella
|
||||
* @description 针对表【training_resource(培训资源表)】的数据库操作Mapper
|
||||
@@ -18,6 +20,8 @@ public interface TrainingResourceMapper {
|
||||
|
||||
TrainingResource selectByPrimaryKey(Long id);
|
||||
|
||||
List<TrainingResource> getAllTraningResources();
|
||||
|
||||
int updateByPrimaryKeySelective(TrainingResource record);
|
||||
|
||||
int updateByPrimaryKey(TrainingResource record);
|
||||
|
||||
Reference in New Issue
Block a user