初始化项目
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
package com.bigdata.controller;
|
||||
|
||||
import com.bigdata.service.PhoenixQueryService;
|
||||
import com.bigdata.util.PhoenixQueryUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* Phoenix 查询控制器
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/phoenix")
|
||||
public class PhoenixQueryController {
|
||||
|
||||
@Autowired
|
||||
private PhoenixQueryService phoenixQueryService;
|
||||
|
||||
/**
|
||||
* 查询订单列表
|
||||
* @return 订单列表
|
||||
*/
|
||||
@GetMapping("/orders")
|
||||
public List<PhoenixQueryUtil.OrderResult> getOrders() {
|
||||
return phoenixQueryService.queryOrders();
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行自定义 SQL 查询
|
||||
* @param sql SQL 查询语句
|
||||
* @return 查询结果
|
||||
*/
|
||||
@PostMapping("/query")
|
||||
public List<Map<String, Object>> executeQuery(@RequestParam String sql) {
|
||||
return phoenixQueryService.executeCustomQuery(sql);
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用 GET 方式执行查询(用于简单查询)
|
||||
* @param sql SQL 查询语句
|
||||
* @return 查询结果
|
||||
*/
|
||||
@GetMapping("/query")
|
||||
public List<Map<String, Object>> executeQueryGet(@RequestParam String sql) {
|
||||
return phoenixQueryService.executeCustomQuery(sql);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user