更新时间:2022-12-11 17:08:51
首先,我同意那些评论无效JSON格式的人.您可以在此处查看示例 https://json.org/example.html
First, I'm agree with guy who commented that is not valid JSON format. You can see examples here https://json.org/example.html
第二,您需要创建一个对象JSON,其中包含所需的字段,例如:
Second, You need to create an object JSON which has fields needed for example:
public class UserStat es implements Serializable {
private String name;
private long count;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public long getCount() {
return count;
}
public void setCount(long count) {
this.count = count;
}
}
并在您的自定义查询中.根据这种方式,您的报酬看起来像这样:
And in your custom query. Based your return looks like on this way:
@Query("SELECT u.name, count(u) FROM User u")
public List<UserStat> findUserStat() ;