From cb6c0256b9e80f09751baf9e2c3410880b751058 Mon Sep 17 00:00:00 2001 From: lanyuanxiaoyao Date: Mon, 25 Nov 2024 18:31:09 +0800 Subject: [PATCH] =?UTF-8?q?fix(web):=20=E5=A2=9E=E5=8A=A0=E7=9B=B8?= =?UTF-8?q?=E7=AD=89=E5=88=A4=E6=96=AD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/domain/base/entity/IdOnlyEntity.java | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/gringotts-web/src/main/java/com/eshore/gringotts/web/domain/base/entity/IdOnlyEntity.java b/gringotts-web/src/main/java/com/eshore/gringotts/web/domain/base/entity/IdOnlyEntity.java index be4d335..011e6e2 100644 --- a/gringotts-web/src/main/java/com/eshore/gringotts/web/domain/base/entity/IdOnlyEntity.java +++ b/gringotts-web/src/main/java/com/eshore/gringotts/web/domain/base/entity/IdOnlyEntity.java @@ -26,4 +26,20 @@ public class IdOnlyEntity { @GeneratedValue(generator = "snowflake") @GenericGenerator(name = "snowflake", strategy = "com.eshore.gringotts.web.configuration.SnowflakeIdGenerator") private Long id; + + @Override + public final boolean equals(Object object) { + if (this == object) + return true; + if (!(object instanceof IdOnlyEntity)) + return false; + + IdOnlyEntity that = (IdOnlyEntity) object; + return id.equals(that.id); + } + + @Override + public int hashCode() { + return id.hashCode(); + } }