| Line 7... |
Line 7... |
| 7 |
@Entity
|
7 |
@Entity
|
| 8 |
@NamedNativeQueries({
|
8 |
@NamedNativeQueries({
|
| 9 |
@NamedNativeQuery(name = "Aging.SoldAgingModel",
|
9 |
@NamedNativeQuery(name = "Aging.SoldAgingModel",
|
| 10 |
query = "SELECT" +
|
10 |
query = "SELECT" +
|
| 11 |
" a.Rbm_Name," +
|
11 |
" a.Rbm_Name," +
|
| 12 |
" SUM(CASE WHEN b.status = 'EOL' THEN b.selling_price ELSE 0 END) AS EOL_Billed," +
|
12 |
" SUM(CASE WHEN b.status = 'SLOWMOVING' THEN b.selling_price ELSE 0 END) AS SLOWMOVING_Billed," +
|
| 13 |
" SUM(CASE WHEN b.status = 'SLOWMOVING' THEN b.selling_price ELSE 0 END) AS Slowmoving_Billed," +
|
13 |
" SUM(CASE WHEN b.status = 'RUNNING' THEN b.selling_price ELSE 0 END) AS RUNNING_Billed," +
|
| 14 |
" SUM(CASE WHEN b.status = 'FASTMOVING' THEN b.selling_price ELSE 0 END) AS Fastmoving_Billed," +
|
14 |
" SUM(CASE WHEN b.status = 'FASTMOVING' THEN b.selling_price ELSE 0 END) AS FASTMOVING_Billed," +
|
| 15 |
" SUM(CASE WHEN b.status = 'HID' THEN b.selling_price ELSE 0 END) AS HID_Billed," +
|
15 |
" SUM(CASE WHEN b.status = 'HID' THEN b.selling_price ELSE 0 END) AS HID_Billed," +
|
| 16 |
" COALESCE(SUM(CASE WHEN b.status IS NULL THEN b.selling_price ELSE 0 END),0) AS Other_Billed," +
|
16 |
" COALESCE(SUM(CASE WHEN b.status IS NULL THEN b.selling_price ELSE 0 END),0) AS Other_Billed," +
|
| 17 |
" COALESCE(SUM(b.selling_price),0) AS Total_Amount" +
|
17 |
" COALESCE(SUM(b.selling_price),0) AS Total_Amount" +
|
| 18 |
" FROM (SELECT au.id AS auth_id," +
|
18 |
" FROM (SELECT au.id AS auth_id," +
|
| 19 |
" CONCAT(au.first_name, ' ', au.last_name) AS Rbm_Name," +
|
19 |
" CONCAT(au.first_name, ' ', au.last_name) AS Rbm_Name," +
|
| Line 67... |
Line 67... |
| 67 |
|
67 |
|
| 68 |
@SqlResultSetMapping(name = "SoldAgingModel",
|
68 |
@SqlResultSetMapping(name = "SoldAgingModel",
|
| 69 |
classes = {@ConstructorResult(targetClass = Sold15daysOldAgingModel.class,
|
69 |
classes = {@ConstructorResult(targetClass = Sold15daysOldAgingModel.class,
|
| 70 |
columns = {
|
70 |
columns = {
|
| 71 |
@ColumnResult(name = "Rbm_Name", type = String.class),
|
71 |
@ColumnResult(name = "Rbm_Name", type = String.class),
|
| 72 |
@ColumnResult(name = "EOL_Billed ", type = Long.class),
|
72 |
@ColumnResult(name = "SLOWMOVING_Billed ", type = Long.class),
|
| 73 |
@ColumnResult(name = "Slowmoving_Billed ", type = Long.class),
|
73 |
@ColumnResult(name = "RUNNING_Billed ", type = Long.class),
|
| 74 |
@ColumnResult(name = "Fastmoving_Billed ", type = Long.class),
|
74 |
@ColumnResult(name = "FASTMOVING_Billed ", type = Long.class),
|
| 75 |
@ColumnResult(name = "HID_Billed ", type = Long.class),
|
75 |
@ColumnResult(name = "HID_Billed ", type = Long.class),
|
| 76 |
@ColumnResult(name = "Other_Billed ", type = Long.class),
|
76 |
@ColumnResult(name = "Other_Billed ", type = Long.class),
|
| 77 |
@ColumnResult(name = "Total_Amount ", type = Long.class),
|
77 |
@ColumnResult(name = "Total_Amount ", type = Long.class),
|
| 78 |
}
|
78 |
}
|
| 79 |
)}
|
79 |
)}
|
| Line 81... |
Line 81... |
| 81 |
|
81 |
|
| 82 |
})
|
82 |
})
|
| 83 |
|
83 |
|
| 84 |
public class Sold15daysOldAgingModel {
|
84 |
public class Sold15daysOldAgingModel {
|
| 85 |
String rbmName;
|
85 |
String rbmName;
|
| 86 |
long eolBilled;
|
86 |
long slowmovingBilled;
|
| 87 |
long runningBilled;
|
87 |
long runningBilled;
|
| 88 |
long fastmovingBilled;
|
88 |
long fastmovingBilled;
|
| 89 |
long hidBilled;
|
89 |
long hidBilled;
|
| 90 |
long othersBilled;
|
90 |
long othersBilled;
|
| 91 |
long totalBilled;
|
91 |
long totalBilled;
|
| Line 93... |
Line 93... |
| 93 |
// Synthetic primary key to satisfy JPA's requirement
|
93 |
// Synthetic primary key to satisfy JPA's requirement
|
| 94 |
@Id
|
94 |
@Id
|
| 95 |
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
95 |
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
| 96 |
private Long id; // This will not be used in the query but satisfies JPA.
|
96 |
private Long id; // This will not be used in the query but satisfies JPA.
|
| 97 |
|
97 |
|
| 98 |
public Sold15daysOldAgingModel(String rbmName, long eolBilled, long runningBilled, long fastmovingBilled, long hidBilled, long othersBilled, long totalBilled) {
|
98 |
public Sold15daysOldAgingModel(String rbmName, long slowmovingBilled, long runningBilled, long fastmovingBilled, long hidBilled, long othersBilled, long totalBilled) {
|
| 99 |
this.rbmName = rbmName;
|
99 |
this.rbmName = rbmName;
|
| 100 |
this.eolBilled = eolBilled;
|
100 |
this.slowmovingBilled = slowmovingBilled;
|
| 101 |
this.runningBilled = runningBilled;
|
101 |
this.runningBilled = runningBilled;
|
| 102 |
this.fastmovingBilled = fastmovingBilled;
|
102 |
this.fastmovingBilled = fastmovingBilled;
|
| 103 |
this.hidBilled = hidBilled;
|
103 |
this.hidBilled = hidBilled;
|
| 104 |
this.othersBilled = othersBilled;
|
104 |
this.othersBilled = othersBilled;
|
| 105 |
this.totalBilled = totalBilled;
|
105 |
this.totalBilled = totalBilled;
|
| Line 111... |
Line 111... |
| 111 |
|
111 |
|
| 112 |
public void setRbmName(String rbmName) {
|
112 |
public void setRbmName(String rbmName) {
|
| 113 |
this.rbmName = rbmName;
|
113 |
this.rbmName = rbmName;
|
| 114 |
}
|
114 |
}
|
| 115 |
|
115 |
|
| 116 |
public long getEolBilled() {
|
116 |
public long getSlowmovingBilled() {
|
| 117 |
return eolBilled;
|
117 |
return slowmovingBilled;
|
| 118 |
}
|
118 |
}
|
| 119 |
|
119 |
|
| 120 |
public void setEolBilled(long eolBilled) {
|
120 |
public void setSlowmovingBilled(long slowmovingBilled) {
|
| 121 |
this.eolBilled = eolBilled;
|
121 |
this.slowmovingBilled = slowmovingBilled;
|
| 122 |
}
|
122 |
}
|
| 123 |
|
123 |
|
| 124 |
public long getRunningBilled() {
|
124 |
public long getRunningBilled() {
|
| 125 |
return runningBilled;
|
125 |
return runningBilled;
|
| 126 |
}
|
126 |
}
|
| Line 163... |
Line 163... |
| 163 |
|
163 |
|
| 164 |
@Override
|
164 |
@Override
|
| 165 |
public String toString() {
|
165 |
public String toString() {
|
| 166 |
return "Sold15daysAgingModel{" +
|
166 |
return "Sold15daysAgingModel{" +
|
| 167 |
"rbmName='" + rbmName + '\'' +
|
167 |
"rbmName='" + rbmName + '\'' +
|
| 168 |
", eolBilled=" + eolBilled +
|
168 |
", slowmovingBilled=" + slowmovingBilled +
|
| 169 |
", runningBilled=" + runningBilled +
|
169 |
", runningBilled=" + runningBilled +
|
| 170 |
", fastmovingBilled=" + fastmovingBilled +
|
170 |
", fastmovingBilled=" + fastmovingBilled +
|
| 171 |
", hidBilled=" + hidBilled +
|
171 |
", hidBilled=" + hidBilled +
|
| 172 |
", othersBilled=" + othersBilled +
|
172 |
", othersBilled=" + othersBilled +
|
| 173 |
", totalBilled=" + totalBilled +
|
173 |
", totalBilled=" + totalBilled +
|
| Line 177... |
Line 177... |
| 177 |
@Override
|
177 |
@Override
|
| 178 |
public boolean equals(Object o) {
|
178 |
public boolean equals(Object o) {
|
| 179 |
if (this == o) return true;
|
179 |
if (this == o) return true;
|
| 180 |
if (o == null || getClass() != o.getClass()) return false;
|
180 |
if (o == null || getClass() != o.getClass()) return false;
|
| 181 |
Sold15daysOldAgingModel that = (Sold15daysOldAgingModel) o;
|
181 |
Sold15daysOldAgingModel that = (Sold15daysOldAgingModel) o;
|
| 182 |
return eolBilled == that.eolBilled && runningBilled == that.runningBilled && fastmovingBilled == that.fastmovingBilled && hidBilled == that.hidBilled && othersBilled == that.othersBilled && totalBilled == that.totalBilled && Objects.equals(rbmName, that.rbmName);
|
182 |
return slowmovingBilled == that.slowmovingBilled && runningBilled == that.runningBilled && fastmovingBilled == that.fastmovingBilled && hidBilled == that.hidBilled && othersBilled == that.othersBilled && totalBilled == that.totalBilled && Objects.equals(rbmName, that.rbmName);
|
| 183 |
}
|
183 |
}
|
| 184 |
|
184 |
|
| 185 |
@Override
|
185 |
@Override
|
| 186 |
public int hashCode() {
|
186 |
public int hashCode() {
|
| 187 |
return Objects.hash(rbmName, eolBilled, runningBilled, fastmovingBilled, hidBilled, othersBilled, totalBilled);
|
187 |
return Objects.hash(rbmName, slowmovingBilled, runningBilled, fastmovingBilled, hidBilled, othersBilled, totalBilled);
|
| 188 |
}
|
188 |
}
|
| 189 |
}
|
189 |
}
|