0

我想通过 2 个子句过滤我的查询结果,但我不知道该怎么做,也找不到关于如何做的明确解释。以下是我尝试过的。

termList = SugarRecord.find(Term::class.java, "type = ? AND category = ?", "hcp, "+ parentCategoryId.toString())

谢谢!

4

1 回答 1

1

例如:

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()

更多信息在这里:http ://satyan.github.io/sugar/query.html

于 2018-09-05T20:03:21.950 回答