package com.bonus.zlpt.company.service.impl;

import com.bonus.zlpt.company.domain.BaseAddress;
import com.bonus.zlpt.company.enums.AddressLevelEnum;
import com.bonus.zlpt.company.mapper.BaseAddressMapper;
import com.bonus.zlpt.company.service.BaseAddressService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class BaseAddressServiceImpl implements BaseAddressService {

    @Autowired
    private BaseAddressMapper baseAddressMapper;


    @Override
    public List<BaseAddress> selectAddress(BaseAddress baseAddress) {

        if (baseAddress == null || baseAddress.getCode() == null) {
            return baseAddressMapper.selectEconomizeAddress();
        }

        return baseAddressMapper.selectAddress(baseAddress);
    }
}
