Ver Fonte

指标替换间接引用

xyxie há 8 meses atrás
pai
commit
79cbbddcf7
2 ficheiros alterados com 4 adições e 2 exclusões
  1. 2 0
      cache/replace_edb_info.go
  2. 2 2
      models/data_manage/edb_info_relation.go

+ 2 - 0
cache/replace_edb_info.go

@@ -13,6 +13,8 @@ func AddReplaceEdbInfo(oldEdbInfo, newEdbInfo *data_manage.EdbInfo) bool {
 	record.NewEdbInfo = newEdbInfo
 	if utils.Re == nil {
 		err := utils.Rc.LPush(utils.CACHE_KEY_REPLACE_EDB, record)
+		
+		utils.FileLog.Info(fmt.Sprintf("指标替换 加入缓存 AddReplaceEdbInfo LPush: 旧指标ID:%d,新指标ID:%d", oldEdbInfo.EdbInfoId, newEdbInfo.EdbInfoId))
 		if err != nil {
 			fmt.Println("AddReplaceEdbInfo LPush Err:" + err.Error())
 		}

+ 2 - 2
models/data_manage/edb_info_relation.go

@@ -315,7 +315,7 @@ func GetEdbInfoRelationDetailList(edbInfoId int, startSize, pageSize int) (total
 func GetReplaceChildEdbInfoRelationTotal(edbInfoId int) (total int, err error) {
 	o := orm.NewOrmUsingDB("data")
 	// 数量汇总
-	totalSql := ` SELECT count(*) FROM edb_info_relation where  child_edb_info_id=? and root_edb_info_id !=?  group by parent_relation_id`
+	totalSql := ` SELECT count(*) FROM edb_info_relation where  relation_type=1 and (child_edb_info_id=? or edb_info_id=? ) group by parent_relation_id`
 	err = o.Raw(totalSql, edbInfoId, edbInfoId).QueryRow(&total)
 	if err != nil {
 		return
@@ -327,7 +327,7 @@ func GetReplaceChildEdbInfoRelationTotal(edbInfoId int) (total int, err error) {
 func GetReplaceChildEdbInfoRelationList(edbInfoId int, startSize, pageSize int) (items []*EdbInfoRelation, err error) {
 	o := orm.NewOrmUsingDB("data")
 	// 列表数据
-	sql := ` SELECT * FROM edb_info_relation where  child_edb_info_id=? and root_edb_info_id !=?  group by parent_relation_id ORDER BY edb_info_relation_id ASC  LIMIT ?,? `
+	sql := ` SELECT * FROM edb_info_relation where  relation_type=1 and (child_edb_info_id=? or edb_info_id=? )  group by parent_relation_id ORDER BY edb_info_relation_id ASC  LIMIT ?,? `
 	_, err = o.Raw(sql, edbInfoId, edbInfoId, startSize, pageSize).QueryRows(&items)
 	return
 }