package com.iformall.domain.po;

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

@Table(name = "wx_date_amount_record")
public class WxDateAmountRecord implements Serializable {
	private static final long serialVersionUID = 1L;
	
	@Id
    protected Long id;
    
    @Transient
    protected List<Long> 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<Long> getIds() {
		return ids;
	}

	public void setIds(List<Long> ids) {
		this.ids = ids;
	}
	
	
	
	/*日期**/
	@io.swagger.annotations.ApiModelProperty(value="日期",name="date")
	private Date date;
	/*周几 从1开始**/
	@io.swagger.annotations.ApiModelProperty(value="周几 从1开始",name="dayOfWeek")
	private Integer dayOfWeek;
	/*一年第几周**/
	@io.swagger.annotations.ApiModelProperty(value="一年第几周",name="weekOfYear")
	private Integer weekOfYear;
	/*金额**/
	@io.swagger.annotations.ApiModelProperty(value="金额",name="payPrice")
	private Integer payPrice;
	/*租户id**/
	@io.swagger.annotations.ApiModelProperty(value="租户id",name="tenantId")
	private String tenantId;
	/*月份**/
	@io.swagger.annotations.ApiModelProperty(value="月份",name="month")
	private Integer month;
	/*商户id**/
	@io.swagger.annotations.ApiModelProperty(value="商户id",name="merchantId")
	private Long merchantId;
	/*创建日期**/
	@io.swagger.annotations.ApiModelProperty(value="创建日期",name="createDate")
	private Date createDate;
	/*更新日期**/
	@io.swagger.annotations.ApiModelProperty(value="更新日期",name="updateDate")
	private Date updateDate;
	/*类型：0 交易记录 1.核销记录**/
	@io.swagger.annotations.ApiModelProperty(value="类型：0 交易记录 1.核销记录",name="type")
	private Integer type;
	public Date  getDate() {
		return date;
	}
	public void setDate(Date _date) {
		date = _date;
	}
	public Integer  getDayOfWeek() {
		return dayOfWeek;
	}
	public void setDayOfWeek(Integer _dayOfWeek) {
		dayOfWeek = _dayOfWeek;
	}
	public Integer  getWeekOfYear() {
		return weekOfYear;
	}
	public void setWeekOfYear(Integer _weekOfYear) {
		weekOfYear = _weekOfYear;
	}
	public Integer  getPayPrice() {
		return payPrice;
	}
	public void setPayPrice(Integer _payPrice) {
		payPrice = _payPrice;
	}
	public String  getTenantId() {
		return tenantId;
	}
	public void setTenantId(String _tenantId) {
		tenantId = _tenantId;
	}
	public Integer  getMonth() {
		return month;
	}
	public void setMonth(Integer _month) {
		month = _month;
	}
	public Long  getMerchantId() {
		return merchantId;
	}
	public void setMerchantId(Long _merchantId) {
		merchantId = _merchantId;
	}
	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 Integer  getType() {
		return type;
	}
	public void setType(Integer _type) {
		type = _type;
	}



	public static enum Field
	{
		Id_ASC("`id` ASC"),Id_DESC("`id` DESC")
			,Date_ASC("`date` ASC"),Date_DESC("`date` DESC")
			,DayOfWeek_ASC("`day_of_week` ASC"),DayOfWeek_DESC("`day_of_week` DESC")
			,WeekOfYear_ASC("`week_of_year` ASC"),WeekOfYear_DESC("`week_of_year` DESC")
			,PayPrice_ASC("`pay_price` ASC"),PayPrice_DESC("`pay_price` DESC")
			,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC")
			,Month_ASC("`month` ASC"),Month_DESC("`month` DESC")
			,MerchantId_ASC("`merchant_id` ASC"),MerchantId_DESC("`merchant_id` DESC")
			,CreateDate_ASC("`create_date` ASC"),CreateDate_DESC("`create_date` DESC")
			,UpdateDate_ASC("`update_date` ASC"),UpdateDate_DESC("`update_date` DESC")
			,Type_ASC("`type` ASC"),Type_DESC("`type` 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(WxDateAmountRecord.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));
		}
	}
}
