package com.jojubanking.boot.module.system.dal.mysql.usecount;

import java.util.*;

import com.jojubanking.boot.framework.common.pojo.PageResult;
import com.jojubanking.boot.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.jojubanking.boot.framework.mybatis.core.mapper.BaseMapperX;
import com.jojubanking.boot.module.system.dal.dataobject.usecount.UseCountDO;
import org.apache.ibatis.annotations.Mapper;
import com.jojubanking.boot.module.system.controller.admin.usecount.vo.*;

/**
 * 统计 Mapper
 *
 * @author admin
 */
@Mapper
public interface UseCountMapper extends BaseMapperX<UseCountDO> {

    default PageResult<UseCountDO> selectPage(UseCountPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<UseCountDO>()
                .eqIfPresent(UseCountDO::getInterfaceIdentification, reqVO.getInterfaceIdentification())
                .eqIfPresent(UseCountDO::getUserId, reqVO.getUserId())
                .betweenIfPresent(UseCountDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(UseCountDO::getId));
    }

    default List<UseCountDO> selectList(UseCountExportReqVO reqVO) {
        return selectList(new LambdaQueryWrapperX<UseCountDO>()
                .eqIfPresent(UseCountDO::getInterfaceIdentification, reqVO.getInterfaceIdentification())
                .eqIfPresent(UseCountDO::getUserId, reqVO.getUserId())
                .betweenIfPresent(UseCountDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(UseCountDO::getId));
    }

}
