Beispiel #1
0
 @RequestMapping(value = "/add")
 public ModelAndView addPage(Role role) {
   List<Map<String, Object>> permissionList = permissionService.getPermissionMap(null);
   Iterator<Map<String, Object>> it = permissionList.iterator();
   List<String> permissiontringList = new ArrayList<>();
   while (it.hasNext()) {
     Map<String, Object> rm = it.next();
     permissiontringList.add(JsonMapper.nonDefaultMapper().toJson(rm));
   }
   role.setPermissionList(permissiontringList);
   return new ModelAndView(ADD, "role", role);
 }
Beispiel #2
0
 @RequestMapping(value = "/edit")
 public ModelAndView editPage(Role role) {
   if (null != role && null != role.getId()) {
     role = roleService.getRoleById(role.getId());
     List<Map<String, Object>> permissionList = permissionService.getPermissionMap(role.getId());
     Iterator<Map<String, Object>> it = permissionList.iterator();
     List<String> permissiontringList = new ArrayList<>();
     while (it.hasNext()) {
       Map<String, Object> rm = it.next();
       permissiontringList.add(JsonMapper.nonDefaultMapper().toJson(rm));
     }
     role.setPermissionList(permissiontringList);
   }
   return new ModelAndView(EDIT, "role", role);
 }