我需要返回自定义响应,所以我尝试了以下查询
@Query("SELECT g.name as name,g.id as id, city as city, g.listOfEquipment as listOfEquipment,g.listOfSlot as listOfSlot" +
" FROM Gym g INNER JOIN g.city as city " +
"WHERE city.id=:cityId")
List<Map<String, Object>> listing(@Param("cityId") Integer cityId, Pageable pageable);
您可以看到我的意图是返回city
和listOfEquipment
以及listOfSlot
。
我认为这会有效,但不幸的是它不起作用
我得到了PSQLException: ERROR: syntax error at or near "."
请帮助我找到正确的方法
答案 0 :(得分:1)
尝试加入如下。
FROM Gym g INNER JOIN city
答案 1 :(得分:0)
试试这个:
@Query("SELECT g.name as name,g.id as id, g.city as city, g.listOfEquipment as
listOfEquipment, g.listOfSlot as listOfSlot" +
" FROM Gym g " +
"WHERE g.city.id=:cityId")
您的city
酒店位于健身房内,因此您可以直接到达。