修复以为默认地址表示为空导致的异常

This commit is contained in:
pan.zheng 2021-03-09 14:15:47 +08:00
parent b01367fb2a
commit 752d490201

View File

@ -26,6 +26,7 @@ public class AddressController {
private IUmsAddressService iUmsAddressService; private IUmsAddressService iUmsAddressService;
private final Integer ADDRESS_DEFAULTED = 1;
@ApiOperation(value = "获取当前登录会员的地址列表", httpMethod = "GET") @ApiOperation(value = "获取当前登录会员的地址列表", httpMethod = "GET")
@GetMapping @GetMapping
@ -44,7 +45,7 @@ public class AddressController {
public Result add(@RequestBody UmsAddress address) { public Result add(@RequestBody UmsAddress address) {
Long userId = RequestUtils.getUserId(); Long userId = RequestUtils.getUserId();
address.setUserId(userId); address.setUserId(userId);
if (address.getDefaulted().equals(1)) { // 修改其他默认地址为非默认 if (ADDRESS_DEFAULTED.equals(address.getDefaulted())) { // 修改其他默认地址为非默认
iUmsAddressService.update(new LambdaUpdateWrapper<UmsAddress>() iUmsAddressService.update(new LambdaUpdateWrapper<UmsAddress>()
.eq(UmsAddress::getUserId, userId) .eq(UmsAddress::getUserId, userId)
.eq(UmsAddress::getDefaulted, 1) .eq(UmsAddress::getDefaulted, 1)