package com.ozs.rpm.util;

import java.util.List;
import java.util.Map;

import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestParam;

import com.ozs.rpm.dto.KpiListColumnDTO;
import com.ozs.rpm.dto.mdm.MdmCreateTableDTO;
import com.ozs.rpm.dto.mdm.MdmInfoColumn;
import com.ozs.rpm.dto.mdm.MdmInfoDatabase;
import com.ozs.rpm.dto.mdm.MdmInfoTable;

/**
 * 
 * @ClassName: MdmApi
 * @Description: 数据管理服务提供接口
 * @author: Zhao You Kai
 * @date: Mar 6, 2019 10:35:33 AM
 */
// @FeignClient(name = "MdmApi",url = "http://localhost:9190")
@FeignClient(value = "mdm")
public interface MdmApi {

	@GetMapping("/mdm/kpiManage/listColumnByIds")
	List<KpiListColumnDTO> listColumnByIds(@RequestParam("ids") List<String> ids);

	/*
	 * *
	 * 
	 * @Author jade
	 * 
	 * @Description 获取已建数据库列表选项
	 * 
	 * @Date 2019/2/27
	 * 
	 * @Param [databaseName]
	 * 
	 * @return java.util.List<com.datau.kpim.dto.mdm.MdmInfoDatabase>
	 **/
	@GetMapping(value = "/mdm/kpiManage/listDatabase")
	List<MdmInfoDatabase> listDatabase(@RequestParam("resourceName") String databaseName);

	/*
	 * *
	 * 
	 * @Author jade
	 * 
	 * @Description 通过数据库Id获取数据表列表
	 * 
	 * @Date 2019/2/27
	 * 
	 * @Param [id]
	 * 
	 * @return java.util.List<com.datau.kpim.dto.mdm.MdmInfoTable>
	 **/
	@GetMapping(value = "/mdm/kpiManage/listTableByDatabaseId")
	List<MdmInfoTable> listTableByDatabaseId(@RequestParam("databaseId") String id);

	/*
	 * *
	 * 
	 * @Author jade
	 * 
	 * @Description 通过数据表Id获取数据表列表
	 * 
	 * @Date 2019/2/27
	 * 
	 * @Param [id]
	 * 
	 * @return java.util.List<com.datau.kpim.dto.mdm.MdmInfoColumn>
	 **/
	@GetMapping(value = "/mdm/kpiManage/listColumnByTableId")
	List<MdmInfoColumn> listColumnByTableId(@RequestParam("tableId") String id);

	/*
	 * *
	 * 
	 * @Author jade
	 * 
	 * @Description 获取数据库资源列表接口
	 * 
	 * @Date 2019/2/27
	 * 
	 * @Param [id]
	 * 
	 * @return java.util.List<com.datau.kpim.dto.mdm.KpiListColumnDTO>
	 **/
	@GetMapping(value = "/mdm/kpiManage/listColumn")
	Object listColumn(@RequestParam("resourceType") String resourceType, @RequestParam("databaseId") String databaseId,
			@RequestParam("tableId") String tableId, @RequestParam("page") Integer page,
			@RequestParam("sort") String sort, @RequestParam("order") String order,
			@RequestParam("pageSize") Integer pageSize);

	/*
	 * *
	 * 
	 * @Author jade
	 * 
	 * @Description 根据数据库ID查询表信息
	 * 
	 * @Date 2019/3/13
	 * 
	 * @Param [databaseId, tableId]
	 * 
	 * @return java.lang.Object
	 **/
	@GetMapping(value = "/mdm/kpiManage/listColumnByDatabaseId")
	List<KpiListColumnDTO> listColumnByDatabaseId(@RequestParam("databaseId") String databaseId,
			@RequestParam("tableId") String tableId);

	@PostMapping("/mdm/listData")
	public List<Map<String, Object>> listData(@RequestParam("databaseId") String databaseId,
			@RequestBody Map<String, String> sql);

	@GetMapping("/mdm/storageManage/getTableInfoById/{tableId}")
	public R<MdmCreateTableDTO> getTableInfoById(@PathVariable(name = "tableId", required = false) String tableId);

}
