All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.mobaijun.influxdb.core.model.AbstractQueryModel Maven / Gradle / Ivy

Go to download

Influxdb Quick Action Launcher, which encapsulates commonly used operations such as addition, deletion, modification and query

There is a newer version: 3.0.14
Show newest version
/*
 * Copyright (C) 2022 www.mobaijun.com
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *         https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.mobaijun.influxdb.core.model;

import com.mobaijun.influxdb.core.constant.Constant;
import com.mobaijun.influxdb.core.enums.Order;

/**
 * Software:IntelliJ IDEA 2021.3.2
 * ClassName: QueryModel
 * 类描述: 查询model、
 *
 * @author MoBaiJun 2022/4/29 13:57
 */
public abstract class AbstractQueryModel extends BaseModel {

    /**
     * 查询的字段
     */
    private String select;

    /**
     * influxdb仅支持time排序
     * Order.DESC Order.ASC
     */
    private Order order;

    /**
     * 当前页
     */
    private Long pageNum;

    /**
     * 每页的大小
     */
    private Long pageSize;

    /**
     * 默认不使用时区
     */
    private Boolean useTimeZone = false;

    /**
     * 默认时区 Asia/Shanghai
     */
    private String timeZone = "tz('Asia/Shanghai')";

    /**
     * 分组
     */
    private String group;

    public AbstractQueryModel() {

    }

    public AbstractQueryModel(String measurement) {
        super(measurement);
    }

    public StringBuilder getPageQuery() {
        return new StringBuilder()
                .append(Constant.LIMIT)
                .append(pageSize)
                .append(Constant.OFFSET)
                .append((pageNum - 1) * pageSize);
    }

    public String getSelect() {
        if (select.isEmpty() && select.trim().isEmpty()) {
            select = Constant.ALL.trim();
        }
        return select;
    }

    public void setSelect(String select) {
        this.select = select;
    }

    public Order getOrder() {
        return order;
    }

    public void setOrder(Order order) {
        this.order = order;
    }

    public Long getPageNum() {
        return pageNum;
    }

    public void setPageNum(Long pageNum) {
        this.pageNum = pageNum;
    }

    public Long getPageSize() {
        return pageSize;
    }

    public void setPageSize(Long pageSize) {
        this.pageSize = pageSize;
    }

    public Boolean getUseTimeZone() {
        return useTimeZone;
    }

    public void setUseTimeZone(Boolean useTimeZone) {
        this.useTimeZone = useTimeZone;
    }

    public String getTimeZone() {
        return timeZone;
    }

    public void setTimeZone(String timeZone) {
        this.timeZone = timeZone;
    }

    public String getGroup() {
        return group;
    }

    public void setGroup(String group) {
        this.group = group;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy