package com.zt.plat.module.qms.resource.device.dal.mapper;

import com.zt.plat.framework.common.pojo.PageResult;
import com.zt.plat.framework.mybatis.core.query.LambdaQueryWrapperX;
import com.zt.plat.framework.mybatis.core.mapper.BaseMapperX;
import com.zt.plat.module.qms.resource.device.controller.vo.DeviceConfigBusinessRulePageReqVO;
import com.zt.plat.module.qms.resource.device.dal.dataobject.DeviceConfigBusinessRuleDO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 设备-业务配置 Mapper
 *
 * @author 后台管理-1
 */
@Mapper
public interface DeviceConfigBusinessRuleMapper extends BaseMapperX<DeviceConfigBusinessRuleDO> {

    default PageResult<DeviceConfigBusinessRuleDO> selectPage(DeviceConfigBusinessRulePageReqVO reqVO) {
        return selectPage(reqVO, new LambdaQueryWrapperX<DeviceConfigBusinessRuleDO>()
                .eqIfPresent(DeviceConfigBusinessRuleDO::getProductId, reqVO.getProductId())
                .eqIfPresent(DeviceConfigBusinessRuleDO::getBusinessDomain, reqVO.getBusinessDomain())
                .eqIfPresent(DeviceConfigBusinessRuleDO::getRequireFlag, reqVO.getRequireFlag())
                .eqIfPresent(DeviceConfigBusinessRuleDO::getSubitemDomainType, reqVO.getSubitemDomainType())
                .eqIfPresent(DeviceConfigBusinessRuleDO::getFrequencyType, reqVO.getFrequencyType())
                .eqIfPresent(DeviceConfigBusinessRuleDO::getFrequency, reqVO.getFrequency())
                .eqIfPresent(DeviceConfigBusinessRuleDO::getFrequencyRemark, reqVO.getFrequencyRemark())
                .eqIfPresent(DeviceConfigBusinessRuleDO::getReportTemplateKey, reqVO.getReportTemplateKey())
                .eqIfPresent(DeviceConfigBusinessRuleDO::getFormComponent, reqVO.getFormComponent())
                .eqIfPresent(DeviceConfigBusinessRuleDO::getTreatmentMethod, reqVO.getTreatmentMethod())
                .eqIfPresent(DeviceConfigBusinessRuleDO::getTreatmentUser, reqVO.getTreatmentUser())
                .eqIfPresent(DeviceConfigBusinessRuleDO::getCalibrationCheckType, reqVO.getCalibrationCheckType())
                .eqIfPresent(DeviceConfigBusinessRuleDO::getStandard, reqVO.getStandard())
                .eqIfPresent(DeviceConfigBusinessRuleDO::getSystemDepartmentCode, reqVO.getSystemDepartmentCode())
                .eqIfPresent(DeviceConfigBusinessRuleDO::getRemark, reqVO.getRemark())
                .betweenIfPresent(DeviceConfigBusinessRuleDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(DeviceConfigBusinessRuleDO::getId));
    }

}