use of com.dimple.framework.web.domain.AjaxResult in project DimpleBlog by martin-chips.
the class LoginController method getInfo.
/**
* 获取用户信息
*
* @return 用户信息
*/
@GetMapping("getInfo")
public AjaxResult getInfo() {
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
SysUser user = loginUser.getUser();
// 角色集合
Set<String> roles = permissionService.getRolePermission(user);
// 权限集合
Set<String> permissions = permissionService.getMenuPermission(user);
AjaxResult ajax = AjaxResult.success();
ajax.put("user", user);
ajax.put("roles", roles);
ajax.put("permissions", permissions);
return ajax;
}
use of com.dimple.framework.web.domain.AjaxResult in project DimpleBlog by martin-chips.
the class LoginController method login.
/**
* 登录方法
*
* @param username 用户名
* @param password 密码
* @param code 验证码
* @param uuid 唯一标识
* @return 结果
*/
@PostMapping("/login")
public AjaxResult login(String username, String password, String code, String uuid) {
AjaxResult ajax = AjaxResult.success();
// 生成令牌
String token = loginService.login(username, password, code, uuid);
ajax.put(Constants.TOKEN, token);
return ajax;
}
use of com.dimple.framework.web.domain.AjaxResult in project DimpleBlog by martin-chips.
the class MenuController method roleMenuTreeselect.
/**
* 加载对应角色菜单列表树
*/
@PreAuthorize("@permissionService.hasPermission('system:menu:query')")
@GetMapping(value = "/roleMenuTreeselect/{roleId}")
@ResponseBody
public AjaxResult roleMenuTreeselect(@PathVariable Long roleId) {
List<Menu> menus = menuService.selectMenuList(new Menu());
AjaxResult ajax = AjaxResult.success();
ajax.put("checkedKeys", menuService.selectMenuListByRoleId(roleId));
ajax.put("menus", menuService.buildMenuTreeSelect(menus));
return ajax;
}
use of com.dimple.framework.web.domain.AjaxResult in project DimpleBlog by martin-chips.
the class ProfileController method profile.
/**
* 个人信息
*/
@GetMapping
public AjaxResult profile() {
LoginUser loginUser = tokenService.getLoginUser(ServletUtils.getRequest());
SysUser user = loginUser.getUser();
AjaxResult ajax = AjaxResult.success(user);
ajax.put("roleGroup", userService.selectUserRoleGroup(loginUser.getUsername()));
return ajax;
}
use of com.dimple.framework.web.domain.AjaxResult in project DimpleBlog by martin-chips.
the class UserController method getInfo.
/**
* 根据用户编号获取详细信息
*/
@PreAuthorize("@permissionService.hasPermission('system:user:query')")
@GetMapping(value = "/{id}")
public AjaxResult getInfo(@PathVariable Long id) {
AjaxResult ajax = AjaxResult.success(userService.selectUserById(id));
ajax.put("roleIds", roleService.selectRoleListByUserId(id));
return ajax;
}
Aggregations