package com.iformall.domain.po;

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

@Table(name = "wx_appinfo")
public class WxAppinfo 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;
	/*小程序ID**/
	@io.swagger.annotations.ApiModelProperty(value="小程序ID",name="appId")
	private String appId;
	/*公众号ID**/
	@io.swagger.annotations.ApiModelProperty(value="公众号ID",name="parentAppId")
	private String parentAppId;
	/*小程序名**/
	@io.swagger.annotations.ApiModelProperty(value="小程序名",name="name")
	private String name;
	/*小程序secret**/
	@io.swagger.annotations.ApiModelProperty(value="小程序secret",name="secret")
	private String secret;
	/*消息token**/
	@io.swagger.annotations.ApiModelProperty(value="消息token",name="token")
	private String token;
	/*消息aeskey**/
	@io.swagger.annotations.ApiModelProperty(value="消息aeskey",name="aesKey")
	private String aesKey;
	/*消息类型**/
	@io.swagger.annotations.ApiModelProperty(value="消息类型",name="msgDataFormat")
	private String msgDataFormat;
	/*微信访问token**/
	@io.swagger.annotations.ApiModelProperty(value="微信访问token",name="accessToken")
	private String accessToken;
	/*上次生成accesstoken时间**/
	@io.swagger.annotations.ApiModelProperty(value="上次生成accesstoken时间",name="lastTokenTime")
	private Date lastTokenTime;
	/*微信token有效时间单位（秒）**/
	@io.swagger.annotations.ApiModelProperty(value="微信token有效时间单位（秒）",name="expiresIn")
	private Integer expiresIn;
	/*支付ID,参看wx_pay_account**/
	@io.swagger.annotations.ApiModelProperty(value="支付ID,参看wx_pay_account",name="payId")
	private Long payId;
	@io.swagger.annotations.ApiModelProperty(value="1B端2C端",name="type")
	private Integer type;
	@io.swagger.annotations.ApiModelProperty(value="支付ID,参看wx_pay_account_bill",name="payBillId")
	private Long payBillId;

	public Long getPayBillId() {
		return payBillId;
	}

	public void setPayBillId(Long payBillId) {
		this.payBillId = payBillId;
	}

	public String  getTenantId() {
		return tenantId;
	}
	public void setTenantId(String _tenantId) {
		tenantId = _tenantId;
	}
	public String  getAppId() {
		return appId;
	}
	public void setAppId(String _appId) {
		appId = _appId;
	}
	public String getParentAppId() {
		return parentAppId;
	}

	public void setParentAppId(String parentAppId) {
		this.parentAppId = parentAppId;
	}
	public String  getName() {
		return name;
	}
	public void setName(String _name) {
		name = _name;
	}
	public String  getSecret() {
		return secret;
	}
	public void setSecret(String _secret) {
		secret = _secret;
	}
	public String  getToken() {
		return token;
	}
	public void setToken(String _token) {
		token = _token;
	}
	public String  getAesKey() {
		return aesKey;
	}
	public void setAesKey(String _aesKey) {
		aesKey = _aesKey;
	}
	public String  getMsgDataFormat() {
		return msgDataFormat;
	}
	public void setMsgDataFormat(String _msgDataFormat) {
		msgDataFormat = _msgDataFormat;
	}
	public String  getAccessToken() {
		return accessToken;
	}
	public void setAccessToken(String _accessToken) {
		accessToken = _accessToken;
	}
	public Date  getLastTokenTime() {
		return lastTokenTime;
	}
	public void setLastTokenTime(Date _lastTokenTime) {
		lastTokenTime = _lastTokenTime;
	}
	public Integer  getExpiresIn() {
		return expiresIn;
	}
	public void setExpiresIn(Integer _expiresIn) {
		expiresIn = _expiresIn;
	}
	public Long  getPayId() {
		return payId;
	}
	public void setPayId(Long _payId) {
		payId = _payId;
	}

	public Integer getType() {
		return type;
	}

	public void setType(Integer type) {
		this.type = type;
	}

	public static enum Field
	{
		Id_ASC("`id` ASC"),Id_DESC("`id` DESC")
			,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC")
			,AppId_ASC("`app_id` ASC"),AppId_DESC("`app_id` DESC")
			,ParentAppId_ASC("`parent_app_id` ASC"),ParentAppId_DESC("`parent_app_id` DESC")
			,Name_ASC("`name` ASC"),Name_DESC("`name` DESC")
			,Secret_ASC("`secret` ASC"),Secret_DESC("`secret` DESC")
			,Token_ASC("`token` ASC"),Token_DESC("`token` DESC")
			,AesKey_ASC("`aesKey` ASC"),AesKey_DESC("`aesKey` DESC")
			,MsgDataFormat_ASC("`msg_data_format` ASC"),MsgDataFormat_DESC("`msg_data_format` DESC")
			,AccessToken_ASC("`access_token` ASC"),AccessToken_DESC("`access_token` DESC")
			,LastTokenTime_ASC("`last_token_time` ASC"),LastTokenTime_DESC("`last_token_time` DESC")
			,ExpiresIn_ASC("`expires_in` ASC"),ExpiresIn_DESC("`expires_in` DESC")
			,PayId_ASC("`pay_id` ASC"),PayId_DESC("`pay_id` 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(WxAppinfo.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));
		}
	}
}
