浏览代码

新增引用时间

xyxie 10 月之前
父节点
当前提交
8757415898

+ 1 - 1
controllers/data_manage/edb_info_relation.go

@@ -132,7 +132,7 @@ func (c *EdbInfoRelationController) RelationEdbListDetail() {
 			ReferObjectId:      v.ReferObjectId,
 			ReferObjectType:    v.ReferObjectType,
 			ReferObjectSubType: v.ReferObjectSubType,
-			RelationTime:       v.ModifyTime.Format(utils.FormatDateTime),
+			RelationTime:       v.RelationTime.Format(utils.FormatDateTime),
 		}
 		switch v.ReferObjectType {
 		case utils.EDB_RELATION_SANDBOX:

+ 4 - 3
models/data_manage/edb_info_relation.go

@@ -18,6 +18,7 @@ type EdbInfoRelation struct {
 	ReferObjectSubType int       `description:"引用对象子类"`
 	CreateTime         time.Time `description:"创建时间"`
 	ModifyTime         time.Time `description:"修改时间"`
+	RelationTime       time.Time `description:"引用时间"`
 }
 
 func (e *EdbInfoRelation) TableName() string {
@@ -143,7 +144,7 @@ func GetEdbInfoRelationList(condition string, pars []interface{}, orderBy string
 	o := orm.NewOrmUsingDB("data")
 	// 数量汇总
 	totalSql := ` SELECT count(1) FROM edb_info e LEFT JOIN (
-SELECT count(edb_info_id) as relation_num, edb_info_id, max(modify_time) as relation_time FROM edb_info_relation GROUP BY edb_info_id) r on e.edb_info_id=r.edb_info_id WHERE e.source in (2,34) `
+SELECT count(edb_info_id) as relation_num, edb_info_id, max(relation_time) as relation_time FROM edb_info_relation GROUP BY edb_info_id) r on e.edb_info_id=r.edb_info_id WHERE e.source in (2,34) `
 	if condition != "" {
 		totalSql += condition
 	}
@@ -154,7 +155,7 @@ SELECT count(edb_info_id) as relation_num, edb_info_id, max(modify_time) as rela
 
 	// 列表数据
 	sql := ` SELECT e.edb_info_id, e.classify_id,e.edb_code,e.edb_name,e.sys_user_id,e.sys_user_real_name,e.frequency,e.no_update as is_stop, r.relation_num, r.relation_time from edb_info e LEFT JOIN (
-SELECT count(edb_info_id) as relation_num, edb_info_id, max(modify_time) as relation_time FROM edb_info_relation GROUP BY edb_info_id) r on e.edb_info_id=r.edb_info_id WHERE e.source in (2,34)
+SELECT count(edb_info_id) as relation_num, edb_info_id, max(relation_time) as relation_time FROM edb_info_relation GROUP BY edb_info_id) r on e.edb_info_id=r.edb_info_id WHERE e.source in (2,34)
  `
 	if condition != "" {
 		sql += condition
@@ -182,7 +183,7 @@ func GetEdbInfoRelationDetailList(edbInfoId int, startSize, pageSize int) (total
 	}
 
 	// 列表数据
-	sql := ` SELECT *FROM edb_info_relation where edb_info_id=? ORDER BY modify_time, edb_info_id ASC `
+	sql := ` SELECT *FROM edb_info_relation where edb_info_id=? ORDER BY relation_time, edb_info_id ASC `
 	sql += `  LIMIT ?,? `
 	_, err = o.Raw(sql, edbInfoId, startSize, pageSize).QueryRows(&items)
 

+ 1 - 0
services/data/edb_info_relation.go

@@ -84,6 +84,7 @@ func saveEdbInfoRelation(edbInfoIds []int, objectId, objectType, objectSubType i
 				EdbCode:            edbInfo.EdbCode,
 				CreateTime:         nowTime,
 				ModifyTime:         nowTime,
+				RelationTime:       nowTime,
 			}
 			addList = append(addList, tmp)
 		}