package cn.iocoder.byzs.module.blockly.dal.mysql.blockly;

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.blockly.controller.admin.blockly.vo.BlocklyPageReqVO;
import cn.iocoder.byzs.module.blockly.dal.dataobject.blockly.BlocklyDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

/**
 * 课程 Mapper
 *
 * @author lyb
 */
@Mapper
public interface BlocklyMapper extends BaseMapperX<BlocklyDO> {

    default PageResult<BlocklyDO> selectPage(BlocklyPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BlocklyDO>()
                .likeIfPresent(BlocklyDO::getBcName, reqVO.getBcName())
                .eqIfPresent(BlocklyDO::getBcContentType, reqVO.getBcContentType())
                .eqIfPresent(BlocklyDO::getBcContent, reqVO.getBcContent())
                .eqIfPresent(BlocklyDO::getBcIsInspect, reqVO.getBcIsInspect())
                .eqIfPresent(BlocklyDO::getBcType, reqVO.getBcType())
                .eqIfPresent(BlocklyDO::getBcLabel, reqVO.getBcLabel())
                .eqIfPresent(BlocklyDO::getBcStatus, reqVO.getBcStatus())
                .orderByAsc(BlocklyDO::getBcLabel, BlocklyDO::getBcOrder));
    }

    List<BlocklyPageReqVO> selectBlocklyPage(BlocklyPageReqVO reqVO);
    List<BlocklyPageReqVO> selectBlocklyList(BlocklyPageReqVO reqVO);
    int selectBlocklyPageCount(BlocklyPageReqVO reqVO);
}