- 处理用户地址为空情况

pull/1/head
sin 2019-04-10 20:47:34 +08:00
parent 949848c3db
commit 1aa6efe3fc
1 changed files with 3 additions and 0 deletions

View File

@ -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());