peng
2025-11-07 f64693c0da5483d8670220bf3a5bf89a32e94a20
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
48
49
50
51
52
53
54
55
type News {
    id: ID!
    title: String!
    content: String
    summary: String
    coverImage: String
    author: String
    viewCount: Int!
    state: Int!
    stateName: String
    createTime: String
    updateTime: String
}
 
input NewsInput {
    id: ID
    title: String!
    content: String
    summary: String
    coverImage: String
    author: String
    state: Int = 1
}
 
type NewsPageResponse {
    content: [News!]!
    totalElements: Long!
    page: Int!
    size: Int!
}
 
extend type Query {
    # 分页查询新闻列表(管理端)
    newsList(page: Int!, size: Int!, title: String, state: Int): NewsPageResponse
    
    # 获取新闻详情(管理端)
    news(id: ID!): News
    
    # 获取已发布的新闻详情(前端展示)
    publishedNews(id: ID!): News
    
    # 获取已发布的新闻列表(前端展示)
    publishedNewsList(page: Int!, size: Int!): NewsPageResponse
}
 
extend type Mutation {
    # 保存新闻
    saveNews(input: NewsInput!): News
    
    # 删除新闻
    deleteNews(id: ID!): Boolean
    
    # 更新新闻状态
    updateNewsState(id: ID!, state: Int!): Boolean
}