|
@@ -1,6 +1,7 @@
|
|
|
package cn.iocoder.yudao.module.member.controller.app.address;
|
|
|
|
|
|
import cn.iocoder.yudao.framework.common.pojo.CommonResult;
|
|
|
+import cn.iocoder.yudao.framework.security.core.annotations.PreAuthenticated;
|
|
|
import cn.iocoder.yudao.module.member.controller.app.address.vo.AppAddressCreateReqVO;
|
|
|
import cn.iocoder.yudao.module.member.controller.app.address.vo.AppAddressRespVO;
|
|
|
import cn.iocoder.yudao.module.member.controller.app.address.vo.AppAddressUpdateReqVO;
|
|
@@ -31,12 +32,14 @@ public class AppAddressController {
|
|
|
|
|
|
@PostMapping("/create")
|
|
|
@Operation(summary = "创建用户收件地址")
|
|
|
+ @PreAuthenticated
|
|
|
public CommonResult<Long> createAddress(@Valid @RequestBody AppAddressCreateReqVO createReqVO) {
|
|
|
return success(addressService.createAddress(getLoginUserId(), createReqVO));
|
|
|
}
|
|
|
|
|
|
@PutMapping("/update")
|
|
|
@Operation(summary = "更新用户收件地址")
|
|
|
+ @PreAuthenticated
|
|
|
public CommonResult<Boolean> updateAddress(@Valid @RequestBody AppAddressUpdateReqVO updateReqVO) {
|
|
|
addressService.updateAddress(getLoginUserId(), updateReqVO);
|
|
|
return success(true);
|
|
@@ -45,6 +48,7 @@ public class AppAddressController {
|
|
|
@DeleteMapping("/delete")
|
|
|
@Operation(summary = "删除用户收件地址")
|
|
|
@Parameter(name = "id", description = "编号", required = true)
|
|
|
+ @PreAuthenticated
|
|
|
public CommonResult<Boolean> deleteAddress(@RequestParam("id") Long id) {
|
|
|
addressService.deleteAddress(getLoginUserId(), id);
|
|
|
return success(true);
|
|
@@ -53,6 +57,7 @@ public class AppAddressController {
|
|
|
@GetMapping("/get")
|
|
|
@Operation(summary = "获得用户收件地址")
|
|
|
@Parameter(name = "id", description = "编号", required = true, example = "1024")
|
|
|
+ @PreAuthenticated
|
|
|
public CommonResult<AppAddressRespVO> getAddress(@RequestParam("id") Long id) {
|
|
|
MemberAddressDO address = addressService.getAddress(getLoginUserId(), id);
|
|
|
return success(AddressConvert.INSTANCE.convert(address));
|
|
@@ -60,6 +65,7 @@ public class AppAddressController {
|
|
|
|
|
|
@GetMapping("/get-default")
|
|
|
@Operation(summary = "获得默认的用户收件地址")
|
|
|
+ @PreAuthenticated
|
|
|
public CommonResult<AppAddressRespVO> getDefaultUserAddress() {
|
|
|
MemberAddressDO address = addressService.getDefaultUserAddress(getLoginUserId());
|
|
|
return success(AddressConvert.INSTANCE.convert(address));
|
|
@@ -67,6 +73,7 @@ public class AppAddressController {
|
|
|
|
|
|
@GetMapping("/list")
|
|
|
@Operation(summary = "获得用户收件地址列表")
|
|
|
+ @PreAuthenticated
|
|
|
public CommonResult<List<AppAddressRespVO>> getAddressList() {
|
|
|
List<MemberAddressDO> list = addressService.getAddressList(getLoginUserId());
|
|
|
return success(AddressConvert.INSTANCE.convertList(list));
|