public void addRole(String roleName, String roleNote, String[] rolePermissions) {

    Role role = new Role(roleName, roleNote);
    roleDaoImpl.addRole(role);

    int permissionID = -1;

    for (String permissionId : rolePermissions) {
      permissionID = Integer.parseInt(permissionId);
      rolePermissionDaoImpl.addRolePermission(role.getRoleId(), permissionID);
    }
  }
  public void update(int id, String roleName, String roleNote, String[] rolePermission) {

    Role role = new Role(roleName, roleNote);
    roleDaoImpl.update(role, id); // 更新角色信息

    rolePermissionDaoImpl.deleteRolePermissionWithRoleId(id); // 先删除RoleId对应的权限
    int permissionId = 1;
    for (String permission : rolePermission) {
      permissionId = Integer.parseInt(permission);
      rolePermissionDaoImpl.addRolePermission(id, permissionId); // 重新加入权限
    }
  }