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

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

/**
 * AI TTS文转音 Mapper
 *
 * @author lyb
 */
@Mapper
public interface AiTtsMapper extends BaseMapperX<AiTtsDO> {

    default PageResult<AiTtsDO> selectPage(AiTtsPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<AiTtsDO>()
                .likeIfPresent(AiTtsDO::getName, reqVO.getName())
                .eqIfPresent(AiTtsDO::getModel, reqVO.getModel())
                .eqIfPresent(AiTtsDO::getPlatform, reqVO.getPlatform())
                .eqIfPresent(AiTtsDO::getType, reqVO.getType())
                .eqIfPresent(AiTtsDO::getSort, reqVO.getSort())
                .eqIfPresent(AiTtsDO::getStatus, reqVO.getStatus())
                .eqIfPresent(AiTtsDO::getSpeechRate, reqVO.getSpeechRate())
                .eqIfPresent(AiTtsDO::getVolume, reqVO.getVolume())
                .eqIfPresent(AiTtsDO::getPitchRate, reqVO.getPitchRate())
                .betweenIfPresent(AiTtsDO::getCreateTime, reqVO.getCreateTime())
                .orderByAsc(AiTtsDO::getSort));
    }


    /**
     * 获得AI TTS文转音精简列表，用于前端的选择框
     *
     * @param status 状态
     * @return AI TTS文转音精简列表
     */
    List<AiTtsDO> getTtsSimpleListByStatus(Integer status);

}