package cn.iocoder.byzs.module.bjdx.dal.mysql.coursequestoption;

import cn.iocoder.byzs.module.bjdx.controller.admin.coursequestoption.vo.CourseQuestOptionPageReqVO;
import cn.iocoder.byzs.framework.common.pojo.PageResult;
import cn.iocoder.byzs.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.byzs.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.byzs.module.bjdx.dal.dataobject.coursequestoption.CourseQuestOptionDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.byzs.module.bjdx.controller.admin.coursequestoption.vo.*;

import java.util.List;
import java.util.Set;

/**
 * 课程-试题-选项 Mapper
 *
 * @author lyb
 */
@Mapper
public interface CourseQuestOptionMapper extends BaseMapperX<CourseQuestOptionDO> {

    default PageResult<CourseQuestOptionDO> selectPage(CourseQuestOptionPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<CourseQuestOptionDO>()
                .eqIfPresent(CourseQuestOptionDO::getCqoQuestId, reqVO.getCqoQuestId())
                .likeIfPresent(CourseQuestOptionDO::getCqoValue, reqVO.getCqoValue())
                .likeIfPresent(CourseQuestOptionDO::getCqoOption, reqVO.getCqoOption())
                .eqIfPresent(CourseQuestOptionDO::getCqoSocre, reqVO.getCqoSocre())
                .eqIfPresent(CourseQuestOptionDO::getCqoIsAnswer, reqVO.getCqoIsAnswer())
                .orderByDesc(CourseQuestOptionDO::getId));
    }

    List<CourseQuestOptionDO> selectListByQuestId(Set<Long> questIdSet);

}