package com.xkrs.dao; import com.xkrs.model.entity.StreetEntity; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Component; import java.util.List; import java.util.Map; @Component public interface StreetDao extends JpaRepository, JpaSpecificationExecutor { List findByProName(String proName); List findByProCode(String proCode); List findByCityName(String cityName); List findByCityCode(String cityCode); List findByCountyName(String countyName); List findByCountyCode(String countyCode); List findByStreetName(String streetName); List findByStreetCode(String streetCode); @Query(value = "SELECT DISTINCT t.pro_code AS code, t.pro_name AS name FROM street AS t", nativeQuery = true) List> selectProvinceList(); @Query(value = "SELECT DISTINCT t.city_code AS code, t.city_name AS name FROM street AS t WHERE t.pro_code = ?1", nativeQuery = true) List> selectCityList(String provinceCode); @Query(value = "SELECT DISTINCT t.county_code AS code, t.county_name AS name FROM street AS t WHERE t.city_code = ?1", nativeQuery = true) List> selectCountyList(String cityCode); @Query(value = "SELECT DISTINCT t.street_code AS code, t.street_name AS name FROM street AS t WHERE t.county_code = ?1", nativeQuery = true) List> selectStreetList(String countyCode); }