package cn.iocoder.yudao.module.pms.dal.mysql.qhse.measure;

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.pms.controller.admin.qhse.measure.vo.IotMeasureRecordPageReqVO;
import cn.iocoder.yudao.module.pms.dal.dataobject.qhse.measure.IotMeasureRecordDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 计量器具-使用记录 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface IotMeasureRecordMapper extends BaseMapperX<IotMeasureRecordDO> {

    default PageResult<IotMeasureRecordDO> selectPage(IotMeasureRecordPageReqVO reqVO, Set<Long> ids) {
        return selectPage(reqVO, new LambdaQueryWrapperX<IotMeasureRecordDO>()
                .eqIfPresent(IotMeasureRecordDO::getMeasureId, reqVO.getMeasureId())
                .betweenIfPresent(IotMeasureRecordDO::getUseDate, reqVO.getUseDate())
                .eqIfPresent(IotMeasureRecordDO::getUseReason, reqVO.getUseReason())
                .eqIfPresent(IotMeasureRecordDO::getMeasureProject, reqVO.getMeasureProject())
                .eqIfPresent(IotMeasureRecordDO::getUsePerson, reqVO.getUsePerson())
                .eqIfPresent(IotMeasureRecordDO::getUserId, reqVO.getUserId())
                .betweenIfPresent(IotMeasureRecordDO::getCreateTime, reqVO.getCreateTime())
                .inIfPresent(IotMeasureRecordDO::getDeptId, ids)
                .orderByDesc(IotMeasureRecordDO::getId));
    }

}