Browse Source

add:指标筛选

zqbao 6 months ago
parent
commit
b6a4c135b9

+ 7 - 165
controllers/data_manage/stl/stl.go

@@ -4,17 +4,10 @@ import (
 	"encoding/json"
 	"eta/eta_api/controllers"
 	"eta/eta_api/models"
-	"eta/eta_api/services/data/data_manage_permission"
 	"eta/eta_api/services/data/stl"
-	"eta/eta_api/services/elastic"
 	"eta/eta_api/utils"
-	"strings"
-	"time"
 
-	"eta/eta_api/models/data_manage"
 	"eta/eta_api/models/data_manage/stl/request"
-
-	"github.com/rdlucklib/rdluck_tools/paging"
 )
 
 type STLController struct {
@@ -67,9 +60,6 @@ func (c *STLController) Preview() {
 // @Title 指标筛选接口
 // @Description 指标筛选接口
 // @Param   KeyWord   query   string  false       "搜索关键词:指标ID/指标名称"
-// @Param   FilterSource   query   int  false       "搜索来源:1:其他搜索,2:累计值转月值搜索,3:变频,4:基础指标,5:同比"
-// @Param   Frequency   query   string  false       "频度"
-// @Param   IsAddPredictEdb   query   bool  false       "是否查询添加预测指标"
 // @Param   PageSize   query   int  true       "每页数据条数"
 // @Param   CurrentIndex   query   int  true       "当前页页码,从1开始"
 // @Success 200 {object} data_manage.EdbInfoList
@@ -83,172 +73,24 @@ func (this *STLController) EdbInfoFilterByEs() {
 
 	pageSize, _ := this.GetInt("PageSize")
 	currentIndex, _ := this.GetInt("CurrentIndex")
+	keyWord := this.GetString("KeyWord")
 
-	var total int64
-
-	var startSize int
 	if pageSize <= 0 {
 		pageSize = utils.PageSize20
 	}
 	if currentIndex <= 0 {
 		currentIndex = 1
 	}
-	startSize = paging.StartIndex(currentIndex, pageSize)
-
-	keyWord := this.GetString("KeyWord")
-	keyWord = strings.TrimSpace(keyWord) //移除字符串首尾空格
-
-	frequency := this.GetString("Frequency") //频度
-
-	var edbInfoList []*data_manage.EdbInfoList
-	var err error
-
-	noPermissionEdbInfoIdList := make([]int, 0) //无权限指标
-	// 获取当前账号的不可见指标
-	{
-		obj := data_manage.EdbInfoNoPermissionAdmin{}
-		confList, err := obj.GetAllListByAdminId(this.SysUser.AdminId)
-		if err != nil && err.Error() != utils.ErrNoRow() {
-			br.Msg = "获取失败"
-			br.ErrMsg = "获取不可见指标配置数据失败,Err:" + err.Error()
-			return
-		}
-		for _, v := range confList {
-			noPermissionEdbInfoIdList = append(noPermissionEdbInfoIdList, v.EdbInfoId)
-		}
-	}
-
-	// 是否走ES
-	isEs := false
-	if keyWord != "" {
-		var keyWordArr []string
-		keyWordArr = append(keyWordArr, keyWord)
-
-		newKeyWord := strings.Split(keyWord, " ")
-		keyWordArr = append(keyWordArr, newKeyWord...)
-
-		// 普通的搜索
-		total, edbInfoList, err = elastic.SearchEdbInfoData(utils.DATA_INDEX_NAME, keyWord, startSize, pageSize, filterSource, source, 0, frequency, noPermissionEdbInfoIdList)
-		isEs = true
-	} else {
-		var condition string
-		var pars []interface{}
-		// 普通指标
-		condition += ` AND edb_info_type = ? `
-		pars = append(pars, 0)
-
-		// 无权限指标id
-		lenNoPermissionEdbInfoIdList := len(noPermissionEdbInfoIdList)
-		if lenNoPermissionEdbInfoIdList > 0 {
-			condition += ` AND edb_info_id  not in (` + utils.GetOrmInReplace(lenNoPermissionEdbInfoIdList) + `) `
-			pars = append(pars, noPermissionEdbInfoIdList)
-		}
-
-		//频度
-		if frequency != "" {
-			condition += ` AND frequency = ? `
-			pars = append(pars, frequency)
-		}
-
-		total, edbInfoList, err = data_manage.GetEdbInfoFilterList(condition, pars, startSize, pageSize)
-	}
+	resp, msg, err := stl.SearchEdbInfoWithStl(this.SysUser.AdminId, keyWord, currentIndex, pageSize)
 	if err != nil {
-		edbInfoList = make([]*data_manage.EdbInfoList, 0)
-	}
-
-	page := paging.GetPaging(currentIndex, pageSize, int(total))
-
-	edbInfoListLen := len(edbInfoList)
-
-	classifyIdList := make([]int, 0)
-	for i := 0; i < edbInfoListLen; i++ {
-		edbInfoList[i].EdbNameAlias = edbInfoList[i].EdbName
-		classifyIdList = append(classifyIdList, edbInfoList[i].ClassifyId)
-	}
-
-	// 当前列表中的分类map
-	classifyMap := make(map[int]*data_manage.EdbClassify)
-	if edbInfoListLen > 0 {
-		classifyList, err := data_manage.GetEdbClassifyByIdList(classifyIdList)
-		if err != nil {
-			br.Msg = "获取失败"
-			br.ErrMsg = "获取分类列表失败,Err:" + err.Error()
-			return
-		}
-
-		for _, v := range classifyList {
-			classifyMap[v.ClassifyId] = v
-		}
-
-		// 获取所有有权限的指标和分类
-		permissionEdbIdList, permissionClassifyIdList, err := data_manage_permission.GetUserEdbAndClassifyPermissionList(this.SysUser.AdminId, 0, 0)
-		if err != nil {
-			br.Msg = "获取失败"
-			br.ErrMsg = "获取所有有权限的指标和分类失败,Err:" + err.Error()
-			return
-		}
-
-		// 如果是ES的话,需要重新查一下指标的信息,主要是为了把是否授权字段找出来
-		if isEs {
-			edbInfoIdList := make([]int, 0)
-			for i := 0; i < edbInfoListLen; i++ {
-				edbInfoIdList = append(edbInfoIdList, edbInfoList[i].EdbInfoId)
-				tmpEdbInfo := edbInfoList[i]
-				if currClassify, ok := classifyMap[tmpEdbInfo.ClassifyId]; ok {
-					edbInfoList[i].HaveOperaAuth = data_manage_permission.CheckEdbPermissionByPermissionIdList(tmpEdbInfo.IsJoinPermission, currClassify.IsJoinPermission, tmpEdbInfo.EdbInfoId, tmpEdbInfo.ClassifyId, permissionEdbIdList, permissionClassifyIdList)
-				}
-			}
-
-			tmpEdbList, err := data_manage.GetEdbInfoByIdList(edbInfoIdList)
-			if err != nil {
-				br.Msg = "获取失败"
-				br.ErrMsg = "获取所有有权限的指标失败,Err:" + err.Error()
-				return
-			}
-			edbInfoMap := make(map[int]*data_manage.EdbInfo)
-			for _, v := range tmpEdbList {
-				edbInfoMap[v.EdbInfoId] = v
-			}
-
-			for i := 0; i < edbInfoListLen; i++ {
-				tmpEdbInfo, ok := edbInfoMap[edbInfoList[i].EdbInfoId]
-				if !ok {
-					continue
-				}
-				edbInfoList[i].IsJoinPermission = tmpEdbInfo.IsJoinPermission
-			}
-		}
-
-		// 权限校验
-		for i := 0; i < edbInfoListLen; i++ {
-			tmpEdbInfoItem := edbInfoList[i]
-			if currClassify, ok := classifyMap[tmpEdbInfoItem.ClassifyId]; ok {
-				edbInfoList[i].HaveOperaAuth = data_manage_permission.CheckEdbPermissionByPermissionIdList(tmpEdbInfoItem.IsJoinPermission, currClassify.IsJoinPermission, tmpEdbInfoItem.EdbInfoId, tmpEdbInfoItem.ClassifyId, permissionEdbIdList, permissionClassifyIdList)
-			}
-		}
-	}
-
-	for i := 0; i < edbInfoListLen; i++ {
-		for j := 0; j < edbInfoListLen; j++ {
-			if (edbInfoList[i].EdbNameAlias == edbInfoList[j].EdbNameAlias) &&
-				(edbInfoList[i].EdbInfoId != edbInfoList[j].EdbInfoId) &&
-				!(strings.Contains(edbInfoList[i].EdbName, edbInfoList[i].SourceName)) {
-				edbInfoList[i].EdbName = edbInfoList[i].EdbName + "(" + edbInfoList[i].SourceName + ")"
-			}
+		if msg == "" {
+			msg = "获取异常"
 		}
-	}
-	//新增搜索词记录
-	{
-		searchKeyword := new(data_manage.SearchKeyword)
-		searchKeyword.KeyWord = keyWord
-		searchKeyword.CreateTime = time.Now()
-		go data_manage.AddSearchKeyword(searchKeyword)
+		br.Msg = msg
+		br.ErrMsg = err.Error()
+		return
 	}
 
-	resp := data_manage.EdbInfoFilterDataResp{
-		Paging: page,
-		List:   edbInfoList,
-	}
 	br.Ret = 200
 	br.Success = true
 	br.Msg = "获取成功"

+ 0 - 3
models/data_manage/stl/request/stl.go

@@ -15,6 +15,3 @@ type STLReq struct {
 	SeasonalDeg   int     `description:"分解中季节性多项次数,默认为1,不超过5的正整数"`
 	LowPassDeg    int     `description:"分解中低通滤波器次数,默认为1,不超过5的正整数"`
 }
-
-type EdbInfoSearch struct {
-}

+ 9 - 0
routers/commentsRouter.go

@@ -2311,6 +2311,15 @@ func init() {
             Filters: nil,
             Params: nil})
 
+    beego.GlobalControllerRouter["eta/eta_api/controllers/data_manage/stl:STLController"] = append(beego.GlobalControllerRouter["eta/eta_api/controllers/data_manage/stl:STLController"],
+        beego.ControllerComments{
+            Method: "EdbInfoFilterByEs",
+            Router: `/edb_info/search`,
+            AllowHTTPMethods: []string{"get"},
+            MethodParams: param.Make(),
+            Filters: nil,
+            Params: nil})
+
     beego.GlobalControllerRouter["eta/eta_api/controllers/data_manage/supply_analysis:VarietyController"] = append(beego.GlobalControllerRouter["eta/eta_api/controllers/data_manage/supply_analysis:VarietyController"],
         beego.ControllerComments{
             Method: "Add",

+ 27 - 264
services/data/stl/stl.go

@@ -6,6 +6,7 @@ import (
 	"eta/eta_api/models/data_manage/stl/request"
 	"eta/eta_api/models/data_manage/stl/response"
 	"eta/eta_api/services/data/data_manage_permission"
+	"eta/eta_api/services/elastic"
 	"eta/eta_api/utils"
 	"fmt"
 	"os"
@@ -15,7 +16,6 @@ import (
 	"strings"
 	"time"
 
-	"github.com/olivere/elastic"
 	"github.com/rdlucklib/rdluck_tools/paging"
 	"github.com/tealeg/xlsx"
 )
@@ -161,17 +161,6 @@ func GenerateStlEdbData(req *request.STLReq, adminId int) (resp *response.StlPre
 	return
 }
 
-func EdbInfoSearch(req *request.EdbInfoSearchReq) (resp *response.EdbInfoSearchResp, msg string, err error) {
-	edbInfoList, err := data_manage.GetEdbInfoListByCondition(req.Keyword, req.Source, req.SubSource)
-	if err != nil {
-		msg = "获取指标列表失败"
-		return
-	}
-	resp = new(response.EdbInfoSearchResp)
-	resp.EdbInfoList = edbInfoList
-	return
-}
-
 func formatEdbData(items []*data_manage.EdbData) []*response.EdbData {
 	res := make([]*response.EdbData, 0, len(items))
 	for _, item := range items {
@@ -365,8 +354,7 @@ print(output)
 	return
 }
 
-func SearchEdbInfoWithStl(adminId int, keyWord string) (msg string, err error) {
-
+func SearchEdbInfoWithStl(adminId int, keyWord string, currentIndex, pageSize int) (resp data_manage.EdbInfoFilterDataResp, msg string, err error) {
 	var edbInfoList []*data_manage.EdbInfoList
 
 	noPermissionEdbInfoIdList := make([]int, 0) //无权限指标
@@ -374,7 +362,7 @@ func SearchEdbInfoWithStl(adminId int, keyWord string) (msg string, err error) {
 	{
 		obj := data_manage.EdbInfoNoPermissionAdmin{}
 		confList, er := obj.GetAllListByAdminId(adminId)
-		if er != nil && err.Error() != utils.ErrNoRow() {
+		if er != nil && er.Error() != utils.ErrNoRow() {
 			msg = "获取失败"
 			err = fmt.Errorf("获取不可见指标配置数据失败,Err:" + er.Error())
 			return
@@ -383,18 +371,24 @@ func SearchEdbInfoWithStl(adminId int, keyWord string) (msg string, err error) {
 			noPermissionEdbInfoIdList = append(noPermissionEdbInfoIdList, v.EdbInfoId)
 		}
 	}
+	if currentIndex <= 0 {
+		currentIndex = 1
+	}
+	startSize := utils.StartIndex(currentIndex, pageSize)
 
 	// 是否走ES
 	isEs := false
+	var total int64
 	if keyWord != "" {
 		var keyWordArr []string
 		keyWordArr = append(keyWordArr, keyWord)
 
 		newKeyWord := strings.Split(keyWord, " ")
 		keyWordArr = append(keyWordArr, newKeyWord...)
+		frequencyList := []string{"日度", "周度", "旬度", "月度", "季度"}
 
 		// 普通的搜索
-		total, edbInfoList, err = elastic.SearchEdbInfoData(utils.DATA_INDEX_NAME, keyWord, startSize, pageSize, filterSource, source, 0, frequency, noPermissionEdbInfoIdList)
+		total, edbInfoList, err = elastic.SearchEdbInfoDataByfrequency(utils.DATA_INDEX_NAME, keyWord, startSize, pageSize, 0, frequencyList, noPermissionEdbInfoIdList)
 		isEs = true
 	} else {
 		var condition string
@@ -411,10 +405,7 @@ func SearchEdbInfoWithStl(adminId int, keyWord string) (msg string, err error) {
 		}
 
 		//频度
-		if frequency != "" {
-			condition += ` AND frequency = ? `
-			pars = append(pars, frequency)
-		}
+		condition += ` AND frequency IN ('日度', '周度', '旬度', '月度', '季度') `
 
 		total, edbInfoList, err = data_manage.GetEdbInfoFilterList(condition, pars, startSize, pageSize)
 	}
@@ -435,10 +426,10 @@ func SearchEdbInfoWithStl(adminId int, keyWord string) (msg string, err error) {
 	// 当前列表中的分类map
 	classifyMap := make(map[int]*data_manage.EdbClassify)
 	if edbInfoListLen > 0 {
-		classifyList, err := data_manage.GetEdbClassifyByIdList(classifyIdList)
-		if err != nil {
-			br.Msg = "获取失败"
-			br.ErrMsg = "获取分类列表失败,Err:" + err.Error()
+		classifyList, er := data_manage.GetEdbClassifyByIdList(classifyIdList)
+		if er != nil {
+			msg = "获取失败"
+			err = fmt.Errorf("获取分类列表失败,Err:" + er.Error())
 			return
 		}
 
@@ -447,10 +438,10 @@ func SearchEdbInfoWithStl(adminId int, keyWord string) (msg string, err error) {
 		}
 
 		// 获取所有有权限的指标和分类
-		permissionEdbIdList, permissionClassifyIdList, err := data_manage_permission.GetUserEdbAndClassifyPermissionList(this.SysUser.AdminId, 0, 0)
-		if err != nil {
-			br.Msg = "获取失败"
-			br.ErrMsg = "获取所有有权限的指标和分类失败,Err:" + err.Error()
+		permissionEdbIdList, permissionClassifyIdList, er := data_manage_permission.GetUserEdbAndClassifyPermissionList(adminId, 0, 0)
+		if er != nil {
+			msg = "获取失败"
+			err = fmt.Errorf("获取所有有权限的指标和分类失败,Err:" + er.Error())
 			return
 		}
 
@@ -465,10 +456,10 @@ func SearchEdbInfoWithStl(adminId int, keyWord string) (msg string, err error) {
 				}
 			}
 
-			tmpEdbList, err := data_manage.GetEdbInfoByIdList(edbInfoIdList)
-			if err != nil {
-				br.Msg = "获取失败"
-				br.ErrMsg = "获取所有有权限的指标失败,Err:" + err.Error()
+			tmpEdbList, er := data_manage.GetEdbInfoByIdList(edbInfoIdList)
+			if er != nil {
+				msg = "获取失败"
+				err = fmt.Errorf("获取所有有权限的指标失败,Err:" + er.Error())
 				return
 			}
 			edbInfoMap := make(map[int]*data_manage.EdbInfo)
@@ -510,237 +501,9 @@ func SearchEdbInfoWithStl(adminId int, keyWord string) (msg string, err error) {
 		searchKeyword.CreateTime = time.Now()
 		go data_manage.AddSearchKeyword(searchKeyword)
 	}
-}
-
-// SearchEdbInfoData 查询es中的指标数据
-func SearchEdbInfoData(indexName, keywordStr string, from, size, filterSource, source int, edbInfoType int8, frequency string, noPermissionEdbInfoIdList []int) (total int64, list []*data_manage.EdbInfoList, err error) {
-	list = make([]*data_manage.EdbInfoList, 0)
-	defer func() {
-		if err != nil {
-			fmt.Println("EsAddOrEditData Err:", err.Error())
-		}
-	}()
-
-	highlight := elastic.NewHighlight()
-	highlight = highlight.Fields(elastic.NewHighlighterField("EdbCode"), elastic.NewHighlighterField("EdbName"))
-	highlight = highlight.PreTags("<font color='red'>").PostTags("</font>")
-
-	//var source map[string]interface{}
-	//source := map[string]interface{}{
-	//	"query": map[string]interface{}{
-	//		"match_all": map[string]interface{}{},
-	//	},
-	//}
-	mustMap := make([]interface{}, 0)
-	mustNotMap := make([]interface{}, 0)
-
-	//source := map[string]interface{}{
-	//	"query": map[string]interface{}{
-	//		"bool": map[string]interface{}{
-	//			"must": map[string]interface{}{
-	//				"query_string": map[string]interface{}{
-	//					"query":  keywordStr,
-	//					"fields": []string{"EdbCode", "EdbName"},
-	//				},
-	//			},
-	//		},
-	//	},
-	//}
-
-	switch filterSource {
-	case 2:
-		//source = map[string]interface{}{
-		//	"query": map[string]interface{}{
-		//		"bool": map[string]interface{}{
-		//			"must": map[string]interface{}{
-		//				"query_string": map[string]interface{}{
-		//					"query": keywordStr,
-		//				},
-		//			},
-		//			"filter": []interface{}{
-		//				map[string]interface{}{
-		//					"term": map[string]interface{}{
-		//						"Frequency.keyword": "月度",
-		//					},
-		//				}},
-		//		},
-		//	},
-		//}
-		mustMap = []interface{}{
-			map[string]interface{}{
-				"term": map[string]interface{}{
-					"Frequency.keyword": "月度",
-					//"Frequency.keyword": "月度",
-				},
-			},
-		}
-	case 3:
-		//source = map[string]interface{}{
-		//	"query": map[string]interface{}{
-		//		"bool": map[string]interface{}{
-		//			"must": map[string]interface{}{
-		//				"query_string": map[string]interface{}{
-		//					"query": keywordStr,
-		//				},
-		//			},
-		//			"must_not": []interface{}{
-		//				map[string]interface{}{
-		//					"match": map[string]interface{}{
-		//						"Frequency.keyword": "日度",
-		//					},
-		//				}},
-		//		},
-		//	},
-		//}
-
-		////注释掉,所有频度都可以变频 2022-08-31 14:31:28
-		//mustNotMap = []interface{}{
-		//	map[string]interface{}{
-		//		"match": map[string]interface{}{
-		//			"Frequency.keyword": "日度",
-		//			//"Frequency.keyword": "月度",
-		//		},
-		//	},
-		//}
-	case 4:
-		//source = map[string]interface{}{
-		//	"query": map[string]interface{}{
-		//		"bool": map[string]interface{}{
-		//			"must": map[string]interface{}{
-		//				"query_string": map[string]interface{}{
-		//					"query": keywordStr,
-		//				},
-		//			},
-		//			"filter": []interface{}{
-		//				map[string]interface{}{
-		//					"term": map[string]interface{}{
-		//						"EdbType": 1,
-		//					},
-		//				}},
-		//		},
-		//	},
-		//}
-		mustMap = []interface{}{
-			map[string]interface{}{
-				"term": map[string]interface{}{
-					"EdbType": 1,
-				},
-			},
-		}
-	case 5:
-		mustMap = []interface{}{
-			map[string]interface{}{
-				"term": map[string]interface{}{
-					"Source": 6,
-				},
-			},
-		}
-	case 6:
-		mustNotMap = []interface{}{
-			map[string]interface{}{
-				"match": map[string]interface{}{
-					"Frequency.keyword": "年度",
-				},
-			},
-		}
-	}
-
-	//指标来源
-	if source > 0 {
-		mustMap = append(mustMap, map[string]interface{}{
-			"term": map[string]interface{}{
-				"Source": source,
-				//"Frequency.keyword": "月度",
-			},
-		})
-	}
-
-	if frequency != "" {
-		mustMap = append(mustMap, map[string]interface{}{
-			"term": map[string]interface{}{
-				"Frequency.keyword": frequency,
-				//"Frequency.keyword": "月度",
-			},
-		})
-	}
-
-	// noPermissionEdbInfoIdList 无权限指标id
-	if len(noPermissionEdbInfoIdList) > 0 {
-		mustNotMap = append(mustNotMap, map[string]interface{}{
-			"terms": map[string]interface{}{
-				"EdbInfoId": noPermissionEdbInfoIdList,
-				//"Frequency.keyword": "月度",
-			},
-		})
-	}
-
-	// 指标类型:普通指标、预测指标(小于0 代表不区分指标是普通还是预测)
-	if edbInfoType >= 0 {
-		mustMap = append(mustMap, map[string]interface{}{
-			"term": map[string]interface{}{
-				"EdbInfoType": edbInfoType,
-			},
-		})
+	resp = data_manage.EdbInfoFilterDataResp{
+		Paging: page,
+		List:   edbInfoList,
 	}
-
-	//普通指标
-	//mustMap = append(mustMap, map[string]interface{}{
-	//	"term": map[string]interface{}{
-	//		"EdbInfoType": 0,
-	//		//"Frequency.keyword": "月度",
-	//	},
-	//})
-
-	//关键字匹配
-	//shouldMap := map[string]interface{}{
-	//	"should": []interface{}{
-	//		map[string]interface{}{
-	//			"match": map[string]interface{}{
-	//				"EdbCode": keywordStr,
-	//				//"Frequency.keyword": "月度",
-	//			},
-	//		},
-	//		map[string]interface{}{
-	//			"match": map[string]interface{}{
-	//				"EdbName": keywordStr,
-	//				//"Frequency.keyword": "月度",
-	//			},
-	//		},
-	//		map[string]interface{}{
-	//			"match": map[string]interface{}{
-	//				"EdbNameEn": keywordStr,
-	//				//"Frequency.keyword": "月度",
-	//			},
-	//		},
-	//	},
-	//}
-
-	// 默认使用中文名字字段去匹配
-	keywordNameKey := `EdbName`
-	// 如果没有中文,则使用英文名称字段去匹配
-	if !utils.ContainsChinese(keywordStr) {
-		keywordNameKey = `EdbNameEn`
-	}
-	shouldMap := map[string]interface{}{
-		"should": []interface{}{
-			map[string]interface{}{
-				"match": map[string]interface{}{
-					"EdbCode": keywordStr,
-					//"Frequency.keyword": "月度",
-				},
-			},
-			map[string]interface{}{
-				"match": map[string]interface{}{
-					keywordNameKey: keywordStr,
-					//"Frequency.keyword": "月度",
-				},
-			},
-		},
-	}
-
-	//mustMap = append(mustMap, map[string]interface{}{
-	//	"bool": shouldMap,
-	//})
-
-	return searchEdbInfoData(indexName, mustMap, mustNotMap, shouldMap, from, size)
+	return
 }

+ 3 - 3
services/elastic/elastic.go

@@ -321,7 +321,7 @@ func SearchEdbInfoData(indexName, keywordStr string, from, size, filterSource, s
 }
 
 // SearchEdbInfoData 查询es中的指标数据
-func SearchEdbInfoDataByfrequency(indexName, keywordStr string, from, size int, edbInfoType int8, frequency string, noPermissionEdbInfoIdList []int) (total int64, list []*data_manage.EdbInfoList, err error) {
+func SearchEdbInfoDataByfrequency(indexName, keywordStr string, from, size int, edbInfoType int8, frequency []string, noPermissionEdbInfoIdList []int) (total int64, list []*data_manage.EdbInfoList, err error) {
 	list = make([]*data_manage.EdbInfoList, 0)
 	defer func() {
 		if err != nil {
@@ -332,9 +332,9 @@ func SearchEdbInfoDataByfrequency(indexName, keywordStr string, from, size int,
 	mustMap := make([]interface{}, 0)
 	mustNotMap := make([]interface{}, 0)
 
-	if frequency != "" {
+	if len(frequency) != 0 {
 		mustMap = append(mustMap, map[string]interface{}{
-			"term": map[string]interface{}{
+			"terms": map[string]interface{}{
 				"Frequency.keyword": frequency,
 				//"Frequency.keyword": "月度",
 			},