首页>代码>SpringBoot Hikari多数据源(Oracle、Mysql、Impala)简单实例>/springboot_hikari/springboot_hikari/src/main/java/com/example/springboot_hikari/controller/MonitorController.java
package com.example.springboot_hikari.controller;

import com.alibaba.fastjson.JSON;
import com.example.springboot_hikari.domain.DataRecordBean;
import com.example.springboot_hikari.service.DealDataService;
import com.example.springboot_hikari.util.WebResult;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.http.HttpStatus;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author Simon
 */
@Slf4j
@RestController
@RequestMapping("/monitor")
public class MonitorController {

    @Autowired
    private DealDataService dealDataService;

    @RequestMapping("/queryImpalaCount")
    public WebResult queryImpalaCount(@RequestParam(value = "tableName", required = false) String tableName) {
        List<DataRecordBean> countList = dealDataService.queryHiveCount(tableName);
        String jsonListStr = JSON.toJSONString(countList);
        return new WebResult(String.valueOf(HttpStatus.OK.value()), HttpStatus.OK.getReasonPhrase(), jsonListStr);
    }

    @RequestMapping("/queryOracleCount")
    public WebResult queryOracleCount(@RequestParam(value = "tableName", required = false) String tableName) {
        Integer count = dealDataService.queryOracleCount(tableName);
        return new WebResult(String.valueOf(HttpStatus.OK.value()), HttpStatus.OK.getReasonPhrase(), count.toString());
    }

    @RequestMapping("/queryMysqlCount")
    public WebResult queryMySQLCount(@RequestParam(value = "tableName", required = false) String tableName) {
        Integer count = dealDataService.queryMysqlCount(tableName);
        return new WebResult(String.valueOf(HttpStatus.OK.value()), HttpStatus.OK.getReasonPhrase(), count.toString());
    }
}
最近下载更多
genyuan2014  LV3 前天
文成1116  LV21 2022年8月7日
CGmatt  LV9 2022年6月1日
1214066599  LV8 2022年4月4日
我的心情  LV1 2022年3月11日
qizl  LV8 2021年12月28日
吴文鑫  LV1 2021年12月21日
shiopaaa  LV13 2021年11月8日
woldxy  LV12 2021年10月22日
BestClever  LV32 2021年9月11日
最近浏览更多
genyuan2014  LV3 前天
WBelong  LV7 3月29日
kinggode  LV14 2022年10月19日
wangdengzhe  LV7 2022年10月5日
admire2018  LV7 2022年9月9日
wy4525  LV6 2022年8月11日
文成1116  LV21 2022年8月7日
绘飛的渔 2022年8月2日
暂无贡献等级
squarl  LV10 2022年7月25日
lichengai  LV7 2022年7月4日
顶部 客服 微信二维码 底部
>扫描二维码关注最代码为好友扫描二维码关注最代码为好友