package cn.iocoder.yudao.module.llm.dal.mysql.basemodel;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.llm.dal.dataobject.basemodel.BaseModelDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.llm.controller.admin.basemodel.vo.*;

/**
 * 基座模型 Mapper
 *
 * @author 华大大模型
 */
@Mapper
public interface BaseModelMapper extends BaseMapperX<BaseModelDO> {

    default PageResult<BaseModelDO> selectPage(BaseModelPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<BaseModelDO>()
                .likeIfPresent(BaseModelDO::getModelName, reqVO.getModelName())
                .eqIfPresent(BaseModelDO::getParameterCount, reqVO.getParameterCount())
                .eqIfPresent(BaseModelDO::getMaxContextLength, reqVO.getMaxContextLength())
                .eqIfPresent(BaseModelDO::getModelType, reqVO.getModelType())
                .eqIfPresent(BaseModelDO::getIsActive, reqVO.getIsActive())
                .eqIfPresent(BaseModelDO::getIsFinetuned, reqVO.getIsFinetuned())
                .eqIfPresent(BaseModelDO::getNotes, reqVO.getNotes())
                .betweenIfPresent(BaseModelDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(BaseModelDO::getId));
    }

}