Pārlūkot izejas kodu

更新文件 SmartAuthorGroupController.java

陈士柏 2 gadi atpakaļ
vecāks
revīzija
0705acd95c

+ 21 - 5
src/main/java/com/template/controller/SmartAuthorGroupController.java

@@ -407,16 +407,32 @@ public class SmartAuthorGroupController implements SmartAuthorGroupControllerAPI
     @PassToken
     @PassToken
     @DESRespondSecret(validated = true)
     @DESRespondSecret(validated = true)
     public CommonResult delSmartAuthorGroup(Integer id) {
     public CommonResult delSmartAuthorGroup(Integer id) {
+        QueryWrapper<SmartAuthorGroup> queryWrapper1 = new QueryWrapper<>();
+        queryWrapper1.eq("parent_id", id);
+        queryWrapper1.eq("deleted",0);
+        List<SmartAuthorGroup> list1 = smartAuthorGroupService.getAuthorGroupByKey(queryWrapper1);
         SmartAuthorGroup rns = new SmartAuthorGroup();
         SmartAuthorGroup rns = new SmartAuthorGroup();
         rns.setId(id);
         rns.setId(id);
         rns.setDeleted(1);
         rns.setDeleted(1);
         int result = smartAuthorGroupService.updateSmartAuthorGroup(rns);
         int result = smartAuthorGroupService.updateSmartAuthorGroup(rns);
         SmartAuthority smartAuthority = new SmartAuthority();
         SmartAuthority smartAuthority = new SmartAuthority();
         smartAuthority.setDeleted(1);
         smartAuthority.setDeleted(1);
-        QueryWrapper<SmartAuthority> queryWrapperA = new QueryWrapper<>();
-        queryWrapperA.eq("group_id", id);
-        boolean m = smartAuthorityService.update(smartAuthority,queryWrapperA);
-        return result > 0 && m ? CommonResult.ok("删除成功") : CommonResult.fail("删除失败");
+        QueryWrapper<SmartAuthority> queryWrapper2 = new QueryWrapper<>();
+        queryWrapper2.eq("group_id", id);
+        boolean m = smartAuthorityService.update(smartAuthority,queryWrapper2);
+        SmartAuthorGroup rns2 = new SmartAuthorGroup();
+        rns2.setDeleted(1);
+        QueryWrapper<SmartAuthorGroup> queryWrapper3 = new QueryWrapper<>();
+        queryWrapper3.eq("parent_id", id);
+        boolean result2 = smartAuthorGroupService.update(rns2, queryWrapper3);
+        SmartAuthority smartAuthority2 = new SmartAuthority();
+        smartAuthority2.setDeleted(1);
+        QueryWrapper<SmartAuthority> queryWrapper4 = new QueryWrapper<>();
+        List<Integer> gid = list1.stream().map(SmartAuthorGroup::getId).collect(Collectors.toList());
+        queryWrapper4.in("group_id", gid);
+        queryWrapper4.eq("deleted",0);
+        boolean m2 = smartAuthorityService.update(smartAuthority2,queryWrapper4);
+        return result > 0 && result2 && m && m2 ? CommonResult.ok("删除成功") : CommonResult.fail("删除失败");
     }
     }
 
 
     /**
     /**
@@ -596,7 +612,7 @@ public class SmartAuthorGroupController implements SmartAuthorGroupControllerAPI
 
 
     @PassToken
     @PassToken
     @Override
     @Override
-    @DESRespondSecret(validated = true)
+    @DESRespondSecret(validated = false)
     public CommonResult queryUserAuthor(String userId) {
     public CommonResult queryUserAuthor(String userId) {
         String[] userids = userId.split(",");
         String[] userids = userId.split(",");
         QueryWrapper<SmartAuthority> queryWrapper1 = new QueryWrapper<>();
         QueryWrapper<SmartAuthority> queryWrapper1 = new QueryWrapper<>();