package com.pavis.admin.aigc.mapper;

import com.pavis.admin.aigc.model.resp.ModelResp;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import top.continew.starter.data.mp.base.BaseMapper;
import com.pavis.admin.aigc.model.entity.ModelDO;

import java.util.List;

/**
 * AIGC模型配置 Mapper
 *
 * @author semi
 * @since 2025/05/26 17:28
 */
public interface ModelMapper extends BaseMapper<ModelDO> {
    /**
     * 获取模型
     * 
     * @return 列表
     */
    @Select("SELECT * FROM aigc_model")
    List<ModelResp> selectByModel();

    @Select("SELECT * from aigc_model am left join aigc_model_secret ams on am.id = ams.model_id")
    List<ModelResp> selModelAndSecret();

    @Select("<script>" + "SELECT * FROM aigc_model am LEFT JOIN aigc_model_secret ams ON am.id = ams.model_id " + "WHERE 1=1 " + "<if test='type != null'>" + "  AND am.type=#{type}" + "</if>" + "<if test='provider != null'>" + "  AND am.provider=#{provider}" + "</if>" + "</script>")
    List<ModelResp> selModelAndSecretList(@Param("type") String type, @Param("provider") String provider);
}