|
@@ -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)
|
|
|
|