43 lines
1.7 KiB
Java
43 lines
1.7 KiB
Java
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<StreetEntity, Integer>, JpaSpecificationExecutor<StreetEntity> {
|
|
|
|
List<StreetEntity> findByProName(String proName);
|
|
|
|
List<StreetEntity> findByProCode(String proCode);
|
|
|
|
List<StreetEntity> findByCityName(String cityName);
|
|
|
|
List<StreetEntity> findByCityCode(String cityCode);
|
|
|
|
List<StreetEntity> findByCountyName(String countyName);
|
|
|
|
List<StreetEntity> findByCountyCode(String countyCode);
|
|
|
|
List<StreetEntity> findByStreetName(String streetName);
|
|
|
|
List<StreetEntity> findByStreetCode(String streetCode);
|
|
|
|
@Query(value = "SELECT DISTINCT t.pro_code AS code, t.pro_name AS name FROM street AS t", nativeQuery = true)
|
|
List<Map<String, String>> 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<Map<String, String>> 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<Map<String, String>> 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<Map<String, String>> selectStreetList(String countyCode);
|
|
}
|