【问题标题】:Play! Framework, customising the CRUD list() function玩!框架,自定义 CRUD list() 函数
【发布时间】:2011-10-24 09:53:42
【问题描述】:

我想通过某些参数过滤我的列表函数,查看CRUD.java controller

List<Model> objects = type.findPage(page, search, searchFields, orderBy, order, (String) request.args.get("where"));
Long count = type.count(search, searchFields, (String) request.args.get("where"));
Long totalCount = type.count(null, null, (String) request.args.get("where"));

似乎是根据查询字符串中的 where 参数进行过滤,但我找不到任何关于 where 子句应该采用什么格式或如何使用它的文档?

【问题讨论】:

标签: playframework crud playframework-1.x


【解决方案1】:

这是一个简单的 JPA 查询 where 子句。

例如,如果您有一个带有用户名属性的用户模型,您可以创建一个 where 子句,如下所示:

"user.username = 'lucernae'"

它将列出用户名等于'lucernae'的所有用户模型实例

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2012-05-10
    • 2012-10-15
    • 1970-01-01
    • 1970-01-01
    • 2012-02-20
    • 1970-01-01
    • 2013-01-06
    相关资源
    最近更新 更多