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

import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.framework.mybatis.core.mapper.BaseMapperX;
import cn.iocoder.yudao.framework.mybatis.core.query.LambdaQueryWrapperX;
import cn.iocoder.yudao.module.pms.controller.admin.qhse.environment.vo.IotEnvironmentRecognizePageReqVO;
import cn.iocoder.yudao.module.pms.dal.dataobject.qhse.environment.IotEnvironmentRecognizeDO;
import org.apache.ibatis.annotations.Mapper;

import java.util.Set;

/**
 * 环境因素识别 Mapper
 *
 * @author 超级管理员
 */
@Mapper
public interface IotEnvironmentRecognizeMapper extends BaseMapperX<IotEnvironmentRecognizeDO> {

    default PageResult<IotEnvironmentRecognizeDO> selectPage(IotEnvironmentRecognizePageReqVO reqVO, Set<Long> deptIds) {
        return selectPage(reqVO, new LambdaQueryWrapperX<IotEnvironmentRecognizeDO>()
                .eqIfPresent(IotEnvironmentRecognizeDO::getProcess, reqVO.getProcess())
                .eqIfPresent(IotEnvironmentRecognizeDO::getStepBreak, reqVO.getStepBreak())
                .eqIfPresent(IotEnvironmentRecognizeDO::getEnvironmentElement, reqVO.getEnvironmentElement())
                .eqIfPresent(IotEnvironmentRecognizeDO::getTimeBefore, reqVO.getTimeBefore())
                .eqIfPresent(IotEnvironmentRecognizeDO::getTimeNow, reqVO.getTimeNow())
                .eqIfPresent(IotEnvironmentRecognizeDO::getTimeFuture, reqVO.getTimeFuture())
                .eqIfPresent(IotEnvironmentRecognizeDO::getStatusNormal, reqVO.getStatusNormal())
                .eqIfPresent(IotEnvironmentRecognizeDO::getStatusException, reqVO.getStatusException())
                .eqIfPresent(IotEnvironmentRecognizeDO::getStatusDanger, reqVO.getStatusDanger())
                .eqIfPresent(IotEnvironmentRecognizeDO::getTypeEnergy, reqVO.getTypeEnergy())
                .eqIfPresent(IotEnvironmentRecognizeDO::getTypeWater, reqVO.getTypeWater())
                .eqIfPresent(IotEnvironmentRecognizeDO::getTypeGas, reqVO.getTypeGas())
                .eqIfPresent(IotEnvironmentRecognizeDO::getTypeNoise, reqVO.getTypeNoise())
                .eqIfPresent(IotEnvironmentRecognizeDO::getTypeWaste, reqVO.getTypeWaste())
                .eqIfPresent(IotEnvironmentRecognizeDO::getTypeSoil, reqVO.getTypeSoil())
                .eqIfPresent(IotEnvironmentRecognizeDO::getTypeOther, reqVO.getTypeOther())
                .eqIfPresent(IotEnvironmentRecognizeDO::getControlMethod, reqVO.getControlMethod())
                .betweenIfPresent(IotEnvironmentRecognizeDO::getCreateTime, reqVO.getCreateTime())
                .eqIfPresent(IotEnvironmentRecognizeDO::getRemark, reqVO.getRemark())
//                .eqIfPresent(IotEnvironmentRecognizeDO::getDeptId, reqVO.getDeptId())
                .inIfPresent(IotEnvironmentRecognizeDO::getDeptId, deptIds)
                .orderByDesc(IotEnvironmentRecognizeDO::getId));
    }

}