package com.zhitan.engine.entity.CompositeKey;
|
|
import lombok.AllArgsConstructor;
|
import lombok.Data;
|
|
import javax.persistence.Column;
|
import javax.persistence.Embeddable;
|
import java.io.Serializable;
|
|
@Data
|
@Embeddable
|
@AllArgsConstructor
|
public class ElectricityDataItemCompKey implements Serializable {
|
@Column(name = "index_id", length = 36)
|
private String indexId;
|
|
|
@Column(name = "time_code", length = 20)
|
private String timeCode;
|
|
|
@Column(name = "electricity_type", length = 10)
|
private String electricityType;
|
|
// 重写equals方法
|
@Override
|
public boolean equals(Object obj) {
|
if (obj == null) {
|
return false;
|
}
|
|
if (obj instanceof ElectricityDataItemCompKey) {
|
ElectricityDataItemCompKey other = (ElectricityDataItemCompKey) obj;
|
return this.indexId.equals(other.indexId) && this.timeCode.equals(other.timeCode) && this.electricityType.equals(other.electricityType);
|
}
|
return false;
|
}
|
|
@Override
|
public int hashCode() {
|
int result = 17;
|
result = 31 * result + indexId.hashCode();
|
result = 31 * result + timeCode.hashCode();
|
result = 31 * result + electricityType.hashCode();
|
return result;
|
}
|
|
public ElectricityDataItemCompKey() {
|
}
|
}
|