Subversion Repositories SmartDukaan

Rev

Rev 36335 | Blame | Compare with Previous | Last modification | View Log | RSS feed

package com.spice.profitmandi.dao.model;

import javax.persistence.*;

@Entity
@NamedNativeQueries({
        @NamedNativeQuery(name = "Aging.15DaysWarehouseWiseStock",
                query = "SELECT " +
                        "    cis.warehouse_id AS warehouse_id, " +
                        "    SUM((cis.total - cis.Dlt15) * cis.dealer_price) AS total_aging " +
                        "FROM inventory.tbl_cis cis " +
                        "WHERE cis.total > 0 " +
                        "GROUP BY cis.warehouse_id",
                resultSetMapping = "WarehouseAgingStock")
})

@SqlResultSetMappings({
        @SqlResultSetMapping(name = "WarehouseAgingStock",
                classes = {@ConstructorResult(targetClass = WarehouseAgingStockModel.class,
                        columns = {
                                @ColumnResult(name = "warehouse_id", type = Integer.class),
                                @ColumnResult(name = "total_aging", type = Long.class),
                        }
                )}
        )
})

public class WarehouseAgingStockModel {

    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    private int warehouseId;
    private long totalAging;

    public WarehouseAgingStockModel(int warehouseId, long totalAging) {
        this.warehouseId = warehouseId;
        this.totalAging = totalAging;
    }

    public int getWarehouseId() {
        return warehouseId;
    }

    public void setWarehouseId(int warehouseId) {
        this.warehouseId = warehouseId;
    }

    public long getTotalAging() {
        return totalAging;
    }

    public void setTotalAging(long totalAging) {
        this.totalAging = totalAging;
    }
}