87 lines
3.5 KiB
Java
87 lines
3.5 KiB
Java
package com.peanut.modules.master.controller;
|
|
|
|
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
import com.peanut.common.utils.R;
|
|
import com.peanut.modules.common.entity.CourseEntity;
|
|
import com.peanut.modules.common.entity.CourseSociologyEntity;
|
|
import com.peanut.modules.common.entity.CourseToSociologyEntity;
|
|
import com.peanut.modules.common.to.ParamTo;
|
|
import com.peanut.modules.master.service.CourseService;
|
|
import com.peanut.modules.master.service.CourseSociologyService;
|
|
import com.peanut.modules.master.service.CourseToSociologyService;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.web.bind.annotation.RequestBody;
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
|
import java.util.List;
|
|
|
|
@Slf4j
|
|
@RestController("masterCourseSociology")
|
|
@RequestMapping("master/courseSociology")
|
|
public class CourseSociologyController {
|
|
@Autowired
|
|
private CourseSociologyService courseSociologyService;
|
|
@Autowired
|
|
private CourseToSociologyService courseToSociologyService;
|
|
@Autowired
|
|
private CourseService courseService;
|
|
|
|
@RequestMapping("/getCourseSociologyList")
|
|
public R getCourseSociologyList(){
|
|
List<CourseSociologyEntity> courseSociologyList = courseSociologyService.getCourseSociologyList();
|
|
return R.ok().put("sociologys",courseSociologyList);
|
|
}
|
|
|
|
@RequestMapping("/addCourseSociology")
|
|
public R addCourseSociology(@RequestBody CourseSociologyEntity courseSociologyEntity){
|
|
courseSociologyService.save(courseSociologyEntity);
|
|
return R.ok().put("sociology",courseSociologyEntity);
|
|
}
|
|
|
|
@RequestMapping("/delCourseSociology")
|
|
public R delCourseSociology(@RequestBody ParamTo param){
|
|
return courseSociologyService.delCourseSociology(param.getId());
|
|
}
|
|
|
|
@RequestMapping("/editCourseSociology")
|
|
public R editCourseSociology(@RequestBody CourseSociologyEntity courseSociologyEntity){
|
|
return courseSociologyService.editCourseSociology(courseSociologyEntity);
|
|
}
|
|
|
|
@RequestMapping("/getCourseListForSociology")
|
|
public R getCourseListForSociology(@RequestBody ParamTo param){
|
|
List<CourseEntity> courseListForSociology = courseService.getCourseListForSociology(param.getId());
|
|
return R.ok().put("courseList",courseListForSociology);
|
|
}
|
|
|
|
@RequestMapping("/getCourseListCanSociology")
|
|
public R getCourseListCanSociology(@RequestBody ParamTo param){
|
|
Page courseListCanSociology = courseService.getCourseListCanSociology(param);
|
|
return R.ok().put("page",courseListCanSociology);
|
|
}
|
|
|
|
@RequestMapping("/bindCourseAndSociology")
|
|
public R bindCourseAndSociology(@RequestBody CourseToSociologyEntity courseToSociologyEntity){
|
|
return courseToSociologyService.bindCourseAndSociology(courseToSociologyEntity);
|
|
}
|
|
|
|
@RequestMapping("/unbindCourseAndSociology")
|
|
public R unbindCourseAndSociology(@RequestBody CourseToSociologyEntity courseToSociologyEntity){
|
|
boolean b = courseToSociologyService.removeById(courseToSociologyEntity.getId());
|
|
if(b){
|
|
return R.ok();
|
|
}else {
|
|
return R.error("error");
|
|
}
|
|
}
|
|
|
|
@RequestMapping("/updateCourseToSociologySort")
|
|
public R updateCourseToSociologySort(@RequestBody CourseToSociologyEntity courseToSociologyEntity){
|
|
courseToSociologyService.updateById(courseToSociologyEntity);
|
|
return R.ok();
|
|
}
|
|
|
|
}
|