|
@@ -3133,6 +3133,8 @@ func (this *EdbInfoController) EdbInfoFilterByEs() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 是否走ES
|
|
|
+ isEs := false
|
|
|
if keyWord != "" {
|
|
|
var keyWordArr []string
|
|
|
keyWordArr = append(keyWordArr, keyWord)
|
|
@@ -3147,6 +3149,7 @@ func (this *EdbInfoController) EdbInfoFilterByEs() {
|
|
|
// 允许添加预测指标的搜索
|
|
|
total, edbInfoList, err = elastic.SearchAddPredictEdbInfoData(utils.DATA_INDEX_NAME, keyWord, noPermissionEdbInfoIdList, startSize, pageSize)
|
|
|
}
|
|
|
+ isEs = true
|
|
|
} else {
|
|
|
var condition string
|
|
|
var pars []interface{}
|
|
@@ -3226,12 +3229,39 @@ func (this *EdbInfoController) EdbInfoFilterByEs() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- for i := 0; i < edbInfoListLen; i++ {
|
|
|
- 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)
|
|
|
+ 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++ {
|
|
|
+ tmpEdbInfoItem := edbInfoList[i]
|
|
|
+ tmpEdbInfo, ok := edbInfoMap[tmpEdbInfoItem.EdbInfoId]
|
|
|
+ if !ok {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ if currClassify, ok := classifyMap[tmpEdbInfo.ClassifyId]; ok {
|
|
|
+ edbInfoList[i].HaveOperaAuth = data_manage_permission.CheckEdbPermissionByPermissionIdList(tmpEdbInfo.IsJoinPermission, currClassify.IsJoinPermission, tmpEdbInfo.EdbInfoId, tmpEdbInfo.ClassifyId, permissionEdbIdList, permissionClassifyIdList)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
for i := 0; i < edbInfoListLen; i++ {
|
|
@@ -4427,6 +4457,8 @@ func (this *EdbInfoController) AllEdbInfoByEs() {
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+ // 是否走ES
|
|
|
+ isEs := false
|
|
|
if keyWord != "" {
|
|
|
var keyWordArr []string
|
|
|
keyWordArr = append(keyWordArr, keyWord)
|
|
@@ -4436,6 +4468,7 @@ func (this *EdbInfoController) AllEdbInfoByEs() {
|
|
|
|
|
|
// 普通的搜索
|
|
|
total, edbInfoList, err = elastic.SearchEdbInfoData(utils.DATA_INDEX_NAME, keyWord, startSize, pageSize, filterSource, source, -1, frequency, noPermissionEdbInfoIdList)
|
|
|
+ isEs = true
|
|
|
} else {
|
|
|
var condition string
|
|
|
var pars []interface{}
|
|
@@ -4515,12 +4548,39 @@ func (this *EdbInfoController) AllEdbInfoByEs() {
|
|
|
return
|
|
|
}
|
|
|
|
|
|
- for i := 0; i < edbInfoListLen; i++ {
|
|
|
- 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)
|
|
|
+ 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++ {
|
|
|
+ tmpEdbInfoItem := edbInfoList[i]
|
|
|
+ tmpEdbInfo, ok := edbInfoMap[tmpEdbInfoItem.EdbInfoId]
|
|
|
+ if !ok {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ if currClassify, ok := classifyMap[tmpEdbInfo.ClassifyId]; ok {
|
|
|
+ edbInfoList[i].HaveOperaAuth = data_manage_permission.CheckEdbPermissionByPermissionIdList(tmpEdbInfo.IsJoinPermission, currClassify.IsJoinPermission, tmpEdbInfo.EdbInfoId, tmpEdbInfo.ClassifyId, permissionEdbIdList, permissionClassifyIdList)
|
|
|
+ }
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
}
|
|
|
|
|
|
for i := 0; i < edbInfoListLen; i++ {
|