/* * 查询权限新添加的权限 * permissioinid 权限编号用逗号隔开 * pmrole角色编号 */ public List<PmPermission> getRolePermissionSave(String permissioinId, PmRole pmRole) throws Exception { try { String addhql = "from PmPermission where permissionId in (?)) and permissionId not in " + "(select rolePermissionPid from PmRRolePermissioin where rolePermissionRid=? and rolePermissionPid in (?) and rolePermissionStatus=0)"; Object[] obj = new Object[3]; obj[0] = permissioinId; obj[1] = pmRole.getRoleId(); obj[2] = permissioinId; List<PmPermission> list = this.query(addhql, obj); return list; } catch (Exception e) { throw e; } }
/* * 根据角色获取权限 * role角色编号 */ public List<PmPermission> getRolePermission(PmRole role) throws Exception { try { StringBuffer sb = new StringBuffer(); sb.append( "from PmPermission where permissionId in " + "(select rolePermissionPid from PmRRolePermissioin where rolePermissionRid=? and rolePermissionStatus=0)"); Object[] obj = new Object[1]; obj[0] = role.getRoleId(); List<PmPermission> listPermission = (List<PmPermission>) this.query(sb.toString(), obj); // 集合不为空且长度大于0返回集合 if (listPermission != null && listPermission.size() > 0) { return listPermission; } } catch (Exception e) { throw e; } return null; }