- 处理用户地址为空情况

This commit is contained in:
sin 2019-04-10 20:47:34 +08:00
parent 949848c3db
commit 1aa6efe3fc

View File

@ -94,6 +94,9 @@ public class UserAddressServiceImpl implements UserAddressService {
@Override
public CommonResult<UserAddressBO> getAddress(Integer userId, Integer 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())) {
return ServiceExceptionUtil.error(UserErrorCodeEnum.USER_ADDRESS_IS_DELETED.getCode());