如何使用 SugarRecord 和 Kotlin 查询多个子句参数
How to query with multiple clauses arguments with SugarRecord & Kotlin
我想按 2 个子句过滤我的查询结果,但我不确定该怎么做,也找不到关于如何操作的明确解释。以下是我尝试过的。
termList = SugarRecord.find(Term::class.java, "type = ? AND category = ?", "hcp, "+ parentCategoryId.toString())
谢谢!
例如:
val termList = SugarRecord.find(Term::class.java,
"type = ? and category = ?", // where clause
"hcp", parentCategoryId.toString()) // arguments
此外,您可以使用 查询生成器:
val termList = Select.from(Term::class.java).where(
Condition.prop("type").eq("hcp"), // type =(equals) ?
Condition.prop("category").eq(parentCategoryId.toString())).list()
我想按 2 个子句过滤我的查询结果,但我不确定该怎么做,也找不到关于如何操作的明确解释。以下是我尝试过的。
termList = SugarRecord.find(Term::class.java, "type = ? AND category = ?", "hcp, "+ parentCategoryId.toString())
谢谢!
例如:
val termList = SugarRecord.find(Term::class.java,
"type = ? and category = ?", // where clause
"hcp", parentCategoryId.toString()) // arguments
此外,您可以使用 查询生成器:
val termList = Select.from(Term::class.java).where(
Condition.prop("type").eq("hcp"), // type =(equals) ?
Condition.prop("category").eq(parentCategoryId.toString())).list()