Ejemplo n.º 1
0
  public static long countByCondition(String action, String desc) {
    final List<Object> params = new ArrayList<Object>();
    final StringBuilder sb = new StringBuilder();
    parseCondition(action, desc, params, sb);

    return Permission.count(sb.toString(), params.toArray());
  }
Ejemplo n.º 2
0
  public static List<Permission> findByCondition(
      int page, int pageSize, String action, String desc) {
    final List<Object> params = new ArrayList<Object>();
    final StringBuilder sb = new StringBuilder();
    parseCondition(action, desc, params, sb);

    List<Permission> permissions = null;
    if (page > 0 && pageSize > 0)
      permissions =
          Permission.find(sb.toString() + " order by id desc", params.toArray())
              .fetch(page, pageSize);
    else
      permissions = Permission.find(sb.toString() + " order by id desc", params.toArray()).fetch();
    return permissions;
  }