Commit 5be2b6c8 authored by 赵啸非's avatar 赵啸非

添加菜单资源配置

parent 58ddeb2e
...@@ -3,6 +3,7 @@ package com.mortals.xhx.base.system.role.web; ...@@ -3,6 +3,7 @@ package com.mortals.xhx.base.system.role.web;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.mortals.framework.web.BaseCRUDJsonBodyMappingController; import com.mortals.framework.web.BaseCRUDJsonBodyMappingController;
import com.mortals.xhx.base.system.menu.model.MenuTreeSelect;
import com.mortals.xhx.base.system.resource.model.ResourceEntity; import com.mortals.xhx.base.system.resource.model.ResourceEntity;
import com.mortals.xhx.base.system.resource.service.ResourceService; import com.mortals.xhx.base.system.resource.service.ResourceService;
import com.mortals.xhx.base.system.role.model.RoleAuthEntity; import com.mortals.xhx.base.system.role.model.RoleAuthEntity;
...@@ -85,14 +86,15 @@ public class RoleAuthController extends BaseCRUDJsonBodyMappingController<RoleAu ...@@ -85,14 +86,15 @@ public class RoleAuthController extends BaseCRUDJsonBodyMappingController<RoleAu
@ApiOperation(value = "根据角色编辑菜单") @ApiOperation(value = "根据角色编辑菜单")
@PostMapping(value = "editMenu") @PostMapping(value = "editMenu")
public String editMenu(@RequestBody RoleAuthQuery query) { public String editMenu(@RequestBody RoleAuthQuery query) {
try {
service.editMenu(query, this.getContext());
JSONObject ret = new JSONObject(); JSONObject ret = new JSONObject();
Map<String, Object> model = new HashMap<>();
try {
List<MenuTreeSelect> menuTreeSelects = service.editMenu(query, this.getContext());
model.put(KEY_RESULT_DATA, menuTreeSelects);
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS); ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
return ret.toJSONString(); return ret.toJSONString();
} catch (Exception e) { } catch (Exception e) {
log.error("角色编辑菜单错误", e); log.error("角色编辑菜单错误", e);
JSONObject ret = new JSONObject();
ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE); ret.put(KEY_RESULT_CODE, VALUE_RESULT_FAILURE);
ret.put(KEY_RESULT_MSG, super.convertException(e)); ret.put(KEY_RESULT_MSG, super.convertException(e));
return ret.toJSONString(); return ret.toJSONString();
...@@ -106,13 +108,10 @@ public class RoleAuthController extends BaseCRUDJsonBodyMappingController<RoleAu ...@@ -106,13 +108,10 @@ public class RoleAuthController extends BaseCRUDJsonBodyMappingController<RoleAu
@PostMapping(value = "editResource") @PostMapping(value = "editResource")
public String editResource(@RequestBody RoleAuthQuery query) { public String editResource(@RequestBody RoleAuthQuery query) {
JSONObject ret = new JSONObject(); JSONObject ret = new JSONObject();
Map<String, Object> model = new HashMap<>();
try { try {
Map<String, List<ResourceEntity>> group = resourceService.group(query.getRoleId(), getContext()); Map<String, List<ResourceEntity>> group = resourceService.group(query.getRoleId(), getContext());
model.put(KEY_RESULT_DATA, group);
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
ret.put(KEY_RESULT_DATA, model);
ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS); ret.put(KEY_RESULT_CODE, VALUE_RESULT_SUCCESS);
ret.put(KEY_RESULT_DATA, group);
return ret.toJSONString(); return ret.toJSONString();
} catch (Exception e) { } catch (Exception e) {
log.error("角色编辑资源错误", e); log.error("角色编辑资源错误", e);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment