Subversion Repositories SmartDukaan

Rev

Rev 34322 | Go to most recent revision | Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
34300 ranu 1
package com.spice.profitmandi.dao.entity.fofo;
2
 
3
import javax.persistence.*;
4
import java.time.LocalDateTime;
5
import java.util.Objects;
6
 
7
@Entity
8
@Table(name = "fofo.rbm_rating")
9
@NamedQueries({
10
        @NamedQuery(name = "RbMRatingByMonth", query = "" +
11
                "SELECT r FROM RbmRating r WHERE r.fofoId = :fofoId AND r.rbmId = :rbmId AND r.createTimeStamp BETWEEN :startOfMonth AND :endOfMonth"
12
        ),
13
        @NamedQuery(
14
                name = "Visit.FindAverageRatingByRbmIds",
15
                query = "SELECT new com.spice.profitmandi.dao.model.RbMRatingModel(v.rbmId, AVG(v.rating)) " +
16
                        "FROM RbmRating v WHERE v.rbmId IN :rbmIds GROUP BY v.rbmId"
17
        )
18
})
19
public class RbmRating {
20
    @Id
21
    @Column(name = "id", unique = true, updatable = false)
22
    private int id;
23
 
24
    @Column(name = "rating")
25
    private int rating;
26
 
27
    @Column(name = "comment")
28
    private String comment;
29
 
30
    @Column(name = "fofo_id")
31
    private int fofoId;
32
 
33
    @Column(name = "rbm_id")
34
    private int rbmId;
35
 
36
    @Column(name = "create_timestamp")
37
    private LocalDateTime createTimeStamp;
38
 
39
    public int getId() {
40
        return id;
41
    }
42
 
43
    public void setId(int id) {
44
        this.id = id;
45
    }
46
 
47
    public int getRating() {
48
        return rating;
49
    }
50
 
51
    public void setRating(int rating) {
52
        this.rating = rating;
53
    }
54
 
55
    public String getComment() {
56
        return comment;
57
    }
58
 
59
    public void setComment(String comment) {
60
        this.comment = comment;
61
    }
62
 
63
    public int getFofoId() {
64
        return fofoId;
65
    }
66
 
67
    public void setFofoId(int fofoId) {
68
        this.fofoId = fofoId;
69
    }
70
 
71
    public int getRbmId() {
72
        return rbmId;
73
    }
74
 
75
    public void setRbmId(int rbmId) {
76
        this.rbmId = rbmId;
77
    }
78
 
79
    public LocalDateTime getCreateTimeStamp() {
80
        return createTimeStamp;
81
    }
82
 
83
    public void setCreateTimeStamp(LocalDateTime createTimeStamp) {
84
        this.createTimeStamp = createTimeStamp;
85
    }
86
 
87
    @Override
88
    public String toString() {
89
        return "RbmRating{" +
90
                "id=" + id +
91
                ", rating=" + rating +
92
                ", comment='" + comment + '\'' +
93
                ", fofoId=" + fofoId +
94
                ", rbmId=" + rbmId +
95
                ", createTimeStamp=" + createTimeStamp +
96
                '}';
97
    }
98
 
99
    @Override
100
    public boolean equals(Object o) {
101
        if (this == o) return true;
102
        if (o == null || getClass() != o.getClass()) return false;
103
        RbmRating rbmRating = (RbmRating) o;
104
        return id == rbmRating.id && rating == rbmRating.rating && fofoId == rbmRating.fofoId && rbmId == rbmRating.rbmId && Objects.equals(comment, rbmRating.comment) && Objects.equals(createTimeStamp, rbmRating.createTimeStamp);
105
    }
106
 
107
    @Override
108
    public int hashCode() {
109
        return Objects.hash(id, rating, comment, fofoId, rbmId, createTimeStamp);
110
    }
111
}