package cn.iocoder.yudao.module.server.dal.mysql.materialdownloadlog;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.module.server.dal.dataobject.materialdownloadlog.MaterialDownloadLogDO;
import org.apache.ibatis.annotations.Mapper;
import cn.iocoder.yudao.module.server.controller.admin.materialdownloadlog.vo.*;

/**
 * 资料下载日志 Mapper
 *
 * @author TRS
 */
@Mapper
public interface MaterialDownloadLogMapper extends BaseMapperX<MaterialDownloadLogDO> {

    default PageResult<MaterialDownloadLogDO> selectPage(MaterialDownloadLogPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<MaterialDownloadLogDO>()
                .eqIfPresent(MaterialDownloadLogDO::getMaterialId, reqVO.getMaterialId())
                .eqIfPresent(MaterialDownloadLogDO::getUserId, reqVO.getUserId())
                .betweenIfPresent(MaterialDownloadLogDO::getDownloadTime, reqVO.getDownloadTime())
                .eqIfPresent(MaterialDownloadLogDO::getIpAddress, reqVO.getIpAddress())
                .betweenIfPresent(MaterialDownloadLogDO::getCreateTime, reqVO.getCreateTime())
                .likeIfPresent(MaterialDownloadLogDO::getMaterialName, reqVO.getMaterialName())
                .likeIfPresent(MaterialDownloadLogDO::getUserName, reqVO.getUserName())
                .orderByDesc(MaterialDownloadLogDO::getId));
    }

}