| Line 43... |
Line 43... |
| 43 |
" AND p.category_id = 18" +
|
43 |
" AND p.category_id = 18" +
|
| 44 |
" AND p.escalation_type = 'L1') a" +
|
44 |
" AND p.escalation_type = 'L1') a" +
|
| 45 |
" GROUP BY a.auth_id, a.warehouse_id",
|
45 |
" GROUP BY a.auth_id, a.warehouse_id",
|
| 46 |
resultSetMapping = "WarehouseWiseMonthlyTarget"),
|
46 |
resultSetMapping = "WarehouseWiseMonthlyTarget"),
|
| 47 |
|
47 |
|
| - |
|
48 |
@NamedNativeQuery(name = "RbmTarget.getWarehouseWiseMonthlyTargetForMonth",
|
| - |
|
49 |
query = "SELECT a.auth_id," +
|
| - |
|
50 |
" a.first_name," +
|
| - |
|
51 |
" a.warehouse_id," +
|
| - |
|
52 |
" SUM(a.purchase) AS monthly_target" +
|
| - |
|
53 |
" FROM (" +
|
| - |
|
54 |
" SELECT au.id AS auth_id," +
|
| - |
|
55 |
" CONCAT(au.first_name, ' ', au.last_name) AS first_name," +
|
| - |
|
56 |
" fs.id AS fofo_id," +
|
| - |
|
57 |
" mtgt.purchase," +
|
| - |
|
58 |
" fs.warehouse_id" +
|
| - |
|
59 |
" FROM auth.auth_user au" +
|
| - |
|
60 |
" JOIN cs.position p ON p.auth_user_id = au.id" +
|
| - |
|
61 |
" JOIN cs.partner_position pp ON pp.position_id = p.id" +
|
| - |
|
62 |
" JOIN fofo.fofo_store fs ON fs.id = pp.partner_id" +
|
| - |
|
63 |
" JOIN fofo.monthly_target mtgt on mtgt.fofo_id=pp.partner_id" +
|
| - |
|
64 |
" WHERE pp.partner_id != 0" +
|
| - |
|
65 |
" AND mtgt.on_date >= :targetMonthStart AND mtgt.on_date < :targetMonthEnd" +
|
| - |
|
66 |
" AND p.category_id = 18" +
|
| - |
|
67 |
" AND p.escalation_type = 'L1'" +
|
| - |
|
68 |
" UNION ALL" +
|
| - |
|
69 |
" SELECT au.id AS auth_id," +
|
| - |
|
70 |
" CONCAT(au.first_name, ' ', au.last_name) AS first_name," +
|
| - |
|
71 |
" fs.id AS fofo_id," +
|
| - |
|
72 |
" mtgt.purchase," +
|
| - |
|
73 |
" fs.warehouse_id" +
|
| - |
|
74 |
" FROM auth.auth_user au" +
|
| - |
|
75 |
" JOIN cs.position p ON p.auth_user_id = au.id" +
|
| - |
|
76 |
" JOIN cs.partner_position pp ON pp.position_id = p.id" +
|
| - |
|
77 |
" JOIN cs.region r ON pp.region_id = r.id" +
|
| - |
|
78 |
" JOIN cs.partner_region pr ON pr.region_id = pp.region_id" +
|
| - |
|
79 |
" JOIN fofo.fofo_store fs ON fs.id = pr.fofo_id" +
|
| - |
|
80 |
" JOIN fofo.monthly_target mtgt on mtgt.fofo_id=pp.partner_id" +
|
| - |
|
81 |
" WHERE pp.partner_id = 0" +
|
| - |
|
82 |
" AND mtgt.on_date >= :targetMonthStart AND mtgt.on_date < :targetMonthEnd" +
|
| - |
|
83 |
" AND p.category_id = 18" +
|
| - |
|
84 |
" AND p.escalation_type = 'L1') a" +
|
| - |
|
85 |
" GROUP BY a.auth_id, a.warehouse_id",
|
| - |
|
86 |
resultSetMapping = "WarehouseWiseMonthlyTarget"),
|
| - |
|
87 |
|
| 48 |
})
|
88 |
})
|
| 49 |
|
89 |
|
| 50 |
@SqlResultSetMappings({
|
90 |
@SqlResultSetMappings({
|
| 51 |
|
91 |
|
| 52 |
@SqlResultSetMapping(name = "WarehouseWiseMonthlyTarget",
|
92 |
@SqlResultSetMapping(name = "WarehouseWiseMonthlyTarget",
|