修改用户信息接口
This commit is contained in:
parent
126b8bff39
commit
50e79dd0b9
|
@ -1,6 +1,7 @@
|
||||||
package com.example.takeawaysystemserver.controller;
|
package com.example.takeawaysystemserver.controller;
|
||||||
|
|
||||||
import com.example.takeawaysystemserver.entity.Address;
|
import com.example.takeawaysystemserver.entity.Address;
|
||||||
|
import com.example.takeawaysystemserver.entity.User;
|
||||||
import com.example.takeawaysystemserver.model.dto.*;
|
import com.example.takeawaysystemserver.model.dto.*;
|
||||||
import com.example.takeawaysystemserver.service.UserService;
|
import com.example.takeawaysystemserver.service.UserService;
|
||||||
import com.example.takeawaysystemserver.util.R;
|
import com.example.takeawaysystemserver.util.R;
|
||||||
|
@ -71,4 +72,10 @@ public class UserController {
|
||||||
public R<String> updateAddr(@RequestHeader String token, @RequestParam("address")String addr){
|
public R<String> updateAddr(@RequestHeader String token, @RequestParam("address")String addr){
|
||||||
return userService.updateAddress(token, addr);
|
return userService.updateAddress(token, addr);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@GetMapping("userinfo")
|
||||||
|
@ApiOperation(value = "获取用户信息")
|
||||||
|
public R<User> getUserInfo(@RequestHeader String token){
|
||||||
|
return userService.getInfo(token);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -72,4 +72,11 @@ public interface UserService extends IService<User> {
|
||||||
* @return 更新信息
|
* @return 更新信息
|
||||||
*/
|
*/
|
||||||
R<String> updateAddress(String token, String address);
|
R<String> updateAddress(String token, String address);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户信息
|
||||||
|
* @param token 用户token
|
||||||
|
* @return 用户信息
|
||||||
|
*/
|
||||||
|
R<User> getInfo(String token);
|
||||||
}
|
}
|
||||||
|
|
|
@ -161,6 +161,13 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User>
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public R<User> getInfo(String token) {
|
||||||
|
Integer id = Integer.parseInt(getUserId(token));
|
||||||
|
User user = getById(id);
|
||||||
|
return R.ok(user);
|
||||||
|
}
|
||||||
|
|
||||||
private Boolean checkUser(UserRegisterDTO userRegisterDTO){
|
private Boolean checkUser(UserRegisterDTO userRegisterDTO){
|
||||||
User user = baseMapper.selectOne(new LambdaQueryWrapper<User>()
|
User user = baseMapper.selectOne(new LambdaQueryWrapper<User>()
|
||||||
.select(User::getUsername)
|
.select(User::getUsername)
|
||||||
|
|
Loading…
Reference in New Issue