Java Code Examples for com.ruoyi.framework.util.ShiroUtils#getUserId()

The following examples show how to use com.ruoyi.framework.util.ShiroUtils#getUserId() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: SysUserController.java    From supplierShop with MIT License 6 votes vote down vote up
@RequiresPermissions("system:user:resetPwd")
@Log(title = "重置密码", businessType = BusinessType.UPDATE)
@PostMapping("/resetPwd")
@ResponseBody
public AjaxResult resetPwdSave(SysUser user)
{
    user.setSalt(ShiroUtils.randomSalt());
    user.setPassword(passwordService.encryptPassword(user.getLoginName(), user.getPassword(), user.getSalt()));
    if (userService.resetUserPwd(user) > 0)
    {
        if (ShiroUtils.getUserId() == user.getUserId())
        {
            ShiroUtils.setSysUser(userService.selectUserById(user.getUserId()));
        }
        return success();
    }
    return error();
}
 
Example 2
Source File: SysMenuController.java    From supplierShop with MIT License 5 votes vote down vote up
@RequiresPermissions("system:menu:list")
@PostMapping("/list")
@ResponseBody
public List<SysMenu> list(SysMenu menu)
{
    Long userId = ShiroUtils.getUserId();
    List<SysMenu> menuList = menuService.selectMenuList(menu, userId);
    return menuList;
}
 
Example 3
Source File: SysMenuController.java    From supplierShop with MIT License 5 votes vote down vote up
/**
 * 加载角色菜单列表树
 */
@GetMapping("/roleMenuTreeData")
@ResponseBody
public List<Ztree> roleMenuTreeData(SysRole role)
{
    Long userId = ShiroUtils.getUserId();
    List<Ztree> ztrees = menuService.roleMenuTreeData(role, userId);
    return ztrees;
}
 
Example 4
Source File: SysMenuController.java    From supplierShop with MIT License 5 votes vote down vote up
/**
 * 加载所有菜单列表树
 */
@GetMapping("/menuTreeData")
@ResponseBody
public List<Ztree> menuTreeData()
{
    Long userId = ShiroUtils.getUserId();
    List<Ztree> ztrees = menuService.menuTreeData(userId);
    return ztrees;
}
 
Example 5
Source File: SysMenuController.java    From RuoYi with Apache License 2.0 5 votes vote down vote up
@RequiresPermissions("system:menu:list")
@GetMapping("/list")
@ResponseBody
public List<SysMenu> list(SysMenu menu) {
    Long userId = ShiroUtils.getUserId();
    return menuService.selectMenuList(menu, userId);
}
 
Example 6
Source File: SysMenuController.java    From RuoYi with Apache License 2.0 5 votes vote down vote up
/**
 * 加载角色菜单列表树
 */
@GetMapping("/roleMenuTreeData")
@ResponseBody
public List<Ztree> roleMenuTreeData(SysRole role) {
    Long userId = ShiroUtils.getUserId();
    return menuService.roleMenuTreeData(role, userId);
}
 
Example 7
Source File: SysMenuController.java    From RuoYi with Apache License 2.0 5 votes vote down vote up
/**
 * 加载所有菜单列表树
 */
@GetMapping("/menuTreeData")
@ResponseBody
public List<Ztree> menuTreeData(SysRole role) {
    Long userId = ShiroUtils.getUserId();
    return menuService.menuTreeData(userId);
}