1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
| # 员工相关的GraphQL Schema定义
|
| # 员工响应类型
| type EmployeeResponse {
| id: Long!
| name: String!
| phone: String!
| roleId: String!
| description: String
| state: Int!
| createTime: String
| updateTime: String
| }
|
| # 员工输入类型
| input EmployeeInput {
| id: Long
| name: String!
| phone: String!
| password: String
| roleId: String!
| description: String
| }
|
| # 分页结果类型 - 简化版本,直接使用Spring Data Page对象
| # Spring Data的Page对象会自动映射到GraphQL
|
| # 扩展查询类型
| extend type Query {
| # 获取所有员工列表
| employees: [EmployeeResponse!]!
|
| # 根据名称搜索员工
| employeesByName(name: String): [EmployeeResponse!]!
|
| # 根据ID获取员工详情
| employee(id: Long!): EmployeeResponse
| }
|
| # 扩展变更类型
| extend type Mutation {
| # 保存员工(新增或更新)
| saveEmployee(input: EmployeeInput!): EmployeeResponse!
|
| # 删除员工
| deleteEmployee(id: Long!): Boolean!
| }
|
|