ludc
2023-11-30 1b8098b7f79b66a80e5ca49d8765606cb5fa0408
Source/UBCS/ubcs-service/ubcs-system/src/main/java/com/vci/ubcs/system/controller/RoleController.java
@@ -46,6 +46,9 @@
import javax.validation.Valid;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.stream.Collector;
import java.util.stream.Collectors;
import static org.springblade.core.cache.constant.CacheConstant.SYS_CACHE;
@@ -128,7 +131,6 @@
      return R.status(roleService.submit(role));
   }
   /**
    * 删除
    */
@@ -150,7 +152,16 @@
   public R grant(@RequestBody GrantVO grantVO) {
      CacheUtil.clear(SYS_CACHE);
      CacheUtil.clear(SYS_CACHE, Boolean.FALSE);
      boolean temp = roleService.grant(grantVO.getRoleIds(), grantVO.getMenuIds(), grantVO.getDataScopeIds(), grantVO.getApiScopeIds());
      boolean temp = false;
      try {
         temp = roleService.grant(grantVO.getRoleIds(), grantVO.getMenuIds(), grantVO.getDataScopeIds(), grantVO.getApiScopeIds());
         // 插入授权日志
         roleService.grantLog(roleService.getGrantRoleResString(grantVO.getRoleIds()),false);
      }catch (Exception e){
         // 失败时插入异常信息到日志中
         roleService.grantLog(e.getMessage(),true);
         throw e;
      }
      return R.status(temp);
   }