package cn.cecep.talroad.vo;

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

import java.util.Date;

/**
 * @className: MonElecOperationLog
 * @description: TODO 类描述
 * @author: Mr.Yanghongtao
 * @date: 2023/04/28 15:25
 * @Company: Copyright© [2023/04/28 15:25] by [Mr.Yanghongtao]
 **/

/**
 * 分表计电系统参数设置操作日志表
 */
@ApiModel(value = "分表计电系统参数设置操作日志vo")
@Data
@EqualsAndHashCode(callSuper = false)
public class MonElecOperationLogQuery extends PageQuery {
    /**
     * 主键标识
     */
    private String logId;

    /**
     * 操作时间
     */
    private Date operationTime;

    /**
     * 分表计电监测点位名称
     */
    private String elecStationName;

    /**
     * 对应设施名称
     */
    private String deviceName;

    /**
     * 操作前额定功率(kw)
     */
    private String beforeModifyNormal;

    /**
     * 操作后额定功率(kw)
     */
    private String afterModifyNormal;

    /**
     * 操作人
     */
    private String operator;

    /**
     * 操作人ID
     */
    private String operatorId;

    /**
     * 企业ID
     */
    private String factoryId;

    @ApiModelProperty(value = "开始时间")
    private Date startTime;

    @ApiModelProperty(value = "结束时间")
    private Date endTime;
    public static QueryWrapper<MonElecOperationLog> createLambdaQueryWrapper(MonElecOperationLogQuery query) {
        QueryWrapper<MonElecOperationLog> wrapper = new QueryWrapper<>();

        wrapper.ge(ObjectUtil.isNotNull(query.getStartTime()), "operation_time", query.getStartTime());
        wrapper.le(ObjectUtil.isNotNull(query.getEndTime()), "operation_time", query.getEndTime());
        wrapper.eq(ObjectUtil.isNotNull(query.getElecStationName()), "elec_station_name", query.getElecStationName());
        wrapper.eq(ObjectUtil.isNotNull(query.getDeviceName()), "device_name", query.getDeviceName());
        wrapper.eq(ObjectUtil.isNotNull(query.getFactoryId()), "factory_id", query.getFactoryId());
        wrapper.orderByDesc("operation_time");
        return wrapper;
    }

}
