浏览代码

Merge branch 'feature/jiayue' into debug

hsun 1 年之前
父节点
当前提交
ab3ecbd3ca
共有 1 个文件被更改,包括 5 次插入4 次删除
  1. 5 4
      services/index_data/jiayue_platform.go

+ 5 - 4
services/index_data/jiayue_platform.go

@@ -160,7 +160,7 @@ func GetPageIndexesFromJiaYue(pageIndex, pageSize int, sourceArr []string, keywo
 	keyword = strings.TrimSpace(keyword)
 	if keyword != "" {
 		kw := fmt.Sprint("%", keyword, "%")
-		indexCond += ` AND (ID LIKE :1 OR CODE LIKE :1 OR NAME LIKE :1)`
+		indexCond += ` AND (ID LIKE :1 OR SOURCE_CODE LIKE :1 OR NAME LIKE :1)`
 		indexPars = append(indexPars, kw, kw, kw)
 	}
 	if frequency != "" {
@@ -266,7 +266,7 @@ func GetNewIndexAndDataFromJiaYue() (indexList []*response.IndexResp, err error)
 func FormatJiaYueIndexItem2Resp(item jiayue.DictIndex, dictData []jiayue.DictData, dictMenu []jiayue.DictCategory) (res *response.IndexResp) {
 	res = new(response.IndexResp)
 	res.Id = item.Id
-	res.IndexCode = item.Code
+	res.IndexCode = item.SourceCode // 注意这里的Code取的是表中的SOURCE_CODE
 	res.IndexName = item.Name
 	res.SourceType = item.SourceType
 	res.Unit = item.Unit
@@ -331,11 +331,12 @@ func GetJiaYueImportData(sourceArr []string) (items []JiaYueImportIndexResp, err
 	}()
 
 	// 获取指标
+	indexCond := ` 1=1`
+	indexPars := make([]interface{}, 0)
 	if len(sourceArr) == 0 {
 		sourceArr = []string{"webisite", "website", "website_gf", "platts", "reuter", "reuter_vessel_q", "路透", "bloomberg", "bloomberg_tmp", "wind", "wind_p", "wind_stop", "wind_tmp"}
 	}
-	indexCond := fmt.Sprintf(` AND SOURCE_TYPE IN (%s)`, utils.GetOracleInReplace(len(sourceArr)))
-	indexPars := make([]interface{}, 0)
+	indexCond += fmt.Sprintf(` AND SOURCE_TYPE IN (%s)`, utils.GetOracleInReplace(len(sourceArr)))
 	if len(sourceArr) > 0 {
 		for _, s := range sourceArr {
 			indexPars = append(indexPars, s)