|
|
|
@ -219,14 +219,10 @@ 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, begin, conditions)
|
|
|
|
|
result, message, esdata := ES7Util.SearchDocPage(datasourceCode, orgIDs, page, begin, conditions, sort)
|
|
|
|
|
var query = "AND datasource_code='" + datasourceCode + "'"
|
|
|
|
|
res, _, data, _ := DatasourceDAO.GetDatasourceRow(query)
|
|
|
|
|
var datasourceName interface{}
|
|
|
|
|
if res == true {
|
|
|
|
|
datasourceName = data["datasource_name"]
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
var esDatas []map[string]interface{}
|
|
|
|
|
var datas []map[string]interface{}
|
|
|
|
|
// 写法2
|
|
|
|
|
//esDatas := make([]interface{}, count)
|
|
|
|
|
fmt.Println(esDatas)
|
|
|
|
@ -236,8 +232,8 @@ func ReadESDoc(datasourceCode string, orgIDs []string, page int, begin string, c
|
|
|
|
|
j, _ := json.Marshal(value)
|
|
|
|
|
json.Unmarshal(j, &esData)
|
|
|
|
|
|
|
|
|
|
esData["datasource_name"] = datasourceName
|
|
|
|
|
fmt.Println("esData:", esData)
|
|
|
|
|
//esData["datasource_name"] = datasourceName
|
|
|
|
|
//fmt.Println("esData:", esData)
|
|
|
|
|
|
|
|
|
|
esDatas = append(esDatas, esData)
|
|
|
|
|
// 写法2
|
|
|
|
@ -245,7 +241,19 @@ func ReadESDoc(datasourceCode string, orgIDs []string, page int, begin string, c
|
|
|
|
|
//esDatas[k] = esData
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return result, message, count, esDatas
|
|
|
|
|
var query = ""
|
|
|
|
|
res, _, _, datasources, _ := DatasourceDAO.GetAllDatasourceResults(query)
|
|
|
|
|
fmt.Println(datasources)
|
|
|
|
|
if res == true {
|
|
|
|
|
listJson, _ :=json.Marshal(esDatas)
|
|
|
|
|
joinListJson, _ := json.Marshal(datasources)
|
|
|
|
|
mergedesDatas := CommonUtil.ListMerge(string(listJson), string(joinListJson), "datasource_id", "datasource_code", "datasource_name", "datasource_name")
|
|
|
|
|
|
|
|
|
|
json.Unmarshal([]byte(mergedesDatas), &datas)
|
|
|
|
|
}
|
|
|
|
|
fmt.Println("datas:", datas)
|
|
|
|
|
|
|
|
|
|
return result, message, count, datas
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
//func IsDatasourceExistsByCode(code string) bool {
|
|
|
|
|