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_result")
public class WxProfitSharingResult 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;

	/*分账订单号**/
	@io.swagger.annotations.ApiModelProperty(value="分账订单号",name="sharingOrderId")
	private Long sharingOrderId;
	/*分账接收方id**/
	@io.swagger.annotations.ApiModelProperty(value="分账接收方id",name="sharingReceiverId")
	private Long sharingReceiverId;
	/*分账金额(分)**/
	@io.swagger.annotations.ApiModelProperty(value="分账金额(分)",name="payAmount")
	private Integer payAmount;
	/*更新时间**/
	@io.swagger.annotations.ApiModelProperty(value="更新时间",name="updateTime")
	private Date updateTime;
	/*创建时间**/
	@io.swagger.annotations.ApiModelProperty(value="创建时间",name="createTime")
	private Date createTime;
	/*分账结果状态:1-PENDING:待分账 2-SUCCESS:分账成功 3-ADJUST:分账失败待调账 4-RETURNED:已转回分账方 5-CLOSED: 已关闭 **/
	@io.swagger.annotations.ApiModelProperty(value="分账结果状态:1-PENDING:待分账 2-SUCCESS:分账成功 3-ADJUST:分账失败待调账 4-RETURNED:已转回分账方 5-CLOSED: 已关闭 ",name="sharingStatus")
	private Integer sharingStatus;
	/*微信返回的分账完成时间**/
	@io.swagger.annotations.ApiModelProperty(value="微信返回的分账完成时间",name="finishTime")
	private String finishTime;
	/*微信返回的失败原因**/
	@io.swagger.annotations.ApiModelProperty(value="微信返回的失败原因",name="failedReason")
	private String failedReason;
	/*描述**/
	@io.swagger.annotations.ApiModelProperty(value="描述",name="description")
	private String description;


	public Long  getSharingOrderId() {
		return sharingOrderId;
	}
	public void setSharingOrderId(Long _sharingOrderId) {
		sharingOrderId = _sharingOrderId;
	}
	public Long  getSharingReceiverId() {
		return sharingReceiverId;
	}
	public void setSharingReceiverId(Long _sharingReceiverId) {
		sharingReceiverId = _sharingReceiverId;
	}
	public Integer  getPayAmount() {
		return payAmount;
	}
	public void setPayAmount(Integer _payAmount) {
		payAmount = _payAmount;
	}
	public Date  getUpdateTime() {
		return updateTime;
	}
	public void setUpdateTime(Date _updateTime) {
		updateTime = _updateTime;
	}
	public Date  getCreateTime() {
		return createTime;
	}
	public void setCreateTime(Date _createTime) {
		createTime = _createTime;
	}
	public Integer  getSharingStatus() {
		return sharingStatus;
	}
	public void setSharingStatus(Integer _sharingStatus) {
		sharingStatus = _sharingStatus;
	}
	public String  getFinishTime() {
		return finishTime;
	}
	public void setFinishTime(String _finishTime) {
		finishTime = _finishTime;
	}
	public String  getFailedReason() {
		return failedReason;
	}
	public void setFailedReason(String _failedReason) {
		failedReason = _failedReason;
	}
	public Long getMerchantId() {
		return merchantId;
	}

	public void setMerchantId(Long merchantId) {
		this.merchantId = merchantId;
	}

	public String getTenantId() {

		return tenantId;
	}

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

	public String getDescription() {
		return description;
	}

	public void setDescription(String description) {
		this.description = description;
	}

	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")
			,SharingOrderId_ASC("`sharing_order_id` ASC"),SharingOrderId_DESC("`sharing_order_id` DESC")
			,SharingReceiverId_ASC("`sharing_receiver_id` ASC"),SharingReceiverId_DESC("`sharing_receiver_id` DESC")
			,PayAmount_ASC("`pay_amount` ASC"),PayAmount_DESC("`pay_amount` DESC")
			,UpdateTime_ASC("`update_time` ASC"),UpdateTime_DESC("`update_time` DESC")
			,CreateTime_ASC("`create_time` ASC"),CreateTime_DESC("`create_time` DESC")
			,SharingStatus_ASC("`sharing_status` ASC"),SharingStatus_DESC("`sharing_status` DESC")
			,FinishTime_ASC("`finish_time` ASC"),FinishTime_DESC("`finish_time` DESC")
			,FailedReason_ASC("`failed_reason` ASC"),FailedReason_DESC("`failed_reason` 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(WxProfitSharingResult.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));
		}
	}
}
