package com.keyware.shandan.browser.entity;



import com.keyware.shandan.common.util.StringUtils;
import joptsimple.internal.Strings;
import lombok.Getter;
import lombok.Setter;

/**
 * 排序
 *
 * @author GuoXin
 * @date 2023/8/29
 */
@Getter
@Setter
public class SearchResultSort extends PageVo<Object> {
    //排序字段
    private String field;
    //排序方式
    private String sort;

    /**
     * @return order by sql语句
     */
    public String getOrderBy() {
        return isEmpty() ? Strings.EMPTY : " order by " + getField() + " " + getSort();
    }

    public boolean isEmpty() {
        return StringUtils.isBlankAny(this.field, this.sort);
    }
}