|  |  |  | 
|---|
|  |  |  | import org.apache.shiro.subject.Subject; | 
|---|
|  |  |  | import org.springframework.beans.factory.annotation.Autowired; | 
|---|
|  |  |  | import org.springframework.validation.annotation.Validated; | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import javax.servlet.http.HttpServletRequest; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | import org.springframework.web.bind.annotation.*; | 
|---|
|  |  |  |  | 
|---|
|  |  |  | /** | 
|---|
|  |  |  | * @author Eva.Caesar Liu | 
|---|
|  |  |  | 
|---|
|  |  |  | @ApiOperation("登录") | 
|---|
|  |  |  | @PostMapping("/login") | 
|---|
|  |  |  | public ApiResponse<String> login (@Validated @RequestBody LoginDTO dto, HttpServletRequest request) { | 
|---|
|  |  |  | dto.setCheckCode(true); | 
|---|
|  |  |  | return ApiResponse.success(systemLoginService.loginByPassword(dto, request)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  |  | 
|---|
|  |  |  | 
|---|
|  |  |  | @ApiOperation("修改当前用户密码") | 
|---|
|  |  |  | @PostMapping("/updatePwd") | 
|---|
|  |  |  | public ApiResponse updatePwd (@Validated @RequestBody UpdatePwdDto dto) { | 
|---|
|  |  |  | dto.setUserId(this.getLoginUser().getId()); | 
|---|
|  |  |  | dto.setUserId(this.getLoginUser(null).getId()); | 
|---|
|  |  |  | systemUserBiz.updatePwd(dto); | 
|---|
|  |  |  | return ApiResponse.success(null); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | 
|---|
|  |  |  | @ApiOperation("获取当前登录的用户信息") | 
|---|
|  |  |  | @GetMapping("/getUserInfo") | 
|---|
|  |  |  | public ApiResponse<LoginUserInfo> getUserInfo () { | 
|---|
|  |  |  | return ApiResponse.success(this.getLoginUser()); | 
|---|
|  |  |  | return ApiResponse.success(this.getLoginUser(null)); | 
|---|
|  |  |  | } | 
|---|
|  |  |  | } | 
|---|