Files
nuttyreading-java/src/main/java/com/peanut/modules/sociology/controller/HomeController.java
wangjinlei e9064b617d 1
2024-04-11 11:14:52 +08:00

45 lines
1.4 KiB
Java

package com.peanut.modules.sociology.controller;
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.to.ParamTo;
import com.peanut.modules.sociology.service.CourseService;
import com.peanut.modules.sociology.service.CourseSociologyService;
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("sociologyHome")
@RequestMapping("sociology/home")
public class HomeController {
@Autowired
private CourseService courseService;
@Autowired
private CourseSociologyService courseSociologyService;
//首页-我的课程
@RequestMapping("/getMyCourse")
public R getMyCourse(String userId){
List<CourseEntity> courseList = courseService.getMyCourse(userId);
return R.ok().put("myCourse",courseList);
}
@RequestMapping("/getSociologyLabels")
public R getSociologyLabels(@RequestBody ParamTo param){
List<CourseSociologyEntity> sociologyLabels = courseSociologyService.getSociologyLabels(param.getId());
return R.ok().put("labels",sociologyLabels);
}
}