package cn.cecep.talroad.vo.query;

import cn.cecep.talroad.common.core.domain.query.PageQuery;
import cn.cecep.talroad.domain.BMainEmissionPollutionSolidWaste;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;


/**
 * 企业排放信息-不同污染物年度排放趋势-固废对象 b_main_emission_pollution_solid_waste
 *
 * @author szhpt
 * @date 2023-01-31*/
@ApiModel(value = "企业排放信息-不同污染物年度排放趋势-固废")
@EqualsAndHashCode(callSuper = false)
@Data
public class BMainEmissionPollutionSolidWasteQuery extends PageQuery
{

    @ApiModelProperty(value = "主键id")
    private String id;
    @ApiModelProperty(value = "企业id")
    private String factoryId;
    @ApiModelProperty(value = "年份")
    private String pollYear;
    @ApiModelProperty(value = "污染类别")
    private String pollutionCategory;
    @ApiModelProperty(value = "数据源")
    private String dataSource;
    @ApiModelProperty(value = "固体废物类别")
    private String solidWasteType;
    @ApiModelProperty(value = "固体废物名称")
    private String solidWasteName;
    @ApiModelProperty(value = "年度计划产生量")
    private String annualPlannedOutput;
    @ApiModelProperty(value = "年度实际产生量")
    private String annualActualProduction;
    @ApiModelProperty(value = "年度贮存量")
    private String annualStorageCapacity;
    @ApiModelProperty(value = "年度转移量")
    private String annualTransferVolume;
    @ApiModelProperty(value = "年度自行处置利用量")
    private String annualDisposalUtilization;

    @ApiModelProperty(value = "检索开始年份(yyyy)")
    @TableField(exist = false)
    private Integer searchBeginYear;

    @ApiModelProperty(value = "检索截至年份(yyyy)")
    @TableField(exist = false)
    private Integer searchEndYear;

    public BMainEmissionPollutionSolidWasteQuery(String pollutionCategory, String dataSource, Integer searchBeginYear, Integer searchEndYear, String factoryId) {
        this.pollutionCategory = pollutionCategory;
        this.dataSource = dataSource;
        this.searchBeginYear = searchBeginYear;
        this.searchEndYear = searchEndYear;
        this.factoryId = factoryId;
    }

    public BMainEmissionPollutionSolidWasteQuery() {
    }

    /**
     *
     * @Title: getQueryWrapper
     * @Description: 查询参数组装
     * @param: @return
     * @return: QueryWrapper<BasIndustry>
     * @throws
     */
    public static QueryWrapper<BMainEmissionPollutionSolidWaste> createLambdaQueryWrapper(BMainEmissionPollutionSolidWasteQuery query) {
        QueryWrapper<BMainEmissionPollutionSolidWaste> wrapper = new QueryWrapper<>();
        wrapper.eq(ObjectUtil.isNotNull(query.getId()), "id", query.getId());
        wrapper.eq(ObjectUtil.isNotNull(query.getFactoryId()), "factory_id", query.getFactoryId());
        wrapper.eq(ObjectUtil.isNotNull(query.getPollYear()), "poll_year", query.getPollYear());
        wrapper.eq(ObjectUtil.isNotNull(query.getPollutionCategory()), "pollution_category", query.getPollutionCategory());
        wrapper.eq(ObjectUtil.isNotNull(query.getDataSource()), "data_source", query.getDataSource());
        wrapper.eq(ObjectUtil.isNotNull(query.getSolidWasteType()), "solid_waste_type", query.getSolidWasteType());
        wrapper.eq(ObjectUtil.isNotNull(query.getSolidWasteName()), "solid_waste_name", query.getSolidWasteName());
        wrapper.eq(ObjectUtil.isNotNull(query.getAnnualPlannedOutput()), "annual_planned_output", query.getAnnualPlannedOutput());
        wrapper.eq(ObjectUtil.isNotNull(query.getAnnualActualProduction()), "annual_actual_production", query.getAnnualActualProduction());
        wrapper.eq(ObjectUtil.isNotNull(query.getAnnualStorageCapacity()), "annual_storage_capacity", query.getAnnualStorageCapacity());
        wrapper.eq(ObjectUtil.isNotNull(query.getAnnualTransferVolume()), "annual_transfer_volume", query.getAnnualTransferVolume());
        wrapper.eq(ObjectUtil.isNotNull(query.getAnnualDisposalUtilization()), "annual_disposal_utilization", query.getAnnualDisposalUtilization());
        //检索起止年份
        wrapper.between(ObjectUtil.isNotEmpty(query.getSearchBeginYear()) && ObjectUtil.isNotEmpty(query.getSearchEndYear()), "poll_year", query.getSearchBeginYear()+"", query.getSearchEndYear()+"");
        wrapper.orderByAsc("poll_year");
        return wrapper;
    }
}
