|
@@ -339,7 +339,7 @@ func SaveCalendarEdbInfoRelation(chartPermissionId int, matterDate string, editM
|
|
|
}
|
|
|
|
|
|
// GetEdbRelationList 获取指标引用列表
|
|
|
-func GetEdbRelationList(source int, classifyId, sysUserId, frequency, keyword, status string, startSize, pageSize int, sortParam, sortType string) (total int, list []*data_manage.BaseRelationEdbInfo, err error) {
|
|
|
+func GetEdbRelationList(source, edbInfoType int, classifyId, sysUserId, frequency, keyword, status string, startSize, pageSize int, sortParam, sortType string) (total int, list []*data_manage.BaseRelationEdbInfo, err error) {
|
|
|
var pars []interface{}
|
|
|
var condition string
|
|
|
|
|
@@ -356,57 +356,65 @@ func GetEdbRelationList(source int, classifyId, sysUserId, frequency, keyword, s
|
|
|
case utils.DATA_SOURCE_MYSTEEL_CHEMICAL, utils.DATA_SOURCE_WIND:
|
|
|
condition += ` AND e.source = ? `
|
|
|
pars = append(pars, source)
|
|
|
+ }
|
|
|
|
|
|
- if isStop >= 0 {
|
|
|
- condition += " AND e.no_update = ? "
|
|
|
- pars = append(pars, isStop)
|
|
|
- }
|
|
|
+ if edbInfoType == 1 { //预测指标
|
|
|
+ condition += ` AND e.edb_info_type = ? `
|
|
|
+ pars = append(pars, edbInfoType)
|
|
|
+ } else if edbInfoType == 2 { //计算指标
|
|
|
+ condition += ` AND e.edb_type = ? `
|
|
|
+ pars = append(pars, edbInfoType)
|
|
|
+ }
|
|
|
|
|
|
- if classifyId != `` {
|
|
|
- classifyIdSlice := strings.Split(classifyId, ",")
|
|
|
- condition += ` AND e.classify_id IN (` + utils.GetOrmInReplace(len(classifyIdSlice)) + `)`
|
|
|
- pars = append(pars, classifyIdSlice)
|
|
|
- }
|
|
|
- if sysUserId != `` {
|
|
|
- sysUserIdSlice := strings.Split(sysUserId, ",")
|
|
|
- condition += ` AND e.sys_user_id IN (` + utils.GetOrmInReplace(len(sysUserIdSlice)) + `)`
|
|
|
- pars = append(pars, sysUserIdSlice)
|
|
|
- }
|
|
|
- if frequency != `` {
|
|
|
- frequencySlice := strings.Split(frequency, ",")
|
|
|
- condition += ` AND e.frequency IN (` + utils.GetOrmInReplace(len(frequencySlice)) + `)`
|
|
|
- pars = append(pars, frequencySlice)
|
|
|
- }
|
|
|
- if keyword != `` {
|
|
|
- keywordSlice := strings.Split(keyword, " ")
|
|
|
- if len(keywordSlice) > 0 {
|
|
|
- tmpConditionSlice := make([]string, 0)
|
|
|
- tmpConditionSlice = append(tmpConditionSlice, ` e.edb_name like ? or e.edb_code like ? `)
|
|
|
- pars = utils.GetLikeKeywordPars(pars, keyword, 2)
|
|
|
+ if isStop >= 0 {
|
|
|
+ condition += " AND e.no_update = ? "
|
|
|
+ pars = append(pars, isStop)
|
|
|
+ }
|
|
|
|
|
|
- for _, v := range keywordSlice {
|
|
|
- if v == ` ` || v == `` {
|
|
|
- continue
|
|
|
- }
|
|
|
- tmpConditionSlice = append(tmpConditionSlice, ` e.edb_name like ? or e.edb_code like ? `)
|
|
|
- pars = utils.GetLikeKeywordPars(pars, v, 2)
|
|
|
- }
|
|
|
- condition += ` AND (` + strings.Join(tmpConditionSlice, " or ") + `)`
|
|
|
+ if classifyId != `` {
|
|
|
+ classifyIdSlice := strings.Split(classifyId, ",")
|
|
|
+ condition += ` AND e.classify_id IN (` + utils.GetOrmInReplace(len(classifyIdSlice)) + `)`
|
|
|
+ pars = append(pars, classifyIdSlice)
|
|
|
+ }
|
|
|
+ if sysUserId != `` {
|
|
|
+ sysUserIdSlice := strings.Split(sysUserId, ",")
|
|
|
+ condition += ` AND e.sys_user_id IN (` + utils.GetOrmInReplace(len(sysUserIdSlice)) + `)`
|
|
|
+ pars = append(pars, sysUserIdSlice)
|
|
|
+ }
|
|
|
+ if frequency != `` {
|
|
|
+ frequencySlice := strings.Split(frequency, ",")
|
|
|
+ condition += ` AND e.frequency IN (` + utils.GetOrmInReplace(len(frequencySlice)) + `)`
|
|
|
+ pars = append(pars, frequencySlice)
|
|
|
+ }
|
|
|
+ if keyword != `` {
|
|
|
+ keywordSlice := strings.Split(keyword, " ")
|
|
|
+ if len(keywordSlice) > 0 {
|
|
|
+ tmpConditionSlice := make([]string, 0)
|
|
|
+ tmpConditionSlice = append(tmpConditionSlice, ` e.edb_name like ? or e.edb_code like ? `)
|
|
|
+ pars = utils.GetLikeKeywordPars(pars, keyword, 2)
|
|
|
|
|
|
- } else {
|
|
|
- condition += ` AND (e.edb_name like ? or e.edb_code like ? )`
|
|
|
- pars = utils.GetLikeKeywordPars(pars, keyword, 2)
|
|
|
+ for _, v := range keywordSlice {
|
|
|
+ if v == ` ` || v == `` {
|
|
|
+ continue
|
|
|
+ }
|
|
|
+ tmpConditionSlice = append(tmpConditionSlice, ` e.edb_name like ? or e.edb_code like ? `)
|
|
|
+ pars = utils.GetLikeKeywordPars(pars, v, 2)
|
|
|
}
|
|
|
- }
|
|
|
+ condition += ` AND (` + strings.Join(tmpConditionSlice, " or ") + `)`
|
|
|
|
|
|
- sortStr := ``
|
|
|
- if sortParam != `` {
|
|
|
- sortStr = fmt.Sprintf("%s %s,e.edb_info_id desc ", sortParam, sortType)
|
|
|
+ } else {
|
|
|
+ condition += ` AND (e.edb_name like ? or e.edb_code like ? )`
|
|
|
+ pars = utils.GetLikeKeywordPars(pars, keyword, 2)
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- total, list, err = data_manage.GetEdbInfoRelationList(condition, pars, sortStr, startSize, pageSize)
|
|
|
+ sortStr := ``
|
|
|
+ if sortParam != `` {
|
|
|
+ sortStr = fmt.Sprintf("%s %s,e.edb_info_id desc ", sortParam, sortType)
|
|
|
}
|
|
|
|
|
|
+ total, list, err = data_manage.GetEdbInfoRelationList(condition, pars, sortStr, startSize, pageSize)
|
|
|
+
|
|
|
return
|
|
|
}
|
|
|
|