package com.ruoyi.course.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.course.domain.Course;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * <p>
 * 课程信息表 Mapper 接口
 * </p>
 *
 * @author xu
 * @since 2025-12-14
 */
@Mapper
public interface CourseMapper extends BaseMapper<Course> {

    default List<Course> findByGradeLevel(String gradeLevel) {
        LambdaQueryWrapper<Course> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(Course::getGradeLevel, gradeLevel)
                .eq(Course::getStatus, 1)
                .orderByAsc(Course::getCourseName);
        return selectList(wrapper);
    }

    default List<Course> findByType(String courseType) {
        LambdaQueryWrapper<Course> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(Course::getCourseType, courseType)
                .eq(Course::getStatus, 1)
                .orderByAsc(Course::getId);
        return selectList(wrapper);
    }

}
