Commit 7718fbd4 authored by hezhen's avatar hezhen

Merge branch 'hz_master'

parents 59d0abff 94dff032
...@@ -131,6 +131,7 @@ public class GroupBiz extends BaseBiz<GroupMapper, Group> { ...@@ -131,6 +131,7 @@ public class GroupBiz extends BaseBiz<GroupMapper, Group> {
@CacheClear(keys = {"permission:menu","permission:u","app:permission:u"}) @CacheClear(keys = {"permission:menu","permission:u","app:permission:u"})
public void modifyAuthorityMenu(int groupId, String[] menus) { public void modifyAuthorityMenu(int groupId, String[] menus) {
resourceAuthorityMapper.deleteByAuthorityIdAndResourceType(groupId + "", AdminCommonConstant.RESOURCE_TYPE_MENU); resourceAuthorityMapper.deleteByAuthorityIdAndResourceType(groupId + "", AdminCommonConstant.RESOURCE_TYPE_MENU);
if (menus.length>0){
List<Menu> menuList = menuMapper.selectAll(); List<Menu> menuList = menuMapper.selectAll();
Map<String, String> map = new HashMap<String, String>(); Map<String, String> map = new HashMap<String, String>();
for (Menu menu : menuList) { for (Menu menu : menuList) {
...@@ -142,12 +143,15 @@ public class GroupBiz extends BaseBiz<GroupMapper, Group> { ...@@ -142,12 +143,15 @@ public class GroupBiz extends BaseBiz<GroupMapper, Group> {
for (String menuId : menus) { for (String menuId : menus) {
findParentID(map, relationMenus, menuId); findParentID(map, relationMenus, menuId);
} }
for (String menuId : relationMenus) { for (String menuId : relationMenus) {
authority = new ResourceAuthority(AdminCommonConstant.AUTHORITY_TYPE_GROUP, AdminCommonConstant.RESOURCE_TYPE_MENU); authority = new ResourceAuthority(AdminCommonConstant.AUTHORITY_TYPE_GROUP, AdminCommonConstant.RESOURCE_TYPE_MENU);
authority.setAuthorityId(groupId + ""); authority.setAuthorityId(groupId + "");
authority.setResourceId(menuId); authority.setResourceId(menuId);
authority.setParentId("-1"); authority.setParentId("-1");
resourceAuthorityMapper.insertSelective(authority); resourceAuthorityMapper.insertSelective(authority);
}
} }
} }
......
...@@ -73,11 +73,15 @@ public class GroupController extends BaseController<GroupBiz, Group> { ...@@ -73,11 +73,15 @@ public class GroupController extends BaseController<GroupBiz, Group> {
@RequestMapping(value = "/{id}/authority/menu", method = RequestMethod.PUT) @RequestMapping(value = "/{id}/authority/menu", method = RequestMethod.PUT)
@ResponseBody @ResponseBody
public ObjectRestResponse modifyMenuAuthority(@PathVariable int id, String menuTrees){ public ObjectRestResponse modifyMenuAuthority(@PathVariable int id, String menuTrees){
String [] menus = menuTrees.split(","); String [] menus =new String[]{};
if (StringUtils.isNotBlank(menuTrees)){
menus= menuTrees.split(",");
}
baseBiz.modifyAuthorityMenu(id, menus); baseBiz.modifyAuthorityMenu(id, menus);
return new ObjectRestResponse().rel(true); return new ObjectRestResponse().rel(true);
} }
@RequestMapping(value = "/{id}/authority/menu", method = RequestMethod.GET) @RequestMapping(value = "/{id}/authority/menu", method = RequestMethod.GET)
@ResponseBody @ResponseBody
public ObjectRestResponse<List<AuthorityMenuTree>> getMenuAuthority(@PathVariable int id){ public ObjectRestResponse<List<AuthorityMenuTree>> getMenuAuthority(@PathVariable int id){
......
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