Created
June 25, 2022 16:22
-
-
Save garystafford/33bf08e229a161dbe51b59402244851b to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public List<SalesByCategory> findAll(String calendarDate, Integer limit, Integer offset) { | |
if (limit == null || limit < 1 || limit > configProperties.getLimit()) { | |
limit = configProperties.getLimit(); | |
} | |
if (offset == null || offset < 1) { | |
offset = 0; | |
} | |
String whereClause = "WHERE caldate IS NOT NULL"; | |
if (calendarDate != null) { | |
whereClause = whereClause + " AND caldate=date('" + calendarDate + "')"; | |
} | |
String query = String.format(""" | |
SELECT * | |
FROM tickit_sales_by_day_and_category | |
%s | |
OFFSET %s | |
LIMIT %s;""", whereClause, offset, limit); | |
return startQuery(query); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment