package com.iformall.domain.po;

import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import java.io.Serializable;
import java.util.Date;
import java.util.List;

@Table(name = "wx_merchant_trade_daily")
public class WxMerchantTradeDaily implements Serializable {
    private static final long serialVersionUID = 1L;

    @Id
    protected Long id;

    @Transient
    protected List<String> ids;
    @Transient
    protected String sortColumns;

    public Long getId() {
        return id;
    }

    public void setId(Long id) {
        this.id = id;
    }

    public String getSortColumns() {
        return sortColumns;
    }

    public List<String> getIds() {
        return ids;
    }

    public void setIds(List<String> ids) {
        this.ids = ids;
    }


    /*租户ID**/
    @io.swagger.annotations.ApiModelProperty(value = "租户ID", name = "tenantId")
    private String tenantId;
    /*商户id**/
    @io.swagger.annotations.ApiModelProperty(value = "商户id", name = "merchantId")
    private Long merchantId;
    /*b用户id**/
    @io.swagger.annotations.ApiModelProperty(value = "b用户id", name = "bUserId")
    private Long bUserId;
    /*交易额**/
    @io.swagger.annotations.ApiModelProperty(value = "交易额", name = "tradeAmt")
    private Integer tradeAmt;
    /*提交日期**/
    @io.swagger.annotations.ApiModelProperty(value = "解单提交日期", name = "createDate")
    private Date createDate;
    /*更新日期**/
    @io.swagger.annotations.ApiModelProperty(value = "解单更新日期", name = "updateDate")
    private Date updateDate;
    /*解单日期**/
    @io.swagger.annotations.ApiModelProperty(value = "解单日期", name = "reportDate")
    private String reportDate;

    public String getTenantId() {
        return tenantId;
    }

    public void setTenantId(String _tenantId) {
        tenantId = _tenantId;
    }

    public Long getMerchantId() {
        return merchantId;
    }

    public void setMerchantId(Long _merchantId) {
        merchantId = _merchantId;
    }

    public Long getbUserId() {
        return bUserId;
    }

    public void setbUserId(Long bUserId) {
        this.bUserId = bUserId;
    }

    public Integer getTradeAmt() {
        return tradeAmt;
    }

    public void setTradeAmt(Integer _tradeAmt) {
        tradeAmt = _tradeAmt;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date _createDate) {
        createDate = _createDate;
    }

    public Date getUpdateDate() {
        return updateDate;
    }

    public void setUpdateDate(Date _updateDate) {
        updateDate = _updateDate;
    }

    public String getReportDate() {
        return reportDate;
    }

    public void setReportDate(String _reportDate) {
        reportDate = _reportDate;
    }


    public static enum Field {
        Id_ASC("`id` ASC"), Id_DESC("`id` DESC"),
        TenantId_ASC("`tenant_id` ASC"), TenantId_DESC("`tenant_id` DESC"),
        MerchantId_ASC("`merchant_id` ASC"), MerchantId_DESC("`merchant_id` DESC"),
        TradeAmt_ASC("`trade_amt` ASC"), TradeAmt_DESC("`trade_amt` DESC"),
        CreateDate_ASC("`create_date` ASC"), CreateDate_DESC("`create_date` DESC")
        ;
        private String value;

        Field(String value) {
            this.value = value;
        }

        public String getValue() {
            return value;
        }

        public void setCol(String value) {
            this.value = value;
        }

        @Override
        public String toString() {
            return this.getValue();
        }
    }

    public void setSortColumns(WxMerchantTradeDaily.Field... fields) {
        if (fields == null || fields.length == 0) {
            return;
        }
        for (int k = 0; k < fields.length; k++) {
            if (fields[k] == null) {
                return;
            }
        }
        StringBuilder sb = new StringBuilder(fields[0].toString());
        for (int k = 1; k < fields.length; k++) {
            sb.append(",");
            sb.append(fields[k].toString());
        }
        this.sortColumns = sb.toString();
    }

    public void setSortColumns(String sortColumns) {
        if (sortColumns == null || "".equals(sortColumns.trim())) {
            return;
        }
        if (sortColumns.contains(",")) {
            String[] cols = sortColumns.split(",");
            java.util.List<Field> fList = new java.util.ArrayList();
            for (int k = 0; k < cols.length; k++) {
                fList.add(Field.valueOf(cols[k]));
            }
            this.setSortColumns(fList.toArray(new Field[fList.size()]));
        } else {
            this.setSortColumns(Field.valueOf(sortColumns));
        }
    }
}
