فهرست منبع

修复添加菜单报错问题

dzx 10 ماه پیش
والد
کامیت
1300fa7003
1فایلهای تغییر یافته به همراه5 افزوده شده و 2 حذف شده
  1. 5 2
      src/main/java/com/xjrsoft/module/system/controller/MenuController.java

+ 5 - 2
src/main/java/com/xjrsoft/module/system/controller/MenuController.java

@@ -251,9 +251,12 @@ public class MenuController {
 
         //多选
         List<XjrMenuDeptRelation> menuDeptRelationsList = new ArrayList<>();
-        for (AddXjrMenuDeptRelationDto addXjrMenuDeptRelationDto : dto.getMenuDeptRelations()) {
-            menuDeptRelationsList.add(BeanUtil.toBean(addXjrMenuDeptRelationDto, XjrMenuDeptRelation.class));
+        if(dto.getMenuDeptRelations() != null){
+            for (AddXjrMenuDeptRelationDto addXjrMenuDeptRelationDto : dto.getMenuDeptRelations()) {
+                menuDeptRelationsList.add(BeanUtil.toBean(addXjrMenuDeptRelationDto, XjrMenuDeptRelation.class));
+            }
         }
+
         menuDeptRelationsList.forEach(XjrMenuDeptRelation -> XjrMenuDeptRelation.setMenuId(menu.getId()));
         xjrMenuDeptRelationService.remove(Wrappers.<XjrMenuDeptRelation>query().lambda().eq(XjrMenuDeptRelation::getMenuId, menu.getId()));
         xjrMenuDeptRelationService.saveBatch(menuDeptRelationsList);