|
|
|
@ -17,12 +17,25 @@ import (
|
|
|
|
|
"time"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
// ESDataContent DataContent,定义了DataContent结构信息
|
|
|
|
|
type ESDataContent struct {
|
|
|
|
|
Address string `json:"address"`
|
|
|
|
|
AreaCode string `json:"area_code"`
|
|
|
|
|
OrgName string `json:"org_name"`
|
|
|
|
|
Address string `json:"address"` // 地址
|
|
|
|
|
AreaCode string `json:"area_code"` // 区域码
|
|
|
|
|
OrgName string `json:"org_name"` // 机构名称
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @title GetDatasourceResults
|
|
|
|
|
* @Description 获取数据源集合
|
|
|
|
|
* @Author wangshuai
|
|
|
|
|
* @Date 2020-09-17
|
|
|
|
|
* @Param swag MySwagger.DatasourceSwag 查询条件
|
|
|
|
|
* @Return bool 执行结果
|
|
|
|
|
* @Return string 提示信息
|
|
|
|
|
* @Return int 数据源数量
|
|
|
|
|
* @Return []map[string]interface{} 数据源集合
|
|
|
|
|
* @Return error 错误信息
|
|
|
|
|
*/
|
|
|
|
|
func GetDatasourceResults(swag MySwagger.DatasourceSwag) (bool, string, int, []map[string]interface{}, error) {
|
|
|
|
|
var condition string
|
|
|
|
|
var conditions []string
|
|
|
|
@ -87,6 +100,16 @@ func GetDatasourceResults(swag MySwagger.DatasourceSwag) (bool, string, int, []m
|
|
|
|
|
return result, message, count, data, failResult
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* @title CreateDatasource
|
|
|
|
|
* @Description 创建数据源
|
|
|
|
|
* @Author wangshuai
|
|
|
|
|
* @Date 2020-09-17
|
|
|
|
|
* @Param model models.TDataexDatasource 数据源信息
|
|
|
|
|
* @Return bool 执行结果
|
|
|
|
|
* @Return string 提示信息
|
|
|
|
|
* @Return error 错误信息
|
|
|
|
|
*/
|
|
|
|
|
func CreateDatasource(model models.TDataexDatasource) (bool, string, error) {
|
|
|
|
|
_, e := AccessSystemDao.GetApp(model.SystemId)
|
|
|
|
|
if e != nil {
|
|
|
|
@ -180,7 +203,7 @@ func GetESDoc(datasourceCode string, dataId string) (bool, string, map[string]in
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
func ReadESDoc(datasourceCode string, orgIDs []string, page int, begin string, conditions map[string]interface{}, sort map[string]interface{}) (bool, string, int, []map[string]interface{}) {
|
|
|
|
|
count, _ := ES7Util.GetDocCount(datasourceCode, "", nil)
|
|
|
|
|
count, _ := ES7Util.GetDocCount(datasourceCode, begin, conditions)
|
|
|
|
|
fmt.Println(count)
|
|
|
|
|
result, message, esdata := ES7Util.SearchDocPage(datasourceCode, orgIDs, page, begin, conditions, sort)
|
|
|
|
|
var query = "AND datasource_code='" + datasourceCode + "'"
|
|
|
|
@ -196,7 +219,7 @@ func ReadESDoc(datasourceCode string, orgIDs []string, page int, begin string, c
|
|
|
|
|
for _, value := range esdata {
|
|
|
|
|
j, _ := json.Marshal(value)
|
|
|
|
|
json.Unmarshal(j, &esData)
|
|
|
|
|
esData = make(map[string]interface{})
|
|
|
|
|
//esData = make(map[string]interface{})
|
|
|
|
|
esData["datasource_name"] = datasourceName
|
|
|
|
|
esDatas = append(esDatas, esData)
|
|
|
|
|
}
|
|
|
|
|