package cn.iocoder.byzs.module.ai.dal.mysql.mapgame;

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.ai.dal.dataobject.mapgame.MapGameDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.byzs.module.ai.controller.admin.mapgame.vo.*;

/**
 * AI-blockly地图编程游戏 Mapper
 *
 * @author lyb
 */
@Mapper
public interface MapGameMapper extends BaseMapperX<MapGameDO> {

    default PageResult<MapGameDO> selectPage(MapGamePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MapGameDO>()
                .likeIfPresent(MapGameDO::getName, reqVO.getName())
                .eqIfPresent(MapGameDO::getInfo, reqVO.getInfo())
                .eqIfPresent(MapGameDO::getUserImage, reqVO.getUserImage())
                .eqIfPresent(MapGameDO::getUserDirection, reqVO.getUserDirection())
                .eqIfPresent(MapGameDO::getMapTileSize, reqVO.getMapTileSize())
                .eqIfPresent(MapGameDO::getMapStartPoint, reqVO.getMapStartPoint())
                .eqIfPresent(MapGameDO::getMapBackground, reqVO.getMapBackground())
                .eqIfPresent(MapGameDO::getMapEndPoint, reqVO.getMapEndPoint())
                .eqIfPresent(MapGameDO::getMapWalkablePoints, reqVO.getMapWalkablePoints())
                .eqIfPresent(MapGameDO::getJsonData, reqVO.getJsonData())
                .eqIfPresent(MapGameDO::getSort, reqVO.getSort())
                .eqIfPresent(MapGameDO::getStatus, reqVO.getStatus())
                .betweenIfPresent(MapGameDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(MapGameDO::getTenantId, reqVO.getTenantId())
                .orderByAsc(MapGameDO::getSort));
    }

}