From 33a7af51b1e6e3a1812f23e6f8f80f5e225564c9 Mon Sep 17 00:00:00 2001 From: sin <2943460818@qq.com> Date: Wed, 10 Apr 2019 20:49:39 +0800 Subject: [PATCH] =?UTF-8?q?-=20=E4=BF=AE=E5=A4=8D=20controller=20=E8=8E=B7?= =?UTF-8?q?=E5=8F=96=E4=B8=8D=E5=88=B0=20context=EF=BC=8C=E6=B2=A1?= =?UTF-8?q?=E8=B5=B0=E6=8B=A6=E6=88=AA=E5=99=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/users/UserAddressController.java | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/user/user-application/src/main/java/cn/iocoder/mall/user/application/controller/users/UserAddressController.java b/user/user-application/src/main/java/cn/iocoder/mall/user/application/controller/users/UserAddressController.java index 24055c9c0..38778ddc8 100644 --- a/user/user-application/src/main/java/cn/iocoder/mall/user/application/controller/users/UserAddressController.java +++ b/user/user-application/src/main/java/cn/iocoder/mall/user/application/controller/users/UserAddressController.java @@ -21,7 +21,7 @@ import org.springframework.web.bind.annotation.*; * @time 2019-04-06 14:11 */ @RestController -@RequestMapping("user/address") +@RequestMapping("users/address") @Api(description = "用户地址API") public class UserAddressController { @@ -33,7 +33,7 @@ public class UserAddressController { public CommonResult addAddress(@Validated UserAddressAddPO userAddressAddPO) { Integer userId = UserSecurityContextHolder.getContext().getUserId(); UserAddressAddDTO userAddressAddDTO = UserAddressConvert.INSTANCE.convert(userAddressAddPO); - userAddressAddDTO.setUserId(1); + userAddressAddDTO.setUserId(userId); return userAddressService.addAddress(userAddressAddDTO); } @@ -42,7 +42,7 @@ public class UserAddressController { public CommonResult updateAddress(@Validated UserAddressUpdatePO userAddressUpdatePO) { Integer userId = UserSecurityContextHolder.getContext().getUserId(); UserAddressUpdateDTO userAddressUpdateDTO = UserAddressConvert.INSTANCE.convert(userAddressUpdatePO); - userAddressUpdateDTO.setUserId(1); + userAddressUpdateDTO.setUserId(userId); return userAddressService.updateAddress(userAddressUpdateDTO); } @@ -50,20 +50,20 @@ public class UserAddressController { @ApiOperation(value = "用户地址-删除") public CommonResult removeAddress(@RequestParam("id") Integer id) { Integer userId = UserSecurityContextHolder.getContext().getUserId(); - return userAddressService.removeAddress(1, id); + return userAddressService.removeAddress(userId, id); } @GetMapping("list") @ApiOperation(value = "用户地址列表") public CommonResult addressList() { Integer userId = UserSecurityContextHolder.getContext().getUserId(); - return userAddressService.addressList(1); + return userAddressService.addressList(userId); } @GetMapping("address") @ApiOperation(value = "获取地址") public CommonResult getAddress(@RequestParam("id") Integer id) { Integer userId = UserSecurityContextHolder.getContext().getUserId(); - return userAddressService.getAddress(1, id); + return userAddressService.getAddress(userId, id); } }