package com.iformall.domain.po;

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

@Table(name = "wx_mall_apply")
public class WxMallApply 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;
	}

	@Transient
	protected String verifyCode;
	
	/*购物中心名称**/
	@io.swagger.annotations.ApiModelProperty(value="购物中心名称",name="mallName")
	private String mallName;
	/*联系人姓名**/
	@io.swagger.annotations.ApiModelProperty(value="联系人姓名",name="applicant")
	private String applicant;
	/***/
	@io.swagger.annotations.ApiModelProperty(value="",name="phone")
	private String phone;
	/*申请时间**/
	@io.swagger.annotations.ApiModelProperty(value="申请时间",name="applyDate")
	private Date applyDate;
	public String  getMallName() {
		return mallName;
	}
	public void setMallName(String _mallName) {
		mallName = _mallName;
	}
	public String  getApplicant() {
		return applicant;
	}
	public void setApplicant(String _applicant) {
		applicant = _applicant;
	}
	public String  getPhone() {
		return phone;
	}
	public void setPhone(String _phone) {
		phone = _phone;
	}
	public Date  getApplyDate() {
		return applyDate;
	}
	public void setApplyDate(Date _applyDate) {
		applyDate = _applyDate;
	}

	public String getVerifyCode() {
		return verifyCode;
	}

	public void setVerifyCode(String verifyCode) {
		this.verifyCode = verifyCode;
	}

	public static enum Field
	{
		Id_ASC("`id` ASC"),Id_DESC("`id` DESC")
			,MallName_ASC("`mall_name` ASC"),MallName_DESC("`mall_name` DESC")
			,Applicant_ASC("`applicant` ASC"),Applicant_DESC("`applicant` DESC")
			,Phone_ASC("`phone` ASC"),Phone_DESC("`phone` DESC")
			,ApplyDate_ASC("`apply_date` ASC"),ApplyDate_DESC("`apply_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(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(",");
			List<Field> fList = new 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));
		}
	}
}
