package com.sysu.admin.controller.city;

import com.xiesx.fastboot.core.jpa.JpaPlusRepository;
import org.springframework.data.jpa.repository.Query;

import java.util.List;

public interface CityRepository extends JpaPlusRepository<City, Integer> {
    City findByCode(String code);

    @Query(value = "Select new City(p.name,p.code,p.area, p.geom) from City p where p.code like ?1 ")
    List<City> findListByCode(String likeCode);

    @Query(value = "Select new City(p.name,p.code,p.area) from City p where p.code like ?1 ")
    List<City> findListInfoByCode(String likeCode);

    @Query(value = "select st_astext(geom) from p_city where code = ?1" ,nativeQuery = true)
    String findWktByCode(String code);

}
