Commit 17a399b5872ede4b9b01d7ccb265393afc0c4325
1 parent
3262e544
支持按钮权限功能
Showing
1 changed file
with
12 additions
and
11 deletions
jeecg-boot/src/main/java/org/jeecg/modules/system/controller/SysPermissionController.java
... | ... | @@ -78,7 +78,7 @@ public class SysPermissionController { |
78 | 78 | |
79 | 79 | |
80 | 80 | /** |
81 | - * 查询用户的权限 | |
81 | + * 查询用户拥有的菜单权限和按钮权限(根据用户账号) | |
82 | 82 | * @return |
83 | 83 | */ |
84 | 84 | @RequestMapping(value = "/queryByUser", method = RequestMethod.GET) |
... | ... | @@ -118,7 +118,7 @@ public class SysPermissionController { |
118 | 118 | |
119 | 119 | @RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST}) |
120 | 120 | @RequiresRoles({"admin"}) |
121 | - public Result<SysPermission> eidt(@RequestBody SysPermission permission) { | |
121 | + public Result<SysPermission> edit(@RequestBody SysPermission permission) { | |
122 | 122 | Result<SysPermission> result = new Result<>(); |
123 | 123 | try { |
124 | 124 | sysPermissionService.editPermission(permission); |
... | ... | @@ -264,12 +264,12 @@ public class SysPermissionController { |
264 | 264 | SysPermissionTree tree = new SysPermissionTree(permission); |
265 | 265 | if(temp==null && oConvertUtils.isEmpty(tempPid)) { |
266 | 266 | treeList.add(tree); |
267 | - if(tree.getIsLeaf()==0) { | |
267 | + if(!tree.getIsLeaf()) { | |
268 | 268 | getTreeList(treeList, metaList, tree); |
269 | 269 | } |
270 | 270 | }else if(temp!=null && tempPid!=null && tempPid.equals(temp.getId())){ |
271 | 271 | temp.getChildren().add(tree); |
272 | - if(tree.getIsLeaf()==0) { | |
272 | + if(!tree.getIsLeaf()) { | |
273 | 273 | getTreeList(treeList, metaList, tree); |
274 | 274 | } |
275 | 275 | } |
... | ... | @@ -283,12 +283,12 @@ public class SysPermissionController { |
283 | 283 | TreeModel tree = new TreeModel(permission); |
284 | 284 | if(temp==null && oConvertUtils.isEmpty(tempPid)) { |
285 | 285 | treeList.add(tree); |
286 | - if(permission.getIsLeaf()==0) { | |
286 | + if(!tree.getIsLeaf()) { | |
287 | 287 | getTreeModelList(treeList, metaList, tree); |
288 | 288 | } |
289 | 289 | }else if(temp!=null && tempPid!=null && tempPid.equals(temp.getKey())){ |
290 | 290 | temp.getChildren().add(tree); |
291 | - if(permission.getIsLeaf()==0) { | |
291 | + if(!tree.getIsLeaf()) { | |
292 | 292 | getTreeModelList(treeList, metaList, tree); |
293 | 293 | } |
294 | 294 | } |
... | ... | @@ -310,11 +310,12 @@ public class SysPermissionController { |
310 | 310 | JSONObject json = getPermissionJsonObject(permission); |
311 | 311 | if(parentJson==null && oConvertUtils.isEmpty(tempPid)) { |
312 | 312 | jsonArray.add(json); |
313 | - if(permission.getIsLeaf()==0) { | |
313 | + if(!permission.isLeaf()) { | |
314 | 314 | getPermissionJsonArray(jsonArray, metaList, json); |
315 | 315 | } |
316 | 316 | }else if(parentJson!=null && oConvertUtils.isNotEmpty(tempPid) && tempPid.equals(parentJson.getString("id"))){ |
317 | - if(permission.getMenuType()==0) { | |
317 | + //类型( 0:一级菜单 1:子菜单 2:按钮 ) | |
318 | + if(permission.getMenuType()==2) { | |
318 | 319 | JSONObject metaJson = parentJson.getJSONObject("meta"); |
319 | 320 | if(metaJson.containsKey("permissionList")) { |
320 | 321 | metaJson.getJSONArray("permissionList").add(json); |
... | ... | @@ -323,8 +324,8 @@ public class SysPermissionController { |
323 | 324 | permissionList.add(json); |
324 | 325 | metaJson.put("permissionList", permissionList); |
325 | 326 | } |
326 | - | |
327 | - }else if(permission.getMenuType()==1) { | |
327 | + //类型( 0:一级菜单 1:子菜单 2:按钮 ) | |
328 | + }else if(permission.getMenuType()==1|| permission.getMenuType()==0) { | |
328 | 329 | if(parentJson.containsKey("children")) { |
329 | 330 | parentJson.getJSONArray("children").add(json); |
330 | 331 | }else { |
... | ... | @@ -333,7 +334,7 @@ public class SysPermissionController { |
333 | 334 | parentJson.put("children", children); |
334 | 335 | } |
335 | 336 | |
336 | - if(permission.getIsLeaf()==0) { | |
337 | + if(!permission.isLeaf()) { | |
337 | 338 | getPermissionJsonArray(jsonArray, metaList, json); |
338 | 339 | } |
339 | 340 | } |
... | ... |