傅行帆 vor 5 Jahren
Ursprung
Commit
82349362b9

+ 27
- 7
src/main/java/com/huiju/estateagents/cleancode/CleanCode.java Datei anzeigen

@@ -2,12 +2,8 @@ package com.huiju.estateagents.cleancode;
2 2
 
3 3
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
4 4
 import com.huiju.estateagents.base.ResponseBean;
5
-import com.huiju.estateagents.entity.SysMenu;
6
-import com.huiju.estateagents.entity.TaRole;
7
-import com.huiju.estateagents.entity.TaRoleMenu;
8
-import com.huiju.estateagents.service.ISysMenuService;
9
-import com.huiju.estateagents.service.ITaRoleMenuService;
10
-import com.huiju.estateagents.service.ITaRoleService;
5
+import com.huiju.estateagents.entity.*;
6
+import com.huiju.estateagents.service.*;
11 7
 import org.springframework.beans.factory.annotation.Autowired;
12 8
 import org.springframework.web.bind.annotation.RequestMapping;
13 9
 import org.springframework.web.bind.annotation.RequestMethod;
@@ -30,8 +26,14 @@ public class CleanCode {
30 26
     @Autowired
31 27
     private ITaRoleMenuService taRoleMenuService;
32 28
 
29
+    @Autowired
30
+    private ITaRoleButtonService taRoleButtonService;
31
+
32
+    @Autowired
33
+    private ISysButtonInMenuService sysButtonInMenuService;
34
+
33 35
     @RequestMapping(value = "/clean/menurole", method = RequestMethod.GET)
34
-    public void helpActivityList() {
36
+    public void cleanMenu() {
35 37
         List<SysMenu> sysMenuList = sysMenuService.list();
36 38
 
37 39
         QueryWrapper<TaRole> roleQueryWrapper = new QueryWrapper<>();
@@ -47,4 +49,22 @@ public class CleanCode {
47 49
             });
48 50
         });
49 51
     }
52
+
53
+    @RequestMapping(value = "/clean/buttonrole", method = RequestMethod.GET)
54
+    public void cleanButton() {
55
+        List<SysButtonInMenu> buttlist = sysButtonInMenuService.list();
56
+
57
+        QueryWrapper<TaRole> roleQueryWrapper = new QueryWrapper<>();
58
+        roleQueryWrapper.eq("is_admin",1);
59
+        List<TaRole> roleList = taRoleService.list(roleQueryWrapper);
60
+
61
+        roleList.forEach(e -> {
62
+            buttlist.forEach(s -> {
63
+                TaRoleButton taRoleButton = new TaRoleButton();
64
+                taRoleButton.setBtnId(s.getBtnId());
65
+                taRoleButton.setRoleId(e.getRoleId());
66
+                taRoleButtonService.save(taRoleButton);
67
+            });
68
+        });
69
+    }
50 70
 }

+ 2
- 1
src/main/java/com/huiju/estateagents/interceptor/AccessInterceptor.java Datei anzeigen

@@ -65,7 +65,8 @@ public class AccessInterceptor implements HandlerInterceptor {
65 65
             "/webjars",
66 66
             "/webjars/springfox-swagger-ui",
67 67
             "/webjars/springfox-swagger-ui/css/typography.css",
68
-            "/clean/menurole"
68
+            "/clean/menurole",
69
+            "/clean/buttonrole"
69 70
     };
70 71
 
71 72
     /*