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

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

@Data
public class BasDeviceParamAnalyseQuery extends PageQuery {
    @ApiModelProperty(value="数据类型 1：DCS监控数据:，2：分表计电监测数据，3：在线监测数据，4：无组织监控数据:5：网格化监控数据，6：废水国省控站点监控数据，7：废气国省控站点监控数据")
    private String dataType;
    @ApiModelProperty(value="设备类型")
    private String deviceType;
    @ApiModelProperty(value="参数名称")
    private String deviceParamName;
    @ApiModelProperty(value="是否参与恒值预警 0否1是")
    private String contourEw;
    @ApiModelProperty(value="是否参与数据逻辑异常预警 0否1是")
    private String dataLogicAbnormalEw;
    @ApiModelProperty(value="是否参与数据异常波动预警 0否1是")
    private String dataLogicFluctuateEw;
    @ApiModelProperty(value="是否参与数据缺失报警 0否1是")
    private String dataLogicDeficiencyEw;
    public static QueryWrapper<BasDeviceParamAnalyse> createLambdaQueryWrapper(BasDeviceParamAnalyseQuery query) {
        QueryWrapper<BasDeviceParamAnalyse> wrapper = new QueryWrapper<>();
        wrapper.eq(ObjectUtil.isNotEmpty(query.getDataType()), "data_type", query.getDataType());
        wrapper.like(ObjectUtil.isNotEmpty(query.getDeviceType()), "device_type", query.getDeviceType());
        wrapper.like(ObjectUtil.isNotEmpty(query.getDeviceParamName()), "device_param_name", query.getDeviceParamName());
        wrapper.eq(ObjectUtil.isNotEmpty(query.getContourEw()), "contour_ew", query.getContourEw());
        wrapper.eq(ObjectUtil.isNotEmpty(query.getDataLogicAbnormalEw()), "data_logic_abnormal_ew", query.getDataLogicAbnormalEw());
        wrapper.eq(ObjectUtil.isNotEmpty(query.getDataLogicFluctuateEw()), "data_logic_fluctuate_ew", query.getDataLogicFluctuateEw());
        wrapper.eq(ObjectUtil.isNotEmpty(query.getDataLogicDeficiencyEw()), "data_logic_deficiency_ew", query.getDataLogicDeficiencyEw());
        return wrapper;
    }
}
