赞
踩
url地址:http://localhost:8877/graphiql
url地址:http://localhost:8080/graphql
请求方式:post
两个链接中一个是graphiql
,另一个是graphql
查询接口:大括号前面加query,或者省略
{
dong1 {
dType
emailId
}
}
后端graphql文件配置
type Query{
dong1:Dong1Result
}
type Dong1Result{
dType:String
emailId:String
}
query{
dong2(email:"00",num: 20, flag: false,stuFilter:{name:String,age:Int}) {
dType
emailId
stu{name age}
}
}
type
后端graphql文件配置如下:
type Query{ dong2(email:String,num:Int,flag:Boolean,stuFilter:StuFilter):[Dong2Result] } input StuFilter{ name:String age:Int } type Dong2Result{ dType:String emailId:String stu:Stu } type Stu{ name:String age:Int }
参数email为String类型,num为整形,flag为boolean
新增/修改/删除,这三种操作都用mutation
mutation{
saveDong2(tokenEntity:{emailId:"123",dType:"add"}) {
dType
emailId
}
}
对应的后端接口如下:
@DgsMutation
public TokenEntity saveDong2(TokenEntity tokenEntity) {
return tokenEntity;
}
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。