fix(web): 增加相等判断
This commit is contained in:
@@ -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();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user