|
@@ -65,7 +65,7 @@ func GetEdbInfoRelationAllByReferObjectIds(referObjectIds []int, referObjectType
|
|
|
}
|
|
|
|
|
|
// 新增记录
|
|
|
-func AddOrUpdateEdbInfoRelation(objectId, objectType int, relationList []*EdbInfoRelation, deleteEdbInfoIds []int, refreshEdbInfoIds []int, indexCodeList []string) (err error) {
|
|
|
+func AddOrUpdateEdbInfoRelation(objectId, objectType int, relationList []*EdbInfoRelation, deleteEdbInfoIds []int, refreshEdbInfoIds []int, indexCodeList []string, autoToNormal bool) (err error) {
|
|
|
o := global.DbMap[utils.DbNameIndex].Begin()
|
|
|
if o.Error != nil {
|
|
|
return o.Error
|
|
@@ -104,7 +104,7 @@ func AddOrUpdateEdbInfoRelation(objectId, objectType int, relationList []*EdbInf
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if len(refreshEdbInfoIds) > 0 {
|
|
|
+ if len(refreshEdbInfoIds) > 0 && autoToNormal {
|
|
|
//todo 是否需要所有指标的刷新状态
|
|
|
sql := ` UPDATE edb_info SET no_update = 0, set_update_time=? WHERE edb_info_id IN (` + utils.GetOrmInReplace(len(refreshEdbInfoIds)) + `) `
|
|
|
err = o.Exec(sql, time.Now(), refreshEdbInfoIds).Error
|
|
@@ -114,7 +114,7 @@ func AddOrUpdateEdbInfoRelation(objectId, objectType int, relationList []*EdbInf
|
|
|
}
|
|
|
|
|
|
//更新数据源上海钢联指标
|
|
|
- if len(indexCodeList) > 0 {
|
|
|
+ if len(indexCodeList) > 0 && autoToNormal {
|
|
|
// 更改数据源的更新状态
|
|
|
sql := ` UPDATE base_from_mysteel_chemical_index SET is_stop = 0 WHERE index_code IN (` + utils.GetOrmInReplace(len(indexCodeList)) + `) and is_stop=1`
|
|
|
err = o.Exec(sql, indexCodeList).Error
|
|
@@ -146,7 +146,7 @@ WHERE
|
|
|
}
|
|
|
|
|
|
// 新增记录
|
|
|
-func AddOrUpdateEdbInfoRelationMulti(relationList []*EdbInfoRelation, refreshEdbInfoIds []int, indexCodeList []string) (err error) {
|
|
|
+func AddOrUpdateEdbInfoRelationMulti(relationList []*EdbInfoRelation, refreshEdbInfoIds []int, indexCodeList []string, autoToNormal bool) (err error) {
|
|
|
o := global.DbMap[utils.DbNameIndex].Begin()
|
|
|
if o.Error != nil {
|
|
|
return o.Error
|
|
@@ -172,7 +172,7 @@ func AddOrUpdateEdbInfoRelationMulti(relationList []*EdbInfoRelation, refreshEdb
|
|
|
}
|
|
|
}
|
|
|
|
|
|
- if len(refreshEdbInfoIds) > 0 {
|
|
|
+ if len(refreshEdbInfoIds) > 0 && autoToNormal {
|
|
|
// todo 更新指标的刷新状态
|
|
|
sql := ` UPDATE edb_info SET no_update = 0, set_update_time=? WHERE edb_info_id IN (` + utils.GetOrmInReplace(len(refreshEdbInfoIds)) + `) `
|
|
|
err = o.Exec(sql, time.Now(), refreshEdbInfoIds).Error
|
|
@@ -182,7 +182,7 @@ func AddOrUpdateEdbInfoRelationMulti(relationList []*EdbInfoRelation, refreshEdb
|
|
|
}
|
|
|
|
|
|
//更新数据源上海钢联指标
|
|
|
- if len(indexCodeList) > 0 {
|
|
|
+ if len(indexCodeList) > 0 && autoToNormal {
|
|
|
// 更改数据源的更新状态
|
|
|
sql := ` UPDATE base_from_mysteel_chemical_index SET is_stop = 0 WHERE index_code IN (` + utils.GetOrmInReplace(len(indexCodeList)) + `) and is_stop=1`
|
|
|
err = o.Exec(sql, indexCodeList).Error
|