- 处理用户地址为空情况
parent
949848c3db
commit
1aa6efe3fc
|
@ -94,6 +94,9 @@ public class UserAddressServiceImpl implements UserAddressService {
|
||||||
@Override
|
@Override
|
||||||
public CommonResult<UserAddressBO> getAddress(Integer userId, Integer id) {
|
public CommonResult<UserAddressBO> getAddress(Integer userId, Integer id) {
|
||||||
UserAddressDO userAddress = userAddressMapper.selectByUserIdAndId(userId, id);
|
UserAddressDO userAddress = userAddressMapper.selectByUserIdAndId(userId, id);
|
||||||
|
if (userAddress == null) {
|
||||||
|
return ServiceExceptionUtil.error(UserErrorCodeEnum.USER_GET_ADDRESS_NOT_EXISTS.getCode());
|
||||||
|
}
|
||||||
|
|
||||||
if (DeletedStatusEnum.DELETED_YES.getValue().equals(userAddress.getDeleted())) {
|
if (DeletedStatusEnum.DELETED_YES.getValue().equals(userAddress.getDeleted())) {
|
||||||
return ServiceExceptionUtil.error(UserErrorCodeEnum.USER_ADDRESS_IS_DELETED.getCode());
|
return ServiceExceptionUtil.error(UserErrorCodeEnum.USER_ADDRESS_IS_DELETED.getCode());
|
||||||
|
|
Loading…
Reference in New Issue