package cn.iocoder.yudao.module.system.dal.mysql.worklog;

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.system.controller.admin.worklog.vo.statisticsrecord.LogStatisticsRecordPageReqVO;
import cn.iocoder.yudao.module.system.dal.dataobject.worklog.LogStatisticsRecordDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 工作日志统计记录 Mapper
 *
 * @author 艾楷
 */
@Mapper
public interface LogStatisticsRecordMapper extends BaseMapperX<LogStatisticsRecordDO> {

    default PageResult<LogStatisticsRecordDO> selectPage(LogStatisticsRecordPageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<LogStatisticsRecordDO>()
                .eqIfPresent(LogStatisticsRecordDO::getFormId, reqVO.getFormId())
                .eqIfPresent(LogStatisticsRecordDO::getRuleId, reqVO.getRuleId())
                .eqIfPresent(LogStatisticsRecordDO::getStatisticsFlag, reqVO.getStatisticsFlag())
                .betweenIfPresent(LogStatisticsRecordDO::getTime, reqVO.getTime())
                .betweenIfPresent(LogStatisticsRecordDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(LogStatisticsRecordDO::getId));
    }

}