content: package priv.jesse.mall.entity;
  
  import javax.persistence.Column;
  import javax.persistence.Entity;
  import javax.persistence.GeneratedValue;
  import javax.persistence.Id;
  import java.io.Serializable;
  
  /**
   * 分类
   */
  @Entity
  public class Classification implements Serializable {
      @Id
      @GeneratedValue
      @Column
      private Integer id;
      /**
       * 上级分类Id
       */
      @Column
      private Integer parentId;
      /**
       * 分类名称
       */
      @Column
      private String cname;
      /**
       * 类型 1一级分类 2二级分类
       */
      @Column
      private Integer type;
  
      private static final long serialVersionUID = 1L;
  
      public Classification(Integer id, Integer parentId, String cname, Integer type) {
          this.id = id;
          this.parentId = parentId;
          this.cname = cname;
          this.type = type;
      }
  
      public Classification() {
          super();
      }
  
      public Integer getId() {
          return id;
      }
  
      public void setId(Integer id) {
          this.id = id;
      }
  
      public Integer getParentId() {
          return parentId;
      }
  
      public void setParentId(Integer parentId) {
          this.parentId = parentId;
      }
  
      public String getCname() {
          return cname;
      }
  
      public void setCname(String cname) {
          this.cname = cname == null ? null : cname.trim();
      }
  
      public Integer getType() {
          return type;
      }
  
      public void setType(Integer type) {
          this.type = type;
      }
  
      @Override
      public boolean equals(Object that) {
          if (this == that) {
              return true;
          }
          if (that == null) {
              return false;
          }
          if (getClass() != that.getClass()) {
              return false;
          }
          Classification other = (Classification) that;
          return (this.getId() == null ? other.getId() == null : this.getId().equals(other.getId()))
              && (this.getParentId() == null ? other.getParentId() == null : this.getParentId().equals(other.getParentId()))
              && (this.getCname() == null ? other.getCname() == null : this.getCname().equals(other.getCname()))
              && (this.getType() == null ? other.getType() == null : this.getType().equals(other.getType()));
      }
  
      @Override
      public int hashCode() {
          final int prime = 31;
          int result = 1;
          result = prime * result + ((getId() == null) ? 0 : getId().hashCode());
          result = prime * result + ((getParentId() == null) ? 0 : getParentId().hashCode());
          result = prime * result + ((getCname() == null) ? 0 : getCname().hashCode());
          result = prime * result + ((getType() == null) ? 0 : getType().hashCode());
          return result;
      }
  
      @Override
      public String toString() {
          StringBuilder sb = new StringBuilder();
          sb.append(getClass().getSimpleName());
          sb.append(" [");
          sb.append("Hash = ").append(hashCode());
          sb.append(", id=").append(id);
          sb.append(", parentId=").append(parentId);
          sb.append(", cname=").append(cname);
          sb.append(", type=").append(type);
          sb.append(", serialVersionUID=").append(serialVersionUID);
          sb.append("]");
          return sb.toString();
      }
  }