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 TownRepository extends JpaPlusRepository<Town, Integer> {


    @Query(value = "Select new Town(p.name,p.id,p.area,p.geom) from Town p where p.districtCode = ?1 ")
    List<Town> findList(String districtCode);

    @Query(value = "Select new Town(p.name,p.id,p.area) from Town p where p.districtCode = ?1 ")
    List<Town> findInfoList(String districtCode);

    @Query(value = "select st_astext(geom) from p_town where id = ?1" ,nativeQuery = true)
    String findWktById(Integer id);


}
