mirror of https://gitee.com/maxjhandsome/pig
fixed: bean注入问题
This commit is contained in:
parent
d0b99cd7c9
commit
9b3265dda6
|
@ -24,7 +24,7 @@ import java.util.Set;
|
||||||
@RequestMapping("/menu")
|
@RequestMapping("/menu")
|
||||||
public class MenuController extends BaseController {
|
public class MenuController extends BaseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysMenuService menuService;
|
private SysMenuService sysMenuService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 通过用户名查询用户菜单
|
* 通过用户名查询用户菜单
|
||||||
|
@ -34,7 +34,7 @@ public class MenuController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@GetMapping("/findMenuByRole/{role}")
|
@GetMapping("/findMenuByRole/{role}")
|
||||||
public Set<MenuVo> findMenuByRole(@PathVariable String role) {
|
public Set<MenuVo> findMenuByRole(@PathVariable String role) {
|
||||||
return menuService.findMenuByRole(role, 0);
|
return sysMenuService.findMenuByRole(role, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -46,7 +46,7 @@ public class MenuController extends BaseController {
|
||||||
public List<MenuTree> getTree() {
|
public List<MenuTree> getTree() {
|
||||||
SysMenu condition = new SysMenu();
|
SysMenu condition = new SysMenu();
|
||||||
condition.setDelFlag(CommonConstant.STATUS_NORMAL);
|
condition.setDelFlag(CommonConstant.STATUS_NORMAL);
|
||||||
return getMenuTree(menuService.selectList(new EntityWrapper<>(condition)), -1);
|
return getMenuTree(sysMenuService.selectList(new EntityWrapper<>(condition)), -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,7 +56,7 @@ public class MenuController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@GetMapping("/userTree/{type}")
|
@GetMapping("/userTree/{type}")
|
||||||
public List<Integer> userTree(@PathVariable Integer type) {
|
public List<Integer> userTree(@PathVariable Integer type) {
|
||||||
Set<MenuVo> menus = menuService.findMenuByRole(getRole().get(0), type);
|
Set<MenuVo> menus = sysMenuService.findMenuByRole(getRole().get(0), type);
|
||||||
List<Integer> menuList = new ArrayList<>();
|
List<Integer> menuList = new ArrayList<>();
|
||||||
for (MenuVo menuVo : menus) {
|
for (MenuVo menuVo : menus) {
|
||||||
menuList.add(menuVo.getMenuId());
|
menuList.add(menuVo.getMenuId());
|
||||||
|
@ -72,7 +72,7 @@ public class MenuController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@GetMapping("/{id}")
|
@GetMapping("/{id}")
|
||||||
public SysMenu menu(@PathVariable Integer id) {
|
public SysMenu menu(@PathVariable Integer id) {
|
||||||
return menuService.selectById(id);
|
return sysMenuService.selectById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -83,7 +83,7 @@ public class MenuController extends BaseController {
|
||||||
*/
|
*/
|
||||||
@PostMapping
|
@PostMapping
|
||||||
public Boolean menu(@RequestBody SysMenu sysMenu) {
|
public Boolean menu(@RequestBody SysMenu sysMenu) {
|
||||||
return menuService.insert(sysMenu);
|
return sysMenuService.insert(sysMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -100,21 +100,21 @@ public class MenuController extends BaseController {
|
||||||
SysMenu condition1 = new SysMenu();
|
SysMenu condition1 = new SysMenu();
|
||||||
condition1.setMenuId(id);
|
condition1.setMenuId(id);
|
||||||
condition1.setDelFlag(CommonConstant.STATUS_DEL);
|
condition1.setDelFlag(CommonConstant.STATUS_DEL);
|
||||||
menuService.updateById(condition1);
|
sysMenuService.updateById(condition1);
|
||||||
|
|
||||||
// 删除父节点为当前节点的节点
|
// 删除父节点为当前节点的节点
|
||||||
SysMenu conditon2 = new SysMenu();
|
SysMenu conditon2 = new SysMenu();
|
||||||
conditon2.setParentId(id);
|
conditon2.setParentId(id);
|
||||||
SysMenu sysMenu = new SysMenu();
|
SysMenu sysMenu = new SysMenu();
|
||||||
sysMenu.setDelFlag(CommonConstant.STATUS_DEL);
|
sysMenu.setDelFlag(CommonConstant.STATUS_DEL);
|
||||||
menuService.update(sysMenu, new EntityWrapper<>(conditon2));
|
sysMenuService.update(sysMenu, new EntityWrapper<>(conditon2));
|
||||||
return Boolean.TRUE;
|
return Boolean.TRUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
@PutMapping
|
@PutMapping
|
||||||
@CacheEvict(value = "menu_details",allEntries = true)
|
@CacheEvict(value = "menu_details",allEntries = true)
|
||||||
public Boolean menuUpdate(@RequestBody SysMenu sysMenu) {
|
public Boolean menuUpdate(@RequestBody SysMenu sysMenu) {
|
||||||
return menuService.updateById(sysMenu);
|
return sysMenuService.updateById(sysMenu);
|
||||||
}
|
}
|
||||||
|
|
||||||
private List<MenuTree> getMenuTree(List<SysMenu> menus, int root) {
|
private List<MenuTree> getMenuTree(List<SysMenu> menus, int root) {
|
||||||
|
|
|
@ -30,7 +30,7 @@ public class UserController extends BaseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysUserRoleService sysUserRoleService;
|
private SysUserRoleService sysUserRoleService;
|
||||||
@Autowired
|
@Autowired
|
||||||
private SysMenuService menuService;
|
private SysMenuService sysMenuService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取当前用户的用户名
|
* 获取当前用户的用户名
|
||||||
|
@ -49,7 +49,7 @@ public class UserController extends BaseController {
|
||||||
String[] roles = getRole().toArray(new String[getRole().size()]);
|
String[] roles = getRole().toArray(new String[getRole().size()]);
|
||||||
userInfo.setRoles(roles);
|
userInfo.setRoles(roles);
|
||||||
//设置权限列表(menu.permission)
|
//设置权限列表(menu.permission)
|
||||||
String[] permissions = menuService.findPermission(roles);
|
String[] permissions = sysMenuService.findPermission(roles);
|
||||||
userInfo.setPermissions(permissions);
|
userInfo.setPermissions(permissions);
|
||||||
return userInfo;
|
return userInfo;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue