package com.tashow.cloud.ai.dal.mysql.model;

import com.tashow.cloud.ai.controller.admin.model.vo.AiModelPageReqVO;
import com.tashow.cloud.ai.dal.dataobject.model.AiModelDO;
import com.tashow.cloud.common.pojo.PageResult;
import com.tashow.cloud.mybatis.mybatis.core.mapper.BaseMapperX;
import com.tashow.cloud.mybatis.mybatis.core.query.LambdaQueryWrapperX;
import org.apache.ibatis.annotations.Mapper;

/**
 * AI模型管理 Mapper
 *
 * @author tashow
 */
@Mapper
public interface AiModelMapper extends BaseMapperX<AiModelDO> {

    default PageResult<AiModelDO> selectPage(AiModelPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AiModelDO>()
                .likeIfPresent(AiModelDO::getModelName, reqVO.getModelName())
                .eqIfPresent(AiModelDO::getVersion, reqVO.getVersion())
                .eqIfPresent(AiModelDO::getStatus, reqVO.getStatus())
                .orderByDesc(AiModelDO::getCreateTime));
    }

}
