浏览代码

Merge branch 'feature/eta_forum3_chart_classify' into debug

xyxie 1 周之前
父节点
当前提交
1fda778f53

+ 2 - 28
controllers/data_manage/chart_info.go

@@ -2304,32 +2304,6 @@ func (this *ChartInfoController) ChartInfoSearchByEs() {
 	startSize = paging.StartIndex(currentIndex, pageSize)
 
 	keyword := this.GetString("Keyword")
-	isSelected, _ := this.GetInt("IsSelected", -1)
-	chartClassifyIds := make([]int, 0)
-	if isSelected >= 0 {
-		// 查询所有分类
-		chartClassifyList, e := data_manage.GetChartClassifyAllBySourceIsSelected(utils.CHART_SOURCE_DEFAULT, isSelected)
-		if e != nil {
-			br.Msg = "获取失败"
-			br.ErrMsg = "获取图表分类失败,Err:" + e.Error()
-			return
-		}
-		if len(chartClassifyList) == 0 {
-			page := paging.GetPaging(currentIndex, pageSize, 0)
-			resp := data_manage.ChartInfoListByEsResp{
-				Paging: page,
-				List:   make([]*data_manage.ChartInfoMore, 0),
-			}
-			br.Ret = 200
-			br.Success = true
-			br.Msg = "获取成功"
-			br.Data = resp
-			return
-		}
-		for _, v := range chartClassifyList {
-			chartClassifyIds = append(chartClassifyIds, v.ChartClassifyId)
-		}
-	}
 
 	//只看我的
 	isShowMe, _ := this.GetBool("IsShowMe")
@@ -2360,10 +2334,10 @@ func (this *ChartInfoController) ChartInfoSearchByEs() {
 	// 是否走ES
 	isEs := false
 	if keyword != "" {
-		searchList, total, err = data.EsSearchChartInfo(keyword, showSysId, []int{utils.CHART_SOURCE_DEFAULT}, noPermissionChartIdList, startSize, pageSize, chartClassifyIds)
+		searchList, total, err = data.EsSearchChartInfo(keyword, showSysId, []int{utils.CHART_SOURCE_DEFAULT}, noPermissionChartIdList, startSize, pageSize)
 		isEs = true
 	} else {
-		total, searchList, err = data_manage.ChartInfoSearchByEmptyKeyWord(showSysId, []int{utils.CHART_SOURCE_DEFAULT}, noPermissionChartIdList, startSize, pageSize, chartClassifyIds)
+		total, searchList, err = data_manage.ChartInfoSearchByEmptyKeyWord(showSysId, []int{utils.CHART_SOURCE_DEFAULT}, noPermissionChartIdList, startSize, pageSize)
 		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取图表信息失败,Err:" + err.Error()

+ 2 - 2
controllers/data_manage/correlation/correlation_chart_info.go

@@ -1965,9 +1965,9 @@ func (this *CorrelationChartInfoController) SearchByEs() {
 	}
 
 	if keyword != "" {
-		searchList, total, err = data.EsSearchChartInfo(keyword, showSysId, sourceList, noPermissionChartIdList, startSize, pageSize, []int{})
+		searchList, total, err = data.EsSearchChartInfo(keyword, showSysId, sourceList, noPermissionChartIdList, startSize, pageSize)
 	} else {
-		total, searchList, err = data_manage.ChartInfoSearchByEmptyKeyWord(showSysId, sourceList, noPermissionChartIdList, startSize, pageSize, []int{})
+		total, searchList, err = data_manage.ChartInfoSearchByEmptyKeyWord(showSysId, sourceList, noPermissionChartIdList, startSize, pageSize)
 		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取图表信息失败,Err:" + err.Error()

+ 2 - 2
controllers/data_manage/cross_variety/chart_info.go

@@ -1472,9 +1472,9 @@ func (c *ChartInfoController) SearchByEs() {
 	}
 
 	if keyword != "" {
-		searchList, total, err = data.EsSearchChartInfo(keyword, showSysId, sourceList, noPermissionChartIdList, startSize, pageSize, []int{})
+		searchList, total, err = data.EsSearchChartInfo(keyword, showSysId, sourceList, noPermissionChartIdList, startSize, pageSize)
 	} else {
-		total, searchList, err = data_manage.ChartInfoSearchByEmptyKeyWord(showSysId, sourceList, noPermissionChartIdList, startSize, pageSize, []int{})
+		total, searchList, err = data_manage.ChartInfoSearchByEmptyKeyWord(showSysId, sourceList, noPermissionChartIdList, startSize, pageSize)
 		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取图表信息失败,Err:" + err.Error()

+ 2 - 2
controllers/data_manage/future_good/future_good_chart_info.go

@@ -2411,9 +2411,9 @@ func (this *FutureGoodChartInfoController) ChartInfoSearchByEs() {
 	}
 
 	if keyword != "" {
-		searchList, total, err = data.EsSearchChartInfo(keyword, showSysId, []int{utils.CHART_SOURCE_FUTURE_GOOD, utils.CHART_SOURCE_FUTURE_GOOD_PROFIT}, noPermissionChartIdList, startSize, pageSize, []int{})
+		searchList, total, err = data.EsSearchChartInfo(keyword, showSysId, []int{utils.CHART_SOURCE_FUTURE_GOOD, utils.CHART_SOURCE_FUTURE_GOOD_PROFIT}, noPermissionChartIdList, startSize, pageSize)
 	} else {
-		total, searchList, err = data_manage.ChartInfoSearchByEmptyKeyWord(showSysId, []int{utils.CHART_SOURCE_FUTURE_GOOD, utils.CHART_SOURCE_FUTURE_GOOD_PROFIT}, noPermissionChartIdList, startSize, pageSize, []int{})
+		total, searchList, err = data_manage.ChartInfoSearchByEmptyKeyWord(showSysId, []int{utils.CHART_SOURCE_FUTURE_GOOD, utils.CHART_SOURCE_FUTURE_GOOD_PROFIT}, noPermissionChartIdList, startSize, pageSize)
 		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取图表信息失败,Err:" + err.Error()

+ 2 - 2
controllers/data_manage/line_equation/line_chart_info.go

@@ -1635,9 +1635,9 @@ func (this *LineEquationChartInfoController) SearchByEs() {
 	}
 
 	if keyword != "" {
-		searchList, total, err = data.EsSearchChartInfo(keyword, showSysId, sourceList, noPermissionChartIdList, startSize, pageSize, []int{})
+		searchList, total, err = data.EsSearchChartInfo(keyword, showSysId, sourceList, noPermissionChartIdList, startSize, pageSize)
 	} else {
-		total, searchList, err = data_manage.ChartInfoSearchByEmptyKeyWord(showSysId, sourceList, noPermissionChartIdList, startSize, pageSize, []int{})
+		total, searchList, err = data_manage.ChartInfoSearchByEmptyKeyWord(showSysId, sourceList, noPermissionChartIdList, startSize, pageSize)
 		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取图表信息失败,Err:" + err.Error()

+ 2 - 2
controllers/data_manage/line_feature/chart_info.go

@@ -2781,9 +2781,9 @@ func (this *LineFeaturesChartInfoController) SearchByEs() {
 	}
 
 	if keyword != "" {
-		searchList, total, err = data.EsSearchChartInfo(keyword, showSysId, sourceList, noPermissionChartIdList, startSize, pageSize, []int{})
+		searchList, total, err = data.EsSearchChartInfo(keyword, showSysId, sourceList, noPermissionChartIdList, startSize, pageSize)
 	} else {
-		total, searchList, err = data_manage.ChartInfoSearchByEmptyKeyWord(showSysId, sourceList, noPermissionChartIdList, startSize, pageSize, []int{})
+		total, searchList, err = data_manage.ChartInfoSearchByEmptyKeyWord(showSysId, sourceList, noPermissionChartIdList, startSize, pageSize)
 		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取图表信息失败,Err:" + err.Error()

+ 2 - 2
controllers/data_manage/range_analysis/chart_info.go

@@ -1838,9 +1838,9 @@ func (this *RangeChartChartInfoController) SearchByEs() {
 	}
 
 	if keyword != "" {
-		searchList, total, err = data.EsSearchChartInfo(keyword, showSysId, sourceList, noPermissionChartIdList, startSize, pageSize, []int{})
+		searchList, total, err = data.EsSearchChartInfo(keyword, showSysId, sourceList, noPermissionChartIdList, startSize, pageSize)
 	} else {
-		total, searchList, err = data_manage.ChartInfoSearchByEmptyKeyWord(showSysId, sourceList, noPermissionChartIdList, startSize, pageSize, []int{})
+		total, searchList, err = data_manage.ChartInfoSearchByEmptyKeyWord(showSysId, sourceList, noPermissionChartIdList, startSize, pageSize)
 		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取图表信息失败,Err:" + err.Error()

+ 2 - 2
controllers/trade_analysis/warehouse.go

@@ -1305,9 +1305,9 @@ func (this *WarehouseController) SearchByEs() {
 	}
 
 	if keyword != "" {
-		searchList, total, err = data.EsSearchChartInfo(keyword, showSysId, sourceList, noPermissionChartIdList, startSize, pageSize, []int{})
+		searchList, total, err = data.EsSearchChartInfo(keyword, showSysId, sourceList, noPermissionChartIdList, startSize, pageSize)
 	} else {
-		total, searchList, err = data_manage.ChartInfoSearchByEmptyKeyWord(showSysId, sourceList, noPermissionChartIdList, startSize, pageSize, []int{})
+		total, searchList, err = data_manage.ChartInfoSearchByEmptyKeyWord(showSysId, sourceList, noPermissionChartIdList, startSize, pageSize)
 		if err != nil && !utils.IsErrNoRow(err) {
 			br.Msg = "获取失败"
 			br.ErrMsg = "获取图表信息失败,Err:" + err.Error()

+ 1 - 7
models/data_manage/chart_info.go

@@ -1765,7 +1765,7 @@ func ChartInfoSearchByKeyWord(keyword string, showSysId int) (searchList []*Char
 }
 
 // ChartInfoSearchByEmptyKeyWord 没有关键字的时候获取默认100条数据
-func ChartInfoSearchByEmptyKeyWord(showSysId int, sourceList []int, noPermissionChartIdList []int, startSize, pageSize int, chartClassifyIds []int) (total int64, searchList []*ChartInfoMore, err error) {
+func ChartInfoSearchByEmptyKeyWord(showSysId int, sourceList []int, noPermissionChartIdList []int, startSize, pageSize int) (total int64, searchList []*ChartInfoMore, err error) {
 	num := len(sourceList)
 	o := global.DbMap[utils.DbNameIndex]
 
@@ -1784,12 +1784,6 @@ func ChartInfoSearchByEmptyKeyWord(showSysId int, sourceList []int, noPermission
 		baseSql += ` AND chart_info_id not in (` + utils.GetOrmInReplace(lenNoPermissionChartIdList) + `) `
 		basePars = append(basePars, noPermissionChartIdList)
 	}
-
-	if len(chartClassifyIds) > 0 {
-		baseSql += ` AND chart_classify_id in (` + utils.GetOrmInReplace(len(chartClassifyIds)) + `) `
-		basePars = append(basePars, chartClassifyIds)
-	}
-
 	// 查找数量
 	totalSql := " SELECT count(1) as total " + baseSql
 	err = o.Raw(totalSql, basePars...).Scan(&total).Error

+ 2 - 2
services/data/chart_info_elastic.go

@@ -125,8 +125,8 @@ func EsDeleteChartInfo(chartInfoId int) {
 }
 
 // EsSearchChartInfo 搜索图表信息
-func EsSearchChartInfo(keyword string, showSysId int, sourceList []int, noPermissionChartIdList []int, startSize, pageSize int, chartClassifyIds []int) (list []*data_manage.ChartInfoMore, total int64, err error) {
-	list, total, err = elastic.SearchChartInfoData(utils.CHART_INDEX_NAME, keyword, showSysId, sourceList, noPermissionChartIdList, startSize, pageSize, chartClassifyIds)
+func EsSearchChartInfo(keyword string, showSysId int, sourceList []int, noPermissionChartIdList []int, startSize, pageSize int) (list []*data_manage.ChartInfoMore, total int64, err error) {
+	list, total, err = elastic.SearchChartInfoData(utils.CHART_INDEX_NAME, keyword, showSysId, sourceList, noPermissionChartIdList, startSize, pageSize)
 	return
 }
 

+ 1 - 8
services/elastic/elastic.go

@@ -1101,7 +1101,7 @@ func EsDeleteDataV2(indexName, docId string) (err error) {
 }
 
 // SearchChartInfoData 查询es中的图表数据
-func SearchChartInfoData(indexName, keywordStr string, showSysId int, sourceList []int, noPermissionChartIdList []int, from, size int, chartClassifyIds []int) (list []*data_manage.ChartInfoMore, total int64, err error) {
+func SearchChartInfoData(indexName, keywordStr string, showSysId int, sourceList []int, noPermissionChartIdList []int, from, size int) (list []*data_manage.ChartInfoMore, total int64, err error) {
 	list = make([]*data_manage.ChartInfoMore, 0)
 	defer func() {
 		if err != nil {
@@ -1218,13 +1218,6 @@ func SearchChartInfoData(indexName, keywordStr string, showSysId int, sourceList
 			},
 		})
 	}
-	if len(chartClassifyIds) > 0 {
-		mustMap = append(mustMap, map[string]interface{}{
-			"terms": map[string]interface{}{
-				"ChartClassifyId": chartClassifyIds,
-			},
-		})
-	}
 
 	queryMap := map[string]interface{}{
 		"query": map[string]interface{}{