package com.bonus.material.project.service.impl;


import com.bonus.material.project.mapper.RegionMapper;
import com.bonus.material.project.service.RegionService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;
import java.util.Map;


/**
 * @author 30791
 * @version 1.0
 * Create by 2025/11/13 11:25
 */

@Service
public class RegionServiceImpl implements RegionService {
    @Resource
    private RegionMapper regionMapper;

    @Override
    public List<Map<String, Object>> getProvinces() {
        return regionMapper.selectAllProvinces();
    }

    // 调用Mapper的「根据省area_code查询城市」方法
    @Override
    public List<Map<String, Object>> getCitiesByProvinceAreaCode(String provinceAreaCode) {
        return regionMapper.selectCitiesByProvinceId(provinceAreaCode);
    }

    // 调用Mapper的「根据市area_code查询区县」方法
    @Override
    public List<Map<String, Object>> getDistrictsByCityAreaCode(String cityAreaCode) {
        return regionMapper.selectDistrictsByCityId(cityAreaCode);
    }

    //获取地区名称
    public String getNameByCode(String area_code) {
        return regionMapper.getNameByCode(area_code);
    }


    public String getShortNameByCode(String area_code) {
        return regionMapper.getShortNameByCode(area_code);
    }
}
