package com.yolo.keyboard.dal.mysql.aicompanion;

import java.util.*;

import com.yolo.keyboard.framework.common.pojo.PageResult;
import com.yolo.keyboard.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.yolo.keyboard.framework.mybatis.core.mapper.BaseMapperX;
import com.yolo.keyboard.dal.dataobject.aicompanion.KeyboardAiCompanionDO;
import org.apache.ibatis.annotations.Mapper;
import com.yolo.keyboard.controller.admin.aicompanion.vo.*;

/**
 * AI陪聊角色表，用于定义恋爱/陪伴型虚拟角色的基础信息与人设 Mapper
 *
 * @author ziin
 */
@Mapper
public interface KeyboardAiCompanionMapper extends BaseMapperX<KeyboardAiCompanionDO> {

    default PageResult<KeyboardAiCompanionDO> selectPage(KeyboardAiCompanionPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<KeyboardAiCompanionDO>()
                .eqIfPresent(KeyboardAiCompanionDO::getAvatarUrl, reqVO.getAvatarUrl())
                .eqIfPresent(KeyboardAiCompanionDO::getCoverImageUrl, reqVO.getCoverImageUrl())
                .eqIfPresent(KeyboardAiCompanionDO::getGender, reqVO.getGender())
                .eqIfPresent(KeyboardAiCompanionDO::getAgeRange, reqVO.getAgeRange())
                .eqIfPresent(KeyboardAiCompanionDO::getPersonalityTags, reqVO.getPersonalityTags())
                .eqIfPresent(KeyboardAiCompanionDO::getSpeakingStyle, reqVO.getSpeakingStyle())
                .eqIfPresent(KeyboardAiCompanionDO::getSystemPrompt, reqVO.getSystemPrompt())
                .eqIfPresent(KeyboardAiCompanionDO::getStatus, reqVO.getStatus())
                .eqIfPresent(KeyboardAiCompanionDO::getVisibility, reqVO.getVisibility())
                .eqIfPresent(KeyboardAiCompanionDO::getSortOrder, reqVO.getSortOrder())
                .eqIfPresent(KeyboardAiCompanionDO::getPopularityScore, reqVO.getPopularityScore())
                .eqIfPresent(KeyboardAiCompanionDO::getCreatedAt, reqVO.getCreatedAt())
                .eqIfPresent(KeyboardAiCompanionDO::getUpdatedAt, reqVO.getUpdatedAt())
                .eqIfPresent(KeyboardAiCompanionDO::getVoiceId, reqVO.getVoiceId())
                .orderByDesc(KeyboardAiCompanionDO::getId));
    }

}