package cn.cecep.talroad.vo.query;

import cn.cecep.talroad.common.core.utils.StringUtils;
import cn.cecep.talroad.domain.analysis.SRaRealTimeAnalysisRun;
import cn.cecep.talroad.vo.query.analysis.SRaRealTimeAnalysisRunQuery;
import cn.hutool.core.util.ObjectUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import cn.cecep.talroad.domain.SRaRealTimeAnalysisRunOne;
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_real_time_analysis_run_one
 *
 * @author szhpt
 * @date 2023-05-17*/
@ApiModel(value = "关联分析系统-企业生产过程分析-企业装备运行情况实时分析每个设备只存一条数据")
@EqualsAndHashCode(callSuper = false)
@Data
public class SRaRealTimeAnalysisRunOneQuery 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 deviceId;
    @ApiModelProperty(value = "设备类型(生产设备/治理设备)")
    private String deviceType;
    @ApiModelProperty(value = "运行状态(1=运行,2=停运,3=启停,4=停启,5=数据缺失,6=数据恒值,7-数据异常)")
    private String operationStatus;
    private List<String> regionCodes;

    /**
     *
     * @Title: getQueryWrapper
     * @Description: 查询参数组装
     * @param: @return
     * @return: QueryWrapper<BasIndustry>
     * @throws
     */
    public static QueryWrapper<SRaRealTimeAnalysisRunOne> createLambdaQueryWrapper(SRaRealTimeAnalysisRunOneQuery query) {
        QueryWrapper<SRaRealTimeAnalysisRunOne> wrapper = new QueryWrapper<>();
        wrapper.eq(ObjectUtil.isNotNull(query.getDataId()), "data_id", query.getDataId());
        wrapper.like(StringUtils.isNotEmpty(query.getFactoryName()), "factory_name", query.getFactoryName());
        wrapper.eq(StringUtils.isNotEmpty(query.getIndustryCategoryCode()), "industry_permission_name", query.getIndustryCategoryCode());
        wrapper.like(StringUtils.isNotEmpty(query.getDistrictCode()), "district_code", query.getDistrictCode());
        wrapper.eq(StringUtils.isNotEmpty(query.getDeviceId()), "device_id", query.getDeviceId());
        wrapper.eq(StringUtils.isNotEmpty(query.getDeviceType()), "device_type", query.getDeviceType());
        wrapper.eq(StringUtils.isNotEmpty(query.getOperationStatus()), "operation_status", query.getOperationStatus());
        wrapper.orderByAsc("device_id");
        return wrapper;
    }
}
