| | |
| | | package com.xinquan.course.service.impl; |
| | | |
| | | import com.alibaba.nacos.common.utils.StringUtils; |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.xinquan.common.core.utils.page.CollUtils; |
| | | import com.xinquan.common.core.utils.page.PageDTO; |
| | | import com.xinquan.course.domain.Course; |
| | | import com.xinquan.course.domain.vo.ClientCourseVO; |
| | | import com.xinquan.course.mapper.CourseMapper; |
| | | import com.xinquan.course.service.CourseService; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import java.util.Objects; |
| | | import org.springframework.stereotype.Service; |
| | | |
| | | /** |
| | |
| | | @Service |
| | | public class CourseServiceImpl extends ServiceImpl<CourseMapper, Course> implements CourseService { |
| | | |
| | | /** |
| | | * 获取课程列表-分页 |
| | | * |
| | | * @param courseTitle 课程标题 |
| | | * @param cateId 分类id |
| | | * @param pageCurr 分页参数,当前页码 |
| | | * @param pageSize 分页参数,每页数量 |
| | | * @return 课程分页列表 |
| | | */ |
| | | @Override |
| | | public PageDTO<ClientCourseVO> getCoursePageList(String courseTitle, Long cateId, |
| | | Integer pageCurr, Integer pageSize) { |
| | | Page<Course> page = this.lambdaQuery() |
| | | .like(StringUtils.isNotBlank(courseTitle), Course::getCourseTitle, courseTitle) |
| | | .eq(Objects.nonNull(cateId), Course::getCateId, cateId) |
| | | .orderByDesc(Course::getSortNum) |
| | | .page(new Page<>(pageCurr, pageSize)); |
| | | if (CollUtils.isEmpty(page.getRecords())) { |
| | | return PageDTO.empty(page); |
| | | } |
| | | return PageDTO.of(page, ClientCourseVO.class); |
| | | } |
| | | } |