Esempio n. 1
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;
  }
Esempio n. 2
0
  private static Permission findByAction(String action) {
    if (CommonUtil.isBlank(action)) return null;

    return Permission.find("byAction", action.trim()).first();
  }