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

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.character.KeyboardCharacterDO;
import org.apache.ibatis.annotations.Mapper;
import com.yolo.keyboard.controller.admin.character.vo.*;

/**
 * 键盘人设 Mapper
 *
 * @author ziin
 */
@Mapper
public interface KeyboardCharacterMapper extends BaseMapperX<KeyboardCharacterDO> {

    default PageResult<KeyboardCharacterDO> selectPage(KeyboardCharacterPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<KeyboardCharacterDO>()
                .eqIfPresent(KeyboardCharacterDO::getAvatarUrl, reqVO.getAvatarUrl())
                .eqIfPresent(KeyboardCharacterDO::getDownload, reqVO.getDownload())
                .eqIfPresent(KeyboardCharacterDO::getTag, reqVO.getTag())
                .eqIfPresent(KeyboardCharacterDO::getCreatedAt, reqVO.getCreatedAt())
                .eqIfPresent(KeyboardCharacterDO::getUpdatedAt, reqVO.getUpdatedAt())
                .eqIfPresent(KeyboardCharacterDO::getPrompt, reqVO.getPrompt())
                .eqIfPresent(KeyboardCharacterDO::getRank, reqVO.getRank())
                .eqIfPresent(KeyboardCharacterDO::getEmoji, reqVO.getEmoji())
                .orderByDesc(KeyboardCharacterDO::getId));
    }

}