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

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

import java.util.List;


/**
 * 企业装备停限产分析报(DCS)对象 s_ra_real_time_analysis_stop
 *
 * @author szhpt
 * @date 2023-03-24*/
@ApiModel(value = "企业装备停限产分析报(DCS)")
@EqualsAndHashCode(callSuper = false)
@Data
public class SRaRealTimeAnalysisStopQuery extends PageQuery
{

    @ApiModelProperty(value = "数据主键")
    private String dataId;
    @ApiModelProperty(value = "企业名称")
    private String factoryName;
    @ApiModelProperty(value = "行业类别")
    private String industryCategoryCode;
    @ApiModelProperty(value = "所在区县编码")
    private String districtCode;
    @ApiModelProperty(value = "设备名称")
    private String deviceName;
    @ApiModelProperty(value = "设备编号")
    private String deviceId;
    @ApiModelProperty(value = "工序")
    private String workingProcedure;
    @ApiModelProperty(value = "分析开始时间")
    private String analyseStartTime;
    @ApiModelProperty(value = "分析截至时间")
    private String analyseEndTime;
    private List<String> regionCodes;
    /**
     *
     * @Title: getQueryWrapper
     * @Description: 查询参数组装
     * @param: @return
     * @return: QueryWrapper<BasIndustry>
     * @throws
     */
    public static QueryWrapper<SRaRealTimeAnalysisStop> createLambdaQueryWrapper(SRaRealTimeAnalysisStopQuery query) {
        QueryWrapper<SRaRealTimeAnalysisStop> wrapper = new QueryWrapper<>();
        wrapper.eq(ObjectUtil.isNotNull(query.getDataId()), "data_id", query.getDataId());
        wrapper.like(ObjectUtil.isNotNull(query.getFactoryName()), "factory_name", query.getFactoryName());
        wrapper.eq(ObjectUtil.isNotNull(query.getIndustryCategoryCode()), "industry_category_code", query.getIndustryCategoryCode());
        wrapper.eq(ObjectUtil.isNotNull(query.getDistrictCode()), "district_code", query.getDistrictCode());
        wrapper.eq(ObjectUtil.isNotNull(query.getDeviceName()), "device_name", query.getDeviceName());
        wrapper.eq(ObjectUtil.isNotNull(query.getDeviceId()), "device_id", query.getDeviceId());
        wrapper.eq(ObjectUtil.isNotNull(query.getWorkingProcedure()), "working_procedure", query.getWorkingProcedure());
        wrapper.between(StringUtils.isNotEmpty(query.getAnalyseStartTime()) && StringUtils.isNotEmpty(query.getAnalyseEndTime()), "analyse_time", DateUtils.parseDate(query.getAnalyseStartTime()), DateUtils.parseDate(query.getAnalyseEndTime()));
        return wrapper;
        }
}
