JPA Query in 集合(:和?传参)

发布时间 2023-08-06 16:44:09作者: 且行且思

? 传参

    @Query(value = "SELECT * FROM tuxinggeo AS sti WHERE type = ?1 AND index = ?2", nativeQuery = true)
    List<TuxingGeo> getLayerByTypeAndIndex(int type, int index);

: 传参

    @Query(value = "SELECT * FROM tuxinggeo AS sti WHERE type = :sti_type AND index = :sti_index AND town in (:townlist) ", nativeQuery = true)
    List<TuxingGeo> getLayerByTypeAndIndex2(@Param("sti_type") int sti_type,@Param("sti_index") int sti_index,@Param("townlist") String[] townlist);