package cn.pluss.platform.mapper;

import cn.pluss.platform.entity.AreaCity;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * 城市区域mapper
 */
@Mapper
public  interface AreaCityMapper extends BaseMapper<AreaCity> {

    List<AreaCity> queryProvince();

    List<AreaCity> queryOnlyProvince();

    AreaCity getAreaCityByProvince(String areaCode);
    
    /**
     * @description:
     * @date: 2022/2/25 11:06 
 * @param areaCode:
 * @return java.util.List<cn.pluss.platform.entity.AreaCity>
     */
    List<AreaCity> queryCity(String areaCode);

    /**
     * 获取区域信息
     * @date: 2022/2/25 11:06
     * @param provinceName:
     * @param cityName:
     * @param areaName:
     * @param type:
     * @return java.util.Map<java.lang.String,java.lang.String>
     */
    Map<String, String> getAreaCodeByName(@Param("provinceName") String provinceName,
                                          @Param("cityName")String cityName,
                                          @Param("areaName")String areaName,
                                          @Param("type") String type);

    /**
     * 查询下级区域信息
     * @date: 2022/2/25 11:05
     * @param areaCode:
     * @return java.util.List<cn.pluss.platform.entity.AreaCity>
     */
    @Select("select id,type,areaName,parentAreaCode,areaCode from tb_pluss_area_city where parentAreaCode = #{areaCode} ")
    List<AreaCity> queryParentCode(String areaCode);
}
