|
@@ -0,0 +1,78 @@
|
|
|
+package com.persagy.proxy.adm.model;
|
|
|
+import lombok.*;
|
|
|
+
|
|
|
+import java.io.Serializable;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.Map;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author lvxy
|
|
|
+ * @date 2021/9/13
|
|
|
+ */
|
|
|
+@Data
|
|
|
+public abstract class AdmSBaseEntity<T> implements Serializable, Cloneable, Comparable {
|
|
|
+ /** 序列id */
|
|
|
+ private static final long serialVersionUID = -323111418861154334L;
|
|
|
+ /** hash码 */
|
|
|
+ @Getter(AccessLevel.NONE)
|
|
|
+ @Setter(AccessLevel.NONE)
|
|
|
+ private transient int hashCode = Integer.MIN_VALUE;
|
|
|
+
|
|
|
+ private String id;
|
|
|
+ /** 统计信息 */
|
|
|
+ private Map<String, Object> statistics;
|
|
|
+ /** 创建时间 */
|
|
|
+ private Date createTime;
|
|
|
+ /** 最后更新日期 */
|
|
|
+ private Date lastUpdate;
|
|
|
+ /** 信息点 */
|
|
|
+ private Map<String, Object> infos;
|
|
|
+
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public boolean equals (Object obj) {
|
|
|
+ if (null == obj) {
|
|
|
+ return false;
|
|
|
+ }
|
|
|
+ if (!(obj instanceof AdmSBaseEntity)) {
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ AdmSBaseEntity entity = (AdmSBaseEntity) obj;
|
|
|
+ if (null == this.getId() || null == entity.getId()) {
|
|
|
+ return false;
|
|
|
+ } else {
|
|
|
+ return (this.getId().equals(entity.getId()));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int hashCode () {
|
|
|
+ if (Integer.MIN_VALUE != this.hashCode) {
|
|
|
+ return this.hashCode;
|
|
|
+ }
|
|
|
+ if (null == this.getId()) {
|
|
|
+ return super.hashCode();
|
|
|
+ }
|
|
|
+ String hashStr = this.getClass().getName() + ":" + this.getId().hashCode();
|
|
|
+ this.hashCode = hashStr.hashCode();
|
|
|
+ return this.hashCode;
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public int compareTo (Object obj) {
|
|
|
+ if (obj.hashCode() > hashCode()) {
|
|
|
+ return 1;
|
|
|
+ } else if (obj.hashCode() < hashCode()) {
|
|
|
+ return -1;
|
|
|
+ } else {
|
|
|
+ return 0;
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ @Override
|
|
|
+ public Object clone() throws CloneNotSupportedException {
|
|
|
+ return super.clone();
|
|
|
+ }
|
|
|
+
|
|
|
+}
|