package cn.cecep.talroad.vo.query;

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


/**
 * 各设备的监测参数属性对象 bas_device_param
 *
 * @author szhpt
 * @date 2023-01-10*/
@ApiModel(value = "各设备的监测参数属性")
@EqualsAndHashCode(callSuper = false)
@Data
public class BasDeviceParamQuery extends PageQuery
{

    @ApiModelProperty(value = "ID")
    private Long id;
    @ApiModelProperty(value = "设备ID")
    private String deviceId;
    @ApiModelProperty(value = "参数ID")
    private String paramId;
    @ApiModelProperty(value = "所属行业 枚举。钢铁/焦化/水泥...")
    private String industry;
    @ApiModelProperty(value = "所属设备类别 枚举。焦炉/烧结机...")
    private String deviceType;
    @ApiModelProperty(value = "所属设施类别 枚举。生产/CEMS...")
    private String facilityType;
    @ApiModelProperty(value = "正常值")
    private String normalValue;
    @ApiModelProperty(value = "最小值")
    private String minValue;
    @ApiModelProperty(value = "最大值")
    private String maxValue;
    @ApiModelProperty(value = "Q1(下四分位)值 用于异常值判断")
    private String q1Value;
    @ApiModelProperty(value = "Q2(上四分位)值 用于异常值判断")
    private String q2Value;
    @ApiModelProperty(value = "参数是否联网 0=否，1=是")
    private Long isOnline;
    @ApiModelProperty(value = "备用值数量 数量不含原值")
    private Long standbyNum;
    @ApiModelProperty(value = "多值数量 数量不含原值")
    private Long multiNum;
    @ApiModelProperty(value = "超标阈值 超过此值则认为超标")
    private String overMaxVal;
    @ApiModelProperty(value = "创建时间")
    private String createTime;
    @ApiModelProperty(value = "是否启用，0：未启用，1：启用")
    private String isStatus;


    /**
     *
     * @Title: getQueryWrapper
     * @Description: 查询参数组装
     * @param: @return
     * @return: QueryWrapper<BasIndustry>
     * @throws
     */
    public static QueryWrapper<BasDeviceParam> createLambdaQueryWrapper(BasDeviceParamQuery query) {
        QueryWrapper<BasDeviceParam> wrapper = new QueryWrapper<>();
        wrapper.eq(ObjectUtil.isNotNull(query.getId()), "id", query.getId());
        wrapper.eq(ObjectUtil.isNotNull(query.getDeviceId()), "device_id", query.getDeviceId());
        wrapper.eq(ObjectUtil.isNotNull(query.getParamId()), "param_id", query.getParamId());
        wrapper.eq(ObjectUtil.isNotNull(query.getIndustry()), "industry", query.getIndustry());
        wrapper.eq(ObjectUtil.isNotNull(query.getDeviceType()), "device_type", query.getDeviceType());
        wrapper.eq(ObjectUtil.isNotNull(query.getFacilityType()), "facility_type", query.getFacilityType());
        wrapper.eq(ObjectUtil.isNotNull(query.getNormalValue()), "normal_value", query.getNormalValue());
        wrapper.eq(ObjectUtil.isNotNull(query.getMinValue()), "min_value", query.getMinValue());
        wrapper.eq(ObjectUtil.isNotNull(query.getMaxValue()), "max_value", query.getMaxValue());
        wrapper.eq(ObjectUtil.isNotNull(query.getQ1Value()), "q1_value", query.getQ1Value());
        wrapper.eq(ObjectUtil.isNotNull(query.getQ2Value()), "q2_value", query.getQ2Value());
        wrapper.eq(ObjectUtil.isNotNull(query.getIsOnline()), "is_online", query.getIsOnline());
        wrapper.eq(ObjectUtil.isNotNull(query.getStandbyNum()), "standby_num", query.getStandbyNum());
        wrapper.eq(ObjectUtil.isNotNull(query.getMultiNum()), "multi_num", query.getMultiNum());
        wrapper.eq(ObjectUtil.isNotNull(query.getOverMaxVal()), "over_max_val", query.getOverMaxVal());
        wrapper.eq(ObjectUtil.isNotNull(query.getCreateTime()), "create_time", query.getCreateTime());
        wrapper.eq(StrUtil.isNotBlank(query.getIsStatus()), "is_status", query.getIsStatus());
        return wrapper;
        }
}
