package cn.cecep.talroad.vo.query;

import cn.cecep.talroad.common.core.domain.query.PageQuery;
import cn.cecep.talroad.domain.MonElecEvent;
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;


/**
 * 有组织-分表计电设备对应 两类设备为多对多的关系对象 mon_elec_event
 *
 * @author szhpt
 * @date 2023-01-10*/
@ApiModel(value = "有组织-分表计电设备对应 两类设备为多对多的关系")
@EqualsAndHashCode(callSuper = false)
@Data
public class MonElecEventQuery extends PageQuery
{

    @ApiModelProperty(value = "数据ID")
    private Long dataId;
    @ApiModelProperty(value = "企业ID 冗余")
    private String factoryId;
    @ApiModelProperty(value = "点位ID")
    private String siteId;
    @ApiModelProperty(value = "时间类型 枚举。总为“实时”")
    private String timeType;
    @ApiModelProperty(value = "数据时间")
    private String dataTime;
    @ApiModelProperty(value = "停上电 0=上电，1=停电")
    private Long tn50;
    @ApiModelProperty(value = "设备状态 0=关机状态，1=开机状态")
    private Long tn62;
    @ApiModelProperty(value = "电流幅值突变 百分比的分子值")
    private String tn63;
    @ApiModelProperty(value = "电压幅值突变 百分比的分子值")
    private String tn64;
    @ApiModelProperty(value = "设备异常破坏 0=关，1=开")
    private Long tn65;
    @ApiModelProperty(value = "创建时间")
    private String createTime;
    /**
     *
     * @Title: getQueryWrapper
     * @Description: 查询参数组装
     * @param: @return
     * @return: QueryWrapper<BasIndustry>
     * @throws
     */
    public static QueryWrapper<MonElecEvent> createLambdaQueryWrapper(MonElecEventQuery query) {
        QueryWrapper<MonElecEvent> wrapper = new QueryWrapper<>();
        wrapper.eq(ObjectUtil.isNotNull(query.getDataId()), "data_id", query.getDataId());
        wrapper.eq(ObjectUtil.isNotNull(query.getFactoryId()), "factory_id", query.getFactoryId());
        wrapper.eq(ObjectUtil.isNotNull(query.getSiteId()), "site_id", query.getSiteId());
        wrapper.eq(ObjectUtil.isNotNull(query.getTimeType()), "time_type", query.getTimeType());
        wrapper.eq(ObjectUtil.isNotNull(query.getDataTime()), "data_time", query.getDataTime());
        wrapper.eq(ObjectUtil.isNotNull(query.getTn50()), "tn50", query.getTn50());
        wrapper.eq(ObjectUtil.isNotNull(query.getTn62()), "tn62", query.getTn62());
        wrapper.eq(ObjectUtil.isNotNull(query.getTn63()), "tn63", query.getTn63());
        wrapper.eq(ObjectUtil.isNotNull(query.getTn64()), "tn64", query.getTn64());
        wrapper.eq(ObjectUtil.isNotNull(query.getTn65()), "tn65", query.getTn65());
        wrapper.eq(ObjectUtil.isNotNull(query.getCreateTime()), "create_time", query.getCreateTime());
        return wrapper;
        }
}
