package cn.iocoder.byzs.module.aicourse.dal.mysql.aiCourse;

import cn.iocoder.byzs.framework.common.pojo.PageResult;
import cn.iocoder.byzs.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.byzs.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.byzs.module.aicourse.controller.admin.aiCourse.vo.AiCoursePageReqVO;
import cn.iocoder.byzs.module.aicourse.dal.dataobject.aiCourse.AiCourseDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 课程 Mapper
 *
 * @author lyb
 */
@Mapper
public interface AiCourseMapper extends BaseMapperX<AiCourseDO> {

    default PageResult<AiCourseDO> selectPage(AiCoursePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AiCourseDO>()
                .likeIfPresent(AiCourseDO::getAcName, reqVO.getAcName())
                .eqIfPresent(AiCourseDO::getAcContentType, reqVO.getAcContentType())
                .eqIfPresent(AiCourseDO::getAcContent, reqVO.getAcContent())
                .eqIfPresent(AiCourseDO::getAcIsInspect, reqVO.getAcIsInspect())
                .eqIfPresent(AiCourseDO::getAcType, reqVO.getAcType())
                .eqIfPresent(AiCourseDO::getAcLabel, reqVO.getAcLabel())
                .eqIfPresent(AiCourseDO::getAcStatus, reqVO.getAcStatus())
                .orderByAsc(AiCourseDO::getAcLabel, AiCourseDO::getAcOrder));
    }

    List<AiCoursePageReqVO> selectAiCoursePage(AiCoursePageReqVO reqVO);
    List<AiCoursePageReqVO> selectAiCourseList(AiCoursePageReqVO reqVO);
    int selectAiCoursePageCount(AiCoursePageReqVO reqVO);
}