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

import java.util.*;

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

/**
 * AI-虚拟实验室 Mapper
 *
 * @author lyb
 */
@Mapper
public interface VirtualDeviceMapper extends BaseMapperX<VirtualDeviceDO> {

    default PageResult<VirtualDeviceDO> selectPage(VirtualDevicePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<VirtualDeviceDO>()
                .likeIfPresent(VirtualDeviceDO::getName, reqVO.getName())
                .eqIfPresent(VirtualDeviceDO::getImage, reqVO.getImage())
                .eqIfPresent(VirtualDeviceDO::getRoutePath, reqVO.getRoutePath())
                .eqIfPresent(VirtualDeviceDO::getStatus, reqVO.getStatus())
                .eqIfPresent(VirtualDeviceDO::getJsonData, reqVO.getJsonData())
                .betweenIfPresent(VirtualDeviceDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(VirtualDeviceDO::getTenantId, reqVO.getTenantId())
                .orderByDesc(VirtualDeviceDO::getId));
    }

}