public String doFormAction(@RequestParam Long siteId, @RequestParam Long categoryId,
@RequestParam Long[] resourceIds, @RequestParam Long[] roleIds) {
for(int i=0; i<resourceIds.length; i++) {
Long resourceId = resourceIds[i];
Long roleId = roleIds[i];
Permission permission = permissionService.getPermission(resourceId, categoryId);
if(permission==null) {
permission = new Permission(resourceId, categoryId);
}
permission.setRoleId(roleId);
permissionService.updatePermission(permission);
}
return String.format("redirect:/system/permission/list?siteId=%s", siteId);
}