package com.datau.kpim.service.kpiconfig;

import com.datau.kpim.dto.mdm.KpiListColumnDTO;
import com.datau.kpim.dto.mdm.MdmInfoColumn;
import com.datau.kpim.dto.mdm.MdmInfoDatabase;
import com.datau.kpim.dto.mdm.MdmInfoTable;
import com.datau.kpim.util.R;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

/* *
 * @Author jade
 * @Description 调用微服务接口
 * @Date 2019/2/27
 * @Param
 * @return
**/
//@FeignClient(name = "mdmApi",url = "http://localhost:9190")
@FeignClient(name = "mdm")
public interface MdmApi {

	/*
	 * *
	 * 
	 * @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);

	/*
	 * *
	 * 
	 * @Author jade
	 * 
	 * @Description 根据columnId列表查询字段信息
	 * 
	 * @Date 2019/3/1
	 * 
	 * @Param [ids]
	 * 
	 * @return java.util.List<com.datau.kpim.dto.mdm.KpiListColumnDTO>
	 **/
	@GetMapping("/mdm/kpiManage/listColumnByIds")
	List<KpiListColumnDTO> listColumnByIds(@RequestParam("ids") List<String> ids);

	/*
	 * *
	 * 
	 * @Author jade
	 * 
	 * @Description 查询字段详情
	 * 
	 * @Date 2019/3/11
	 * 
	 * @Param [id]
	 * 
	 * @return com.datau.kpim.util.R<com.datau.kpim.dto.mdm.MdmInfoColumn>
	 **/
	@GetMapping("/mdm/kpiManage/getColumnInfoById/{id}")
	R<MdmInfoColumn> getColumnInfoById(@RequestParam("id") String id);

}
