1
0

fix(web): 增加相等判断

This commit is contained in:
2024-11-25 18:31:09 +08:00
parent dd3ac59bee
commit cb6c0256b9

View File

@@ -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();
}
}