Skip to content

Commit

Permalink
还原
Browse files Browse the repository at this point in the history
  • Loading branch information
zhangdaiscott committed Mar 18, 2019
1 parent 6084bb2 commit 13ae66b
Showing 1 changed file with 12 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public Result<List<SysPermissionTree>> list() {


/**
* 查询用户拥有的菜单权限和按钮权限(根据用户账号)
* 查询用户的权限
* @return
*/
@RequestMapping(value = "/queryByUser", method = RequestMethod.GET)
Expand Down Expand Up @@ -118,7 +118,7 @@ public Result<SysPermission> add(@RequestBody SysPermission permission) {

@RequestMapping(value = "/edit", method = {RequestMethod.PUT,RequestMethod.POST})
@RequiresRoles({"admin"})
public Result<SysPermission> edit(@RequestBody SysPermission permission) {
public Result<SysPermission> eidt(@RequestBody SysPermission permission) {
Result<SysPermission> result = new Result<>();
try {
sysPermissionService.editPermission(permission);
Expand Down Expand Up @@ -264,12 +264,12 @@ private void getTreeList(List<SysPermissionTree> treeList,List<SysPermission> me
SysPermissionTree tree = new SysPermissionTree(permission);
if(temp==null && oConvertUtils.isEmpty(tempPid)) {
treeList.add(tree);
if(!tree.getIsLeaf()) {
if(tree.getIsLeaf()==0) {
getTreeList(treeList, metaList, tree);
}
}else if(temp!=null && tempPid!=null && tempPid.equals(temp.getId())){
temp.getChildren().add(tree);
if(!tree.getIsLeaf()) {
if(tree.getIsLeaf()==0) {
getTreeList(treeList, metaList, tree);
}
}
Expand All @@ -283,12 +283,12 @@ private void getTreeModelList(List<TreeModel> treeList,List<SysPermission> metaL
TreeModel tree = new TreeModel(permission);
if(temp==null && oConvertUtils.isEmpty(tempPid)) {
treeList.add(tree);
if(!tree.getIsLeaf()) {
if(permission.getIsLeaf()==0) {
getTreeModelList(treeList, metaList, tree);
}
}else if(temp!=null && tempPid!=null && tempPid.equals(temp.getKey())){
temp.getChildren().add(tree);
if(!tree.getIsLeaf()) {
if(permission.getIsLeaf()==0) {
getTreeModelList(treeList, metaList, tree);
}
}
Expand All @@ -310,12 +310,11 @@ private void getPermissionJsonArray(JSONArray jsonArray,List<SysPermission> meta
JSONObject json = getPermissionJsonObject(permission);
if(parentJson==null && oConvertUtils.isEmpty(tempPid)) {
jsonArray.add(json);
if(!permission.isLeaf()) {
if(permission.getIsLeaf()==0) {
getPermissionJsonArray(jsonArray, metaList, json);
}
}else if(parentJson!=null && oConvertUtils.isNotEmpty(tempPid) && tempPid.equals(parentJson.getString("id"))){
//类型( 0:一级菜单 1:子菜单 2:按钮 )
if(permission.getMenuType()==2) {
if(permission.getMenuType()==0) {
JSONObject metaJson = parentJson.getJSONObject("meta");
if(metaJson.containsKey("permissionList")) {
metaJson.getJSONArray("permissionList").add(json);
Expand All @@ -324,8 +323,8 @@ private void getPermissionJsonArray(JSONArray jsonArray,List<SysPermission> meta
permissionList.add(json);
metaJson.put("permissionList", permissionList);
}
//类型( 0:一级菜单 1:子菜单 2:按钮 )
}else if(permission.getMenuType()==1|| permission.getMenuType()==0) {
}else if(permission.getMenuType()==1) {
if(parentJson.containsKey("children")) {
parentJson.getJSONArray("children").add(json);
}else {
Expand All @@ -334,7 +333,7 @@ private void getPermissionJsonArray(JSONArray jsonArray,List<SysPermission> meta
parentJson.put("children", children);
}

if(!permission.isLeaf()) {
if(permission.getIsLeaf()==0) {
getPermissionJsonArray(jsonArray, metaList, json);
}
}
Expand Down Expand Up @@ -406,4 +405,4 @@ private String urlToRouteName(String url) {
}
}

}
}

0 comments on commit 13ae66b

Please sign in to comment.