I have a following scenario and would like to seek for advices/recommendation about the best solution to implement it.
Assuming I have following data in the DB:
OrderID | CustomerID | OrderDate | Prices |
---|---|---|---|
1 | CustomerA | 15-Jan-2022 | 30 |
2 | CustomerA | 15-Jan-2022 | 20 |
3 | CustomerB | 15-Jan-2022 | 13 |
1 | CustomerB | 16-Jan-2022 | 15 |
And would like to display following table on webpage:
CustomerID | OrderDate | TotalPrices | Breakdown |
---|---|---|---|
CustomerA | 15-Jan-2022 | 50 | Click me |
CustomerB | 15-Jan-2022 | 13 | Click me |
CustomerB | 16-Jan-2022 | 15 | Click me |
When user click on the "Click me" for customerA on 15-Jan-2022, it will shows following:
OrderID | CustomerID | OrderDate | Prices |
---|---|---|---|
1 | CustomerA | 15-Jan-2022 | 30 |
2 | CustomerA | 15-Jan-2022 | 20 |
The current possible solutions in my mind are following:
User SQL consolidate to DB -> Return the summary table to Java API -> Send the summary table to Frontend -> When user click on the "Click Me" button, will have another SQL call to retrieve the breakdown records.
Retrieve the DB records -> Consolidate in Java API -> Send the summary table and breakdowns to frontend.
Feel free to suggest for more ideas on this, thanks!