Subversion Repositories SmartDukaan

Rev

Rev 34300 | Rev 36101 | Go to most recent revision | Details | Compare with Previous | 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"
34322 ranu 17
        ),
18
        @NamedQuery(
19
                name = "Visit.FindRbmFeedback",
20
                query = "SELECT r FROM RbmRating r" +
21
                        " WHERE r.rbmId IN :rbmIds" +
22
                        " AND r.createTimeStamp BETWEEN :startDate AND :endDate"
34300 ranu 23
        )
24
})
25
public class RbmRating {
26
    @Id
27
    @Column(name = "id", unique = true, updatable = false)
28
    private int id;
29
 
30
    @Column(name = "rating")
31
    private int rating;
32
 
33
    @Column(name = "comment")
34
    private String comment;
35
 
36
    @Column(name = "fofo_id")
37
    private int fofoId;
38
 
39
    @Column(name = "rbm_id")
40
    private int rbmId;
41
 
42
    @Column(name = "create_timestamp")
43
    private LocalDateTime createTimeStamp;
44
 
45
    public int getId() {
46
        return id;
47
    }
48
 
49
    public void setId(int id) {
50
        this.id = id;
51
    }
52
 
53
    public int getRating() {
54
        return rating;
55
    }
56
 
57
    public void setRating(int rating) {
58
        this.rating = rating;
59
    }
60
 
61
    public String getComment() {
62
        return comment;
63
    }
64
 
65
    public void setComment(String comment) {
66
        this.comment = comment;
67
    }
68
 
69
    public int getFofoId() {
70
        return fofoId;
71
    }
72
 
73
    public void setFofoId(int fofoId) {
74
        this.fofoId = fofoId;
75
    }
76
 
77
    public int getRbmId() {
78
        return rbmId;
79
    }
80
 
81
    public void setRbmId(int rbmId) {
82
        this.rbmId = rbmId;
83
    }
84
 
85
    public LocalDateTime getCreateTimeStamp() {
86
        return createTimeStamp;
87
    }
88
 
89
    public void setCreateTimeStamp(LocalDateTime createTimeStamp) {
90
        this.createTimeStamp = createTimeStamp;
91
    }
92
 
93
    @Override
94
    public String toString() {
95
        return "RbmRating{" +
96
                "id=" + id +
97
                ", rating=" + rating +
98
                ", comment='" + comment + '\'' +
99
                ", fofoId=" + fofoId +
100
                ", rbmId=" + rbmId +
101
                ", createTimeStamp=" + createTimeStamp +
102
                '}';
103
    }
104
 
105
    @Override
106
    public boolean equals(Object o) {
107
        if (this == o) return true;
108
        if (o == null || getClass() != o.getClass()) return false;
109
        RbmRating rbmRating = (RbmRating) o;
110
        return id == rbmRating.id && rating == rbmRating.rating && fofoId == rbmRating.fofoId && rbmId == rbmRating.rbmId && Objects.equals(comment, rbmRating.comment) && Objects.equals(createTimeStamp, rbmRating.createTimeStamp);
111
    }
112
 
113
    @Override
114
    public int hashCode() {
115
        return Objects.hash(id, rating, comment, fofoId, rbmId, createTimeStamp);
116
    }
117
}