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_coupon_spread")
public class WxCouponSpread 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;
	}
	
	
	
	/*券id**/
	@io.swagger.annotations.ApiModelProperty(value="券id",name="couponId")
	private Long couponId;
	/*标题**/
	@io.swagger.annotations.ApiModelProperty(value="标题",name="title")
	private String title;
	/*分享内容**/
	@io.swagger.annotations.ApiModelProperty(value="分享内容",name="content")
	private String content;
	/*分享图片**/
	@io.swagger.annotations.ApiModelProperty(value="分享图片",name="image")
	private String image;
	/*链接地址**/
	@io.swagger.annotations.ApiModelProperty(value="链接地址",name="linkUrl")
	private String linkUrl;
	/*创建时间**/
	@io.swagger.annotations.ApiModelProperty(value="创建时间",name="createDate")
	private Date createDate;
	/*修改时间**/
	@io.swagger.annotations.ApiModelProperty(value="修改时间",name="updateDate")
	private Date updateDate;
	public Long  getCouponId() {
		return couponId;
	}
	public void setCouponId(Long _couponId) {
		couponId = _couponId;
	}
	public String  getTitle() {
		return title;
	}
	public void setTitle(String _title) {
		title = _title;
	}
	public String  getContent() {
		return content;
	}
	public void setContent(String _content) {
		content = _content;
	}
	public String  getImage() {
		return image;
	}
	public void setImage(String _image) {
		image = _image;
	}
	public String  getLinkUrl() {
		return linkUrl;
	}
	public void setLinkUrl(String _linkUrl) {
		linkUrl = _linkUrl;
	}
	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 static enum Field
	{
		Id_ASC("`id` ASC"),Id_DESC("`id` DESC")
			,CouponId_ASC("`couponId` ASC"),CouponId_DESC("`couponId` DESC")
			,Title_ASC("`title` ASC"),Title_DESC("`title` DESC")
			,Content_ASC("`content` ASC"),Content_DESC("`content` DESC")
			,Image_ASC("`image` ASC"),Image_DESC("`image` DESC")
			,LinkUrl_ASC("`linkUrl` ASC"),LinkUrl_DESC("`linkUrl` DESC")
			,CreateDate_ASC("`createDate` ASC"),CreateDate_DESC("`createDate` DESC")
			,UpdateDate_ASC("`updateDate` ASC"),UpdateDate_DESC("`updateDate` 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());
		}
		 
	}
	
	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));
		}
	}
}
