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

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

/**
 * 用户人设管理 Mapper
 *
 * @author ziin
 */
@Mapper
public interface KeyboardUserCharacterMapper extends BaseMapperX<KeyboardUserCharacterDO> {

    default PageResult<KeyboardUserCharacterDO> selectPage(KeyboardUserCharacterPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<KeyboardUserCharacterDO>()
                .eqIfPresent(KeyboardUserCharacterDO::getCharacterId, reqVO.getCharacterId())
                .eqIfPresent(KeyboardUserCharacterDO::getCreatedAt, reqVO.getCreatedAt())
                .eqIfPresent(KeyboardUserCharacterDO::getUpdatedAt, reqVO.getUpdatedAt())
                .eqIfPresent(KeyboardUserCharacterDO::getUserId, reqVO.getUserId())
                .eqIfPresent(KeyboardUserCharacterDO::getEmoji, reqVO.getEmoji())
                .orderByDesc(KeyboardUserCharacterDO::getId));
    }

}