Subversion Repositories SmartDukaan

Rev

Rev 34074 | Rev 35476 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 34074 Rev 34098
Line 6... Line 6...
6
 
6
 
7
@Entity
7
@Entity
8
@NamedNativeQueries({
8
@NamedNativeQueries({
9
        @NamedNativeQuery(name = "Aging.15DaysOurStock",
9
        @NamedNativeQuery(name = "Aging.15DaysOurStock",
10
                query = "select" +
10
                query = "select" +
11
                        "    SUM(CASE WHEN cc.status = 'EOL' THEN tl.selling_price ELSE 0 END)        AS EOL," +
11
                        "    SUM(CASE WHEN cc.status = 'SLOWMOVING' THEN tl.selling_price ELSE 0 END)        AS SLOWMOVING," +
12
                        "    SUM(CASE WHEN cc.status = 'SLOWMOVING' THEN tl.selling_price ELSE 0 END) AS Slowmoving," +
12
                        "    SUM(CASE WHEN cc.status = 'RUNNING' THEN tl.selling_price ELSE 0 END) AS RUNNING," +
13
                        "    SUM(CASE WHEN cc.status = 'FASTMOVING' THEN tl.selling_price ELSE 0 END) AS Fastmoving," +
13
                        "    SUM(CASE WHEN cc.status = 'FASTMOVING' THEN tl.selling_price ELSE 0 END) AS FASTMOVING," +
14
                        "    SUM(CASE WHEN cc.status = 'HID' THEN tl.selling_price ELSE 0 END)        AS HID," +
14
                        "    SUM(CASE WHEN cc.status = 'HID' THEN tl.selling_price ELSE 0 END)        AS HID," +
15
                        "    SUM(CASE WHEN cc.status IS NULL THEN tl.selling_price ELSE 0 END)        AS Other," +
15
                        "    SUM(CASE WHEN cc.status IS NULL THEN tl.selling_price ELSE 0 END)        AS Other," +
16
                        "    SUM(tl.selling_price)                                                    AS Total" +
16
                        "    SUM(tl.selling_price)                                                    AS Total" +
17
                        " from warehouse.inventoryItem ii" +
17
                        " from warehouse.inventoryItem ii" +
18
                        "         join warehouse.scanNew s on s.inventoryItemId = ii.id" +
18
                        "         join warehouse.scanNew s on s.inventoryItemId = ii.id" +
Line 39... Line 39...
39
@SqlResultSetMappings({
39
@SqlResultSetMappings({
40
 
40
 
41
        @SqlResultSetMapping(name = "Our15DaysAging",
41
        @SqlResultSetMapping(name = "Our15DaysAging",
42
                classes = {@ConstructorResult(targetClass = Our15DaysOldAgingStock.class,
42
                classes = {@ConstructorResult(targetClass = Our15DaysOldAgingStock.class,
43
                        columns = {
43
                        columns = {
44
                                @ColumnResult(name = "EOL", type = Long.class),
44
                                @ColumnResult(name = "SLOWMOVING", type = Long.class),
45
                                @ColumnResult(name = "Slowmoving", type = Long.class),
45
                                @ColumnResult(name = "RUNNING", type = Long.class),
46
                                @ColumnResult(name = "Fastmoving ", type = Long.class),
46
                                @ColumnResult(name = "FASTMOVING ", type = Long.class),
47
                                @ColumnResult(name = "HID", type = Long.class),
47
                                @ColumnResult(name = "HID", type = Long.class),
48
                                @ColumnResult(name = "Other", type = Long.class),
48
                                @ColumnResult(name = "Other", type = Long.class),
49
                                @ColumnResult(name = "Total", type = Long.class),
49
                                @ColumnResult(name = "Total", type = Long.class),
50
                        }
50
                        }
51
                )}
51
                )}
52
        )
52
        )
53
 
53
 
54
})
54
})
55
 
55
 
56
public class Our15DaysOldAgingStock {
56
public class Our15DaysOldAgingStock {
57
    long eolAgingStock;
57
    long slowmovingAgingStock;
58
    long runningAgingStock;
58
    long runningAgingStock;
59
    long fastmovingAgingStock;
59
    long fastmovingAgingStock;
60
    long hidAgingStock;
60
    long hidAgingStock;
61
    long otherAgingStock;
61
    long otherAgingStock;
62
    long total;
62
    long total;
Line 64... Line 64...
64
    // Synthetic primary key to satisfy JPA's requirement
64
    // Synthetic primary key to satisfy JPA's requirement
65
    @Id
65
    @Id
66
    @GeneratedValue(strategy = GenerationType.IDENTITY)
66
    @GeneratedValue(strategy = GenerationType.IDENTITY)
67
    private Long id; // This will not be used in the query but satisfies JPA.
67
    private Long id; // This will not be used in the query but satisfies JPA.
68
 
68
 
69
    public Our15DaysOldAgingStock(long eolAgingStock, long runningAgingStock, long fastmovingAgingStock, long hidAgingStock, long otherAgingStock, long total) {
69
    public Our15DaysOldAgingStock(long slowmovingAgingStock, long runningAgingStock, long fastmovingAgingStock, long hidAgingStock, long otherAgingStock, long total) {
70
        this.eolAgingStock = eolAgingStock;
70
        this.slowmovingAgingStock = slowmovingAgingStock;
71
        this.runningAgingStock = runningAgingStock;
71
        this.runningAgingStock = runningAgingStock;
72
        this.fastmovingAgingStock = fastmovingAgingStock;
72
        this.fastmovingAgingStock = fastmovingAgingStock;
73
        this.hidAgingStock = hidAgingStock;
73
        this.hidAgingStock = hidAgingStock;
74
        this.otherAgingStock = otherAgingStock;
74
        this.otherAgingStock = otherAgingStock;
75
        this.total = total;
75
        this.total = total;
76
    }
76
    }
77
 
77
 
78
    public long getEolAgingStock() {
78
    public long getSlomovingAgingStock() {
79
        return eolAgingStock;
79
        return slowmovingAgingStock;
80
    }
80
    }
81
 
81
 
82
    public void setEolAgingStock(long eolAgingStock) {
82
    public void setSlowmovingAgingStock(long slowmovingAgingStock) {
83
        this.eolAgingStock = eolAgingStock;
83
        this.slowmovingAgingStock = slowmovingAgingStock;
84
    }
84
    }
85
 
85
 
86
    public long getRunningAgingStock() {
86
    public long getRunningAgingStock() {
87
        return runningAgingStock;
87
        return runningAgingStock;
88
    }
88
    }
Line 126... Line 126...
126
    @Override
126
    @Override
127
    public boolean equals(Object o) {
127
    public boolean equals(Object o) {
128
        if (this == o) return true;
128
        if (this == o) return true;
129
        if (o == null || getClass() != o.getClass()) return false;
129
        if (o == null || getClass() != o.getClass()) return false;
130
        Our15DaysOldAgingStock that = (Our15DaysOldAgingStock) o;
130
        Our15DaysOldAgingStock that = (Our15DaysOldAgingStock) o;
131
        return eolAgingStock == that.eolAgingStock && runningAgingStock == that.runningAgingStock && fastmovingAgingStock == that.fastmovingAgingStock && hidAgingStock == that.hidAgingStock && otherAgingStock == that.otherAgingStock && total == that.total;
131
        return slowmovingAgingStock == that.slowmovingAgingStock && runningAgingStock == that.runningAgingStock && fastmovingAgingStock == that.fastmovingAgingStock && hidAgingStock == that.hidAgingStock && otherAgingStock == that.otherAgingStock && total == that.total;
132
    }
132
    }
133
 
133
 
134
    @Override
134
    @Override
135
    public int hashCode() {
135
    public int hashCode() {
136
        return Objects.hash(eolAgingStock, runningAgingStock, fastmovingAgingStock, hidAgingStock, otherAgingStock, total);
136
        return Objects.hash(slowmovingAgingStock, runningAgingStock, fastmovingAgingStock, hidAgingStock, otherAgingStock, total);
137
    }
137
    }
138
}
138
}
139
 
139