baoshiwei
2025-04-23 c2375c2bcc0bf9e6a3af7f9776d5a0eb14370b40
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
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() {
    }
}