mirror of
https://github.com/Aviortheking/Neo-Store.git
synced 2025-06-08 00:39:54 +00:00
Add: Repositories & categories (filter out) arguments to Product query builder
This commit is contained in:
parent
b52e89512e
commit
ccd72d3944
@ -124,6 +124,8 @@ interface ProductDao : BaseDao<Product> {
|
|||||||
updates: Boolean,
|
updates: Boolean,
|
||||||
searchQuery: String,
|
searchQuery: String,
|
||||||
section: Section,
|
section: Section,
|
||||||
|
filteredOutRepos: Set<String> = emptySet(),
|
||||||
|
filteredOutCategories: Set<String> = emptySet(),
|
||||||
order: Order,
|
order: Order,
|
||||||
ascending: Boolean = false,
|
ascending: Boolean = false,
|
||||||
numberOfItems: Int = 0,
|
numberOfItems: Int = 0,
|
||||||
@ -178,14 +180,22 @@ interface ProductDao : BaseDao<Product> {
|
|||||||
ON $TABLE_PRODUCT.$ROW_PACKAGE_NAME = $TABLE_INSTALLED.$ROW_PACKAGE_NAME"""
|
ON $TABLE_PRODUCT.$ROW_PACKAGE_NAME = $TABLE_INSTALLED.$ROW_PACKAGE_NAME"""
|
||||||
|
|
||||||
// Merge the matching category
|
// Merge the matching category
|
||||||
if (section is Section.Category) {
|
|
||||||
builder += """JOIN $TABLE_CATEGORY_NAME AS $TABLE_CATEGORY
|
builder += """JOIN $TABLE_CATEGORY_NAME AS $TABLE_CATEGORY
|
||||||
ON $TABLE_PRODUCT.$ROW_PACKAGE_NAME = $TABLE_CATEGORY.$ROW_PACKAGE_NAME"""
|
ON $TABLE_PRODUCT.$ROW_PACKAGE_NAME = $TABLE_CATEGORY.$ROW_PACKAGE_NAME"""
|
||||||
}
|
|
||||||
|
|
||||||
// Filter only active repositories
|
// Filter only active repositories
|
||||||
builder += """WHERE $TABLE_REPOSITORY.$ROW_ENABLED != 0"""
|
builder += """WHERE $TABLE_REPOSITORY.$ROW_ENABLED != 0"""
|
||||||
|
|
||||||
|
// Filter out repositories
|
||||||
|
if (filteredOutRepos.isNotEmpty()) {
|
||||||
|
builder += "AND $TABLE_PRODUCT.$ROW_REPOSITORY_ID NOT IN(${filteredOutRepos.joinToString { "'$it'" }})"
|
||||||
|
}
|
||||||
|
|
||||||
|
// Filter out categories
|
||||||
|
if (filteredOutCategories.isNotEmpty()) {
|
||||||
|
builder += "AND $TABLE_CATEGORY.$ROW_LABEL NOT IN(${filteredOutCategories.joinToString { "'$it'" }})"
|
||||||
|
}
|
||||||
|
|
||||||
// Filter only the selected repository/category
|
// Filter only the selected repository/category
|
||||||
if (section is Section.Category) {
|
if (section is Section.Category) {
|
||||||
builder += "AND $TABLE_CATEGORY.$ROW_LABEL = ?"
|
builder += "AND $TABLE_CATEGORY.$ROW_LABEL = ?"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user