package com.cool.store.service.ad.impl;

import com.cool.store.dao.ad.AdDistrictDAO;
import com.cool.store.entity.ad.AdDistrictDO;
import com.cool.store.service.ad.AdDistrictService;
import com.cool.store.utils.BeanUtil;
import com.cool.store.vo.ad.AdDistrictVO;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Objects;

/**
 * <p>
 * 行政区划 服务实现类
 * </p>
 *
 * @author wangff
 * @since 2025/10/14
 */
@Service
@RequiredArgsConstructor
public class AdDistrictServiceImpl implements AdDistrictService {
    private final AdDistrictDAO adDistrictDAO;

    @Override
    public List<AdDistrictVO> cityList(Long pid) {
        if (Objects.isNull(pid)) {
            pid = 1L;
        }
        List<AdDistrictDO> list = adDistrictDAO.getList(pid);
        return BeanUtil.toList(list, AdDistrictVO.class);
    }
}
