forked from gushen/sunway-user-system
注释了登出接口,前端处理登出,新增查询用户信息功能,修改查询用户地址列表功能,现在用户只能看到自己的地址列表
This commit is contained in:
@@ -13,6 +13,7 @@ import icu.sunway.ai_spring_example.pojo.Dto.UserDTO;
|
||||
import icu.sunway.ai_spring_example.pojo.Entity.User;
|
||||
import icu.sunway.ai_spring_example.pojo.Entity.UserAddress;
|
||||
import icu.sunway.ai_spring_example.pojo.Vo.UserLoginVO;
|
||||
import icu.sunway.ai_spring_example.pojo.Vo.UserVO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -61,10 +62,10 @@ public class UserController {
|
||||
return ResponseEntity.success(userLoginVO);
|
||||
}
|
||||
|
||||
@PostMapping("/logout")
|
||||
public ResponseEntity<String> logout(){
|
||||
return ResponseEntity.success("注销成功");
|
||||
}
|
||||
// @PostMapping("/logout")
|
||||
// public ResponseEntity<String> logout(){
|
||||
// return ResponseEntity.success("注销成功");
|
||||
// }
|
||||
|
||||
@PostMapping("/register")
|
||||
public ResponseEntity register(@RequestBody UserDTO userDTO){
|
||||
@@ -78,6 +79,13 @@ public class UserController {
|
||||
return ResponseEntity.success("注册成功");
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/profile/{id}")
|
||||
public ResponseEntity<User> profile(@PathVariable Long id){
|
||||
log.info("查询用户信息: id={}", id);
|
||||
return ResponseEntity.success(userService.getById(id));
|
||||
}
|
||||
|
||||
@PutMapping("/update")
|
||||
public ResponseEntity update(@RequestBody UserDTO userDTO){
|
||||
log.info("编辑用户信息:{}",userDTO);
|
||||
|
||||
@@ -133,6 +133,8 @@ public class UserAddressServiceImpl extends ServiceImpl<UserAddressMapper, UserA
|
||||
throw new BusinessException(MessageConstant.PARAM_ERROR);
|
||||
}
|
||||
QueryWrapper<UserAddress> queryWrapper = new QueryWrapper<>();
|
||||
queryWrapper.eq("user_id", userId)
|
||||
.eq("is_deleted", 0);
|
||||
return userAddressMapper.selectList(queryWrapper);
|
||||
}
|
||||
|
||||
|
||||
@@ -8,6 +8,7 @@ import icu.sunway.ai_spring_example.Mapper.UserMapper;
|
||||
import icu.sunway.ai_spring_example.Service.UserService;
|
||||
import icu.sunway.ai_spring_example.pojo.Dto.UserDTO;
|
||||
import icu.sunway.ai_spring_example.pojo.Entity.User;
|
||||
import icu.sunway.ai_spring_example.pojo.Vo.UserVO;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -51,4 +52,5 @@ public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements Us
|
||||
BeanUtils.copyProperties(userDTO,user);
|
||||
userMapper.update(user);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package icu.sunway.ai_spring_example.Service;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import icu.sunway.ai_spring_example.pojo.Dto.UserDTO;
|
||||
import icu.sunway.ai_spring_example.pojo.Entity.User;
|
||||
import icu.sunway.ai_spring_example.pojo.Vo.UserVO;
|
||||
|
||||
public interface UserService extends IService<User> {
|
||||
|
||||
@@ -17,4 +18,5 @@ public interface UserService extends IService<User> {
|
||||
* @param userDTO 用户更新信息
|
||||
*/
|
||||
void update(UserDTO userDTO);
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user