package cn.cecep.talroad.vo.query.analysis;

import cn.cecep.talroad.common.core.utils.DateUtils;
import cn.cecep.talroad.common.core.utils.StringUtils;
import cn.cecep.talroad.domain.analysis.SRaSelfMonitoringData;
import cn.hutool.core.collection.CollectionUtil;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.cecep.talroad.common.core.domain.query.PageQuery;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import java.util.Date;
import java.util.List;


/**
 * 关联分析系统-企业自行监测数据对象 s_ra_self_monitoring_data
 *
 * @author szhpt
 * @date 2023-06-27*/
@ApiModel(value = "关联分析系统-企业自行监测数据")
@EqualsAndHashCode(callSuper = false)
@Data
public class SRaSelfMonitoringDataQuery extends PageQuery
{

    @ApiModelProperty(value = "数据主键")
    private String dataId;
    @ApiModelProperty(value = "企业主键")
    private String factoryId;
    @ApiModelProperty(value = "企业名称")
    private String factoryName;
    @ApiModelProperty(value = "存企业表排污许可行业字段类别名称(多个使用'、'拼接)")
    private String industryCategoryName;
    @ApiModelProperty(value = "存企业表排污许可行业字段类别编码(多个使用'、'拼接)")
    private String industryCategoryCode;
    @ApiModelProperty(value = "所在区县名称")
    private String districtName;
    @ApiModelProperty(value = "所在区县编码")
    private String districtCode;
    @ApiModelProperty(value = "污染物名称")
    private String pollutantsName;
    @ApiModelProperty(value = "污染物编码")
    private String pollutantsCode;
    @ApiModelProperty(value = "采样时间")
    private String monitorTime;
    @ApiModelProperty(value = "入库时间")
    private String createTime;
    @ApiModelProperty(value = "监测点id")
    private String monitorId;
    @ApiModelProperty(value = "监测点名称")
    private String monitoringName;
    @ApiModelProperty(value = "流量（m3/h）")
    private String flow;
    @ApiModelProperty(value = "温度（%）")
    private String temperatureHumidity;
    @ApiModelProperty(value = "含氧量（%）")
    private String oxygenContent;
    @ApiModelProperty(value = "流速（m/s）")
    private String velocity;
    @ApiModelProperty(value = "生产负荷（%）")
    private String productionLoad;
    @ApiModelProperty(value = "实测浓度")
    private String actualConcentration;
    @ApiModelProperty(value = "折算浓度")
    private String obversionConcentration;
    @ApiModelProperty(value = "限值上限")
    private String upperValue;
    @ApiModelProperty(value = "限值下限")
    private String lowerValue;
    @ApiModelProperty(value = "频次单位")
    private String frequencyUnit;
    @ApiModelProperty(value = "是否超标；0---否，1----是")
    private String exceedingStandard;
    @ApiModelProperty(value = "超标倍数")
    private String exceedingMultiple;
    @ApiModelProperty(value = "湿度")
    private String humidity;
    @ApiModelProperty(value = "频次值")
    private String frequencyValue;
    @ApiModelProperty(value = "超标原因")
    private String reason;
    @ApiModelProperty(value = "采样开始时间")
    private String analyseStartTime;
    @ApiModelProperty(value = "采样截至时间")
    private String analyseEndTime;

    private List<String> regionCodes;
    @ApiModelProperty(value = "污染物类型：1水，2气")
    private String pollutantsType;
    /**
     *
     * @Title: getQueryWrapper
     * @Description: 查询参数组装
     * @param: @return
     * @return: QueryWrapper<BasIndustry>
     * @throws
     */
    public static QueryWrapper<SRaSelfMonitoringData> createLambdaQueryWrapper(SRaSelfMonitoringDataQuery query) {
        QueryWrapper<SRaSelfMonitoringData> wrapper = new QueryWrapper<>();
        wrapper.eq(StringUtils.isNotEmpty(query.getFactoryId()), "factory_id", query.getFactoryId());
        wrapper.eq(StringUtils.isNotEmpty(query.getFactoryName()), "factory_name", query.getFactoryName());
        wrapper.eq(StringUtils.isNotEmpty(query.getIndustryCategoryName()), "industry_category_name", query.getIndustryCategoryName());
        wrapper.eq(StringUtils.isNotEmpty(query.getIndustryCategoryCode()), "industry_category_code", query.getIndustryCategoryCode());
        wrapper.eq(StringUtils.isNotEmpty(query.getDistrictName()), "district_name", query.getDistrictName());
        wrapper.eq(StringUtils.isNotEmpty(query.getDistrictCode()), "district_code", query.getDistrictCode());
        wrapper.in(CollectionUtil.isNotEmpty(query.getRegionCodes()), "district_code", query.getRegionCodes());
        wrapper.eq(StringUtils.isNotEmpty(query.getPollutantsName()), "pollutants_name", query.getPollutantsName());
        wrapper.eq(StringUtils.isNotEmpty(query.getPollutantsCode()), "pollutants_code", query.getPollutantsCode());
        wrapper.eq(StringUtils.isNotEmpty(query.getMonitorTime()), "monitor_time", query.getMonitorTime());
        wrapper.eq(StringUtils.isNotEmpty(query.getCreateTime()), "create_time", query.getCreateTime());
        wrapper.eq(StringUtils.isNotEmpty(query.getMonitorId()), "monitor_id", query.getMonitorId());
        wrapper.eq(StringUtils.isNotEmpty(query.getMonitoringName()), "monitoring_name", query.getMonitoringName());
        wrapper.eq(StringUtils.isNotEmpty(query.getFlow()), "flow", query.getFlow());
        wrapper.eq(StringUtils.isNotEmpty(query.getTemperatureHumidity()), "temperature_humidity", query.getTemperatureHumidity());
        wrapper.eq(StringUtils.isNotEmpty(query.getOxygenContent()), "oxygen_content", query.getOxygenContent());
        wrapper.eq(StringUtils.isNotEmpty(query.getVelocity()), "velocity", query.getVelocity());
        wrapper.eq(StringUtils.isNotEmpty(query.getProductionLoad()), "production_load", query.getProductionLoad());
        wrapper.eq(StringUtils.isNotEmpty(query.getActualConcentration()), "actual_concentration", query.getActualConcentration());
        wrapper.eq(StringUtils.isNotEmpty(query.getObversionConcentration()), "obversion_concentration", query.getObversionConcentration());
        wrapper.eq(StringUtils.isNotEmpty(query.getUpperValue()), "upper_value", query.getUpperValue());
        wrapper.eq(StringUtils.isNotEmpty(query.getLowerValue()), "lower_value", query.getLowerValue());
        wrapper.eq(StringUtils.isNotEmpty(query.getFrequencyUnit()), "frequency_unit", query.getFrequencyUnit());
        wrapper.eq(StringUtils.isNotEmpty(query.getExceedingStandard()), "exceeding_standard", query.getExceedingStandard());
        wrapper.eq(StringUtils.isNotEmpty(query.getExceedingMultiple()), "exceeding_multiple", query.getExceedingMultiple());
        wrapper.eq(StringUtils.isNotEmpty(query.getHumidity()), "humidity", query.getHumidity());
        wrapper.eq(StringUtils.isNotEmpty(query.getFrequencyValue()), "frequency_value", query.getFrequencyValue());
        wrapper.eq(StringUtils.isNotEmpty(query.getReason()), "reason", query.getReason());
        wrapper.eq(StringUtils.isNotEmpty(query.getPollutantsType()), "pollutants_type", query.getPollutantsType());
        wrapper.between(StringUtils.isNotEmpty(query.getAnalyseStartTime()) && StringUtils.isNotEmpty(query.getAnalyseEndTime()), "monitor_time", DateUtils.parseDate(query.getAnalyseStartTime()), DateUtils.parseDate(query.getAnalyseEndTime()));
        wrapper.orderByDesc("monitor_time");
        return wrapper;
        }
}
