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_mall_floor")
public class WxMallFloor 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="mallId")
	private Long mallId;
	/*楼座id**/
	@io.swagger.annotations.ApiModelProperty(value="楼座id",name="buildingId")
	private Long buildingId;
	/*楼层名**/
	@io.swagger.annotations.ApiModelProperty(value="楼层名",name="floorName")
	private String floorName;
	/*底图路径**/
	@io.swagger.annotations.ApiModelProperty(value="底图路径",name="backgroundImg")
	private String backgroundImg;
	/*创建时间**/
	@io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate")
	private Date createDate;
	/*更新时间**/
	@io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate")
	private Date updateDate;

	@Transient
	protected List<WxMallFloor> floors;

	public String  getTenantId() {
		return tenantId;
	}
	public void setTenantId(String _tenantId) {
		tenantId = _tenantId;
	}
	public Long  getMallId() {
		return mallId;
	}
	public void setMallId(Long _mallId) {
		mallId = _mallId;
	}
	public Long  getBuildingId() {
		return buildingId;
	}
	public void setBuildingId(Long _buildingId) {
		buildingId = _buildingId;
	}
	public String  getFloorName() {
		return floorName;
	}
	public void setFloorName(String _floorName) {
		floorName = _floorName;
	}
	public String  getBackgroundImg() {
		return backgroundImg;
	}
	public void setBackgroundImg(String _backgroundImg) {
		backgroundImg = _backgroundImg;
	}
	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 static enum Field
	{
		Id_ASC("`id` ASC"),Id_DESC("`id` DESC")
			,TenantId_ASC("`tenantId` ASC"),TenantId_DESC("`tenantId` DESC")
			,MallId_ASC("`mallId` ASC"),MallId_DESC("`mallId` DESC")
			,BuildingId_ASC("`buildingId` ASC"),BuildingId_DESC("`buildingId` DESC")
			,FloorName_ASC("`floorName` ASC"),FloorName_DESC("`floorName` DESC")
			,BackgroundImg_ASC("`backgroundImg` ASC"),BackgroundImg_DESC("`backgroundImg` DESC")
			,CreateDate_ASC("`createDate` ASC"),CreateDate_DESC("`createDate` DESC")
			,UpdateDate_ASC("`updateDate` ASC"),UpdateDate_DESC("`updateDate` 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(WxMallFloor.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));
		}
	}
}
