| | |
| | | package com.xinquan.course.controller.client; |
| | | |
| | | |
| | | import com.alibaba.nacos.common.utils.StringUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.xinquan.common.core.domain.R; |
| | | import com.xinquan.common.core.utils.page.BeanUtils; |
| | | import com.xinquan.common.core.utils.page.CollUtils; |
| | | import com.xinquan.common.core.utils.page.PageDTO; |
| | | import com.xinquan.course.api.domain.Course; |
| | | import com.xinquan.course.domain.TutorSpecialColumn; |
| | | import com.xinquan.course.domain.TutorSpecialColumnCourse; |
| | | import com.xinquan.course.domain.vo.ClientCourseVO; |
| | | import com.xinquan.course.domain.vo.TutorVo; |
| | | import com.xinquan.course.service.CourseCategoryService; |
| | | import com.xinquan.course.service.CourseService; |
| | | import com.xinquan.course.service.TutorSpecialColumnCourseService; |
| | | import com.xinquan.course.service.TutorSpecialColumnService; |
| | | import io.swagger.annotations.ApiImplicitParam; |
| | | import io.swagger.annotations.ApiImplicitParams; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.web.bind.annotation.PostMapping; |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.RestController; |
| | | |
| | | import javax.annotation.Resource; |
| | | import java.util.Arrays; |
| | | import java.util.Objects; |
| | | |
| | | /** |
| | | * <p> |
| | |
| | | @RequestMapping("/client/course/tutor-special-column") |
| | | public class ClientTutorSpecialColumnController { |
| | | |
| | | @Resource |
| | | private TutorSpecialColumnService tutorSpecialColumnService; |
| | | @Resource |
| | | private TutorSpecialColumnCourseService tutorSpecialColumnCourseService; |
| | | @Resource |
| | | private CourseCategoryService courseCategoryService; |
| | | @Resource |
| | | private CourseService courseService; |
| | | @PostMapping("/getCoursePageList") |
| | | @ApiOperation(value = "导师专栏",tags = "导师专栏") |
| | | @ApiImplicitParams({ |
| | | @ApiImplicitParam(value = "分页参数,当前页码", name = "pageCurr", required = true, dataType = "Integer"), |
| | | @ApiImplicitParam(value = "分页参数,每页数量", name = "pageSize", required = true, dataType = "Integer") |
| | | }) |
| | | public R<TutorVo> getCourseList( |
| | | @RequestParam(value = "pageCurr", defaultValue = "1") Integer pageCurr, |
| | | @RequestParam(value = "pageSize", defaultValue = "10") Integer pageSize) { |
| | | TutorVo tutorVo = new TutorVo(); |
| | | TutorSpecialColumn one = tutorSpecialColumnService.lambdaQuery().one(); |
| | | if (one!=null){ |
| | | TutorSpecialColumnCourse one1 = tutorSpecialColumnCourseService.lambdaQuery().eq(TutorSpecialColumnCourse::getTutorSpecialColumnId, one.getId()).one(); |
| | | BeanUtils.copyProperties(one, tutorVo); |
| | | Page<Course> page = courseService.lambdaQuery() |
| | | .in(Course::getId, Arrays.asList(one1.getCourseId().split(","))) |
| | | .orderByDesc(Course::getSortNum) |
| | | .page(new Page<>(pageCurr, pageSize)); |
| | | if (CollUtils.isEmpty(page.getRecords())) { |
| | | PageDTO.empty(page); |
| | | } |
| | | tutorVo.setList(PageDTO.of(page, ClientCourseVO.class)); |
| | | }else{ |
| | | return R.ok(tutorVo); |
| | | } |
| | | return R.ok(); |
| | | } |
| | | |
| | | |
| | | } |
| | | |