package com.iformall.domain.po;

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

@Table(name = "wx_admin_log")
public class WxAdminLog 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;
	}
	
	
	
	/*租户ID**/
	@io.swagger.annotations.ApiModelProperty(value="租户ID",name="tenantId")
	private String tenantId;
	/*网址**/
	@io.swagger.annotations.ApiModelProperty(value="网址",name="url")
	private String url;
	/*时间**/
	@io.swagger.annotations.ApiModelProperty(value="时间",name="actionDate")
	private String actionDate;
	/*1. pv 2. uv**/
	@io.swagger.annotations.ApiModelProperty(value="1. pv 2. uv",name="type")
	private Integer type;
	/*计数**/
	@io.swagger.annotations.ApiModelProperty(value="计数",name="count")
	private Integer count;
	public String  getTenantId() {
		return tenantId;
	}
	public void setTenantId(String _tenantId) {
		tenantId = _tenantId;
	}
	public String  getUrl() {
		return url;
	}
	public void setUrl(String _url) {
		url = _url;
	}
	public String  getActionDate() {
		return actionDate;
	}
	public void setActionDate(String _actionDate) {
		actionDate = _actionDate;
	}
	public Integer  getType() {
		return type;
	}
	public void setType(Integer _type) {
		type = _type;
	}
	public Integer  getCount() {
		return count;
	}
	public void setCount(Integer _count) {
		count = _count;
	}



	public static enum Field
	{
		Id_ASC("`id` ASC"),Id_DESC("`id` DESC")
			,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC")
			,Url_ASC("`url` ASC"),Url_DESC("`url` DESC")
			,ActionDate_ASC("`actionDate` ASC"),ActionDate_DESC("`actionDate` DESC")
			,Type_ASC("`type` ASC"),Type_DESC("`type` DESC")
			,Count_ASC("`count` ASC"),Count_DESC("`count` 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(WxAdminLog.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());
		}
		 
	}
	
	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));
		}
	}
}
