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_profit_sharing_receiver")
public class WxProfitSharingReceiver 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="merchantId")
	private Long merchantId;
	/*分账接收方类型,1 = MERCHANT_ID(商户 ID) 2 = PERSONAL_WECHATID(个人微信号) 3 = PERSONAL_OPENID(个人openid(由父商 户 APPID 转换得到) 4 = PERSONAL_SUB_OPENID(个人 sub_openid(由子商户 APPID 转换得到))**/
	@io.swagger.annotations.ApiModelProperty(value="分账接收方类型,1 = MERCHANT_ID(商户 ID) 2 = PERSONAL_WECHATID(个人微信号) 3 = PERSONAL_OPENID(个人openid(由父商 户 APPID 转换得到) 4 = PERSONAL_SUB_OPENID(个人 sub_openid(由子商户 APPID 转换得到))",name="receiverType")
	private Integer receiverType;
	/*分账接收方账号,见接收方类型**/
	@io.swagger.annotations.ApiModelProperty(value="分账接收方账号,见接收方类型",name="receiverAccount")
	private String receiverAccount;
	/*分款接受方说明**/
	@io.swagger.annotations.ApiModelProperty(value="分款接受方说明",name="receiverComments")
	private String receiverComments;
	/***/
	@io.swagger.annotations.ApiModelProperty(value="",name="createTime")
	private Date createTime;
	/***/
	@io.swagger.annotations.ApiModelProperty(value="",name="updateTime")
	private Date updateTime;
	/*分账类型:1-服务商户分账,2-商户转入银行卡**/
	@io.swagger.annotations.ApiModelProperty(value="分账类型:1-服务商户分账,2-商户转入银行卡",name="sharingType")
	private Integer sharingType;
	/***/
	@io.swagger.annotations.ApiModelProperty(value="",name="bankNo")
	private String bankNo;
	/***/
	@io.swagger.annotations.ApiModelProperty(value="",name="trueName")
	private String trueName;
	/***/
	@io.swagger.annotations.ApiModelProperty(value="",name="bankCode")
	private String bankCode;
	/*分账接收方状态 0,正常 1,停用**/
	@io.swagger.annotations.ApiModelProperty(value="分账接收方状态 0,正常 1,停用",name="status")
	private Integer status;
	/*分账参数**/
	@io.swagger.annotations.ApiModelProperty(value="分账参数,目前为分账比例(单位为万分之一)",name="parameter")
	private String parameter;

	/*分账金额**/
	@Transient
	private Integer sharingAmount;


	public Integer getStatus() {
		return status;
	}

	public void setStatus(Integer status) {
		this.status = status;
	}

	public String getTenantId() {
		return tenantId;
	}

	public void setTenantId(String tenantId) {
		this.tenantId = tenantId;
	}

	public Long  getMerchantId() {
		return merchantId;
	}
	public void setMerchantId(Long _merchantId) {
		merchantId = _merchantId;
	}
	public Integer  getReceiverType() {
		return receiverType;
	}
	public void setReceiverType(Integer _receiverType) {
		receiverType = _receiverType;
	}
	public String  getReceiverAccount() {
		return receiverAccount;
	}
	public void setReceiverAccount(String _receiverAccount) {
		receiverAccount = _receiverAccount;
	}
	public String  getReceiverComments() {
		return receiverComments;
	}
	public void setReceiverComments(String _receiverComments) {
		receiverComments = _receiverComments;
	}
	public Date  getCreateTime() {
		return createTime;
	}
	public void setCreateTime(Date _createTime) {
		createTime = _createTime;
	}
	public Date  getUpdateTime() {
		return updateTime;
	}
	public void setUpdateTime(Date _updateTime) {
		updateTime = _updateTime;
	}
	public Integer  getSharingType() {
		return sharingType;
	}
	public void setSharingType(Integer _sharingType) {
		sharingType = _sharingType;
	}
	public String  getBankNo() {
		return bankNo;
	}
	public void setBankNo(String _bankNo) {
		bankNo = _bankNo;
	}
	public String  getTrueName() {
		return trueName;
	}
	public void setTrueName(String _trueName) {
		trueName = _trueName;
	}
	public String  getBankCode() {
		return bankCode;
	}
	public void setBankCode(String _bankCode) {
		bankCode = _bankCode;
	}

	public String getParameter() {
		return parameter;
	}

	public void setParameter(String parameter) {
		this.parameter = parameter;
	}

	public Integer getSharingAmount() {
		return sharingAmount;
	}

	public void setSharingAmount(Integer sharingAmount) {
		this.sharingAmount = sharingAmount;
	}

	public static enum Field
	{
		Id_ASC("`id` ASC"),Id_DESC("`id` DESC")
			,TenantId_ASC("`tenant_id` ASC"),TenantId_DESC("`tenant_id` DESC")
			,MerchantId_ASC("`merchant_id` ASC"),MerchantId_DESC("`merchant_id` DESC")
			,ReceiverType_ASC("`receiver_type` ASC"),ReceiverType_DESC("`receiver_type` DESC")
			,ReceiverAccount_ASC("`receiver_account` ASC"),ReceiverAccount_DESC("`receiver_account` DESC")
			,ReceiverComments_ASC("`receiver_comments` ASC"),ReceiverComments_DESC("`receiver_comments` DESC")
			,CreateTime_ASC("`create_time` ASC"),CreateTime_DESC("`create_time` DESC")
			,UpdateTime_ASC("`update_time` ASC"),UpdateTime_DESC("`update_time` DESC")
			,SharingType_ASC("`sharing_type` ASC"),SharingType_DESC("`sharing_type` DESC")
			,BankNo_ASC("`bank_no` ASC"),BankNo_DESC("`bank_no` DESC")
			,TrueName_ASC("`true_name` ASC"),TrueName_DESC("`true_name` DESC")
			,BankCode_ASC("`bank_code` ASC"),BankCode_DESC("`bank_code` 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(WxProfitSharingReceiver.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));
		}
	}
}
