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; }
private static Permission findByAction(String action) { if (CommonUtil.isBlank(action)) return null; return Permission.find("byAction", action.trim()).first(); }