use of com.hb0730.boot.admin.project.system.user.model.entity.UserInfoEntity in project boot-admin by hb0730.
the class UserInfoController method getUserInfoById.
/**
* 获取用户详情
*
* @param id 用户id
* @return 用户详情(不包含相关信息)
*/
@GetMapping("/{id}")
public Result<UserInfoDTO> getUserInfoById(@PathVariable("id") Long id) {
UserInfoEntity entity = service.getById(id);
UserInfoDTO info = BeanUtil.toBean(entity, UserInfoDTO.class);
return R.success(info);
}
use of com.hb0730.boot.admin.project.system.user.model.entity.UserInfoEntity in project boot-admin by hb0730.
the class UserInfoController method restPassword.
/**
* 重置密码
*
* @param id 用户id
* @return 是否成功
*/
@GetMapping("/rest/password/{id}")
@PreAuthorize("hasAnyAuthority('ROLE_ADMINISTRATOR','user:rest:password')")
@Log(value = "重置密码")
public Result<String> restPassword(@PathVariable("id") Long id) {
UserInfoEntity entity = service.getById(id);
if (entity.getIsAdmin() == 1) {
throw new BusinessException("超级管理员无法重置");
}
service.restPassword(id);
return R.success("重置成功");
}
Aggregations