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_c_user_car")
public class WxCUserCar 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;
	/*c端用户id**/
	@io.swagger.annotations.ApiModelProperty(value="c端用户id",name="cUserId")
	private Long cUserId;
	/*车牌号**/
	@io.swagger.annotations.ApiModelProperty(value="车牌号",name="carNumber")
	private String carNumber;
	/*创建时间**/
	@io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate")
	private Date createDate;
	/*更新时间**/
	@io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateDate")
	private Date updateDate;
	/*停车厂家（2:TJD）**/
	@io.swagger.annotations.ApiModelProperty(value="停车厂家（2:TJD）",name="vendorType")
	private Integer vendorType;
	/*停车厂家参数**/
	@io.swagger.annotations.ApiModelProperty(value="停车厂家参数",name="vendorParams")
	private String vendorParams;
	public String  getTenantId() {
		return tenantId;
	}
	public void setTenantId(String _tenantId) {
		tenantId = _tenantId;
	}
	public Long  getCUserId() {
		return cUserId;
	}
	public void setCUserId(Long _cUserId) {
		cUserId = _cUserId;
	}
	public String  getCarNumber() {
		return carNumber;
	}
	public void setCarNumber(String _carNumber) {
		carNumber = _carNumber;
	}
	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  getVendorType() {
		return vendorType;
	}
	public void setVendorType(Integer _vendorType) {
		vendorType = _vendorType;
	}
	public String  getVendorParams() {
		return vendorParams;
	}
	public void setVendorParams(String _vendorParams) {
		vendorParams = _vendorParams;
	}



	public static enum Field
	{
		Id_ASC("`id` ASC"),Id_DESC("`id` DESC")
			,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC")
			,CUserId_ASC("`c_user_id` ASC"),CUserId_DESC("`c_user_id` DESC")
			,CarNumber_ASC("`car_number` ASC"),CarNumber_DESC("`car_number` DESC")
			,CreateDate_ASC("`create_date` ASC"),CreateDate_DESC("`create_date` DESC")
			,UpdateDate_ASC("`update_date` ASC"),UpdateDate_DESC("`update_date` DESC")
			,VendorType_ASC("`vendor_type` ASC"),VendorType_DESC("`vendor_type` DESC")
			,VendorParams_ASC("`vendor_params` ASC"),VendorParams_DESC("`vendor_params` 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(WxCUserCar.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));
		}
	}
}
