Subversion Repositories SmartDukaan

Rev

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

Rev 34256 Rev 34813
Line 1... Line 1...
1
package com.spice.profitmandi.dao.entity.fofo;
1
package com.spice.profitmandi.dao.entity.fofo;
2
 
2
 
-
 
3
import com.spice.profitmandi.dao.model.BrandCountByStatus;
3
import com.spice.profitmandi.dao.model.HidAllocationModel;
4
import com.spice.profitmandi.dao.model.HidAllocationModel;
4
 
5
 
5
import javax.persistence.*;
6
import javax.persistence.*;
6
import java.io.Serializable;
7
import java.io.Serializable;
7
import java.time.LocalDate;
8
import java.time.LocalDate;
Line 38... Line 39...
38
                        ") sale1 ON sale1.catalog_item_id = os.catalog_id AND os.fofo_id = sale1.fofo_id" +
39
                        ") sale1 ON sale1.catalog_item_id = os.catalog_id AND os.fofo_id = sale1.fofo_id" +
39
                        "         JOIN catalog.catalog c ON c.id = cc.catalog_id" +
40
                        "         JOIN catalog.catalog c ON c.id = cc.catalog_id" +
40
                        " WHERE cc.end_date IS NULL AND cc.status = 'HID'" +
41
                        " WHERE cc.end_date IS NULL AND cc.status = 'HID'" +
41
                        "GROUP BY cc.catalog_id",
42
                        "GROUP BY cc.catalog_id",
42
                resultSetMapping = "HidAllocation"),
43
                resultSetMapping = "HidAllocation"),
-
 
44
        @NamedNativeQuery(
-
 
45
                name = "Stock.PartnerHidFastMovingRunningstock",
-
 
46
                query = "SELECT " +
-
 
47
                        "    fos.catalog_id, " +
-
 
48
                        "    c.brand, " +
-
 
49
                        "    COUNT(*) AS item_count " +
-
 
50
                        "FROM fofo.fofo_opening_stock fos " +
-
 
51
                        "JOIN catalog.catagoriesd_catalog cc ON fos.catalog_id = cc.catalog_id AND cc.end_date IS NULL " +
-
 
52
                        "JOIN catalog.catalog c ON c.id = fos.catalog_id " +
-
 
53
                        "WHERE cc.status IN ('RUNNING', 'FASTMOVING', 'HID') " +
-
 
54
                        "  AND fos.current_qty > 0 " +
-
 
55
                        "  AND fos.fofo_id = :fofoId " +
-
 
56
                        "GROUP BY fos.catalog_id, c.brand",
-
 
57
                resultSetMapping = "HidFastMovingRunningStock"
43
 
58
        )
44
})
59
})
-
 
60
@SqlResultSetMapping(
-
 
61
        name = "HidFastMovingRunningStock",
-
 
62
        classes = @ConstructorResult(
-
 
63
                targetClass = BrandCountByStatus.class,
-
 
64
                columns = {
-
 
65
                        @ColumnResult(name = "catalog_id", type = int.class),
-
 
66
                        @ColumnResult(name = "brand", type = String.class),
-
 
67
                        @ColumnResult(name = "item_count", type = int.class)
-
 
68
                }
-
 
69
        )
-
 
70
)
45
 
71
 
46
@SqlResultSetMappings({
72
@SqlResultSetMappings({
47
 
73
 
48
        @SqlResultSetMapping(name = "HidAllocation",
74
        @SqlResultSetMapping(name = "HidAllocation",
49
                classes = {@ConstructorResult(targetClass = HidAllocationModel.class,
75
                classes = {@ConstructorResult(targetClass = HidAllocationModel.class,