lrj
昨天 9f8395fab13ca4b230a0f7d62636e209745c91d4
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
package com.rongyichuang.dashboard.api;
 
import com.rongyichuang.dashboard.dto.response.DashboardStatsResponse;
import com.rongyichuang.dashboard.service.DashboardService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.graphql.data.method.annotation.QueryMapping;
import org.springframework.stereotype.Controller;
 
/**
 * Dashboard GraphQL API
 */
@Controller
public class DashboardGraphqlApi {
 
    private static final Logger log = LoggerFactory.getLogger(DashboardGraphqlApi.class);
 
    private final DashboardService dashboardService;
 
    public DashboardGraphqlApi(DashboardService dashboardService) {
        this.dashboardService = dashboardService;
    }
 
    /**
     * 获取Dashboard统计数据
     */
    @QueryMapping
    public DashboardStatsResponse dashboardStats() {
        log.info("获取Dashboard统计数据");
        return dashboardService.getDashboardStats();
    }
}