|
@@ -236,6 +236,7 @@ type BaseRelationEdbInfo struct {
|
|
|
SysUserRealName string `description:"创建人姓名"`
|
|
|
Frequency string `description:"频度"`
|
|
|
IsStop int `description:"是否停更:1:停更,0:未停更"`
|
|
|
+ IsSupplierStop int `description:"是否供应商停更:1:停更,0:未停更"`
|
|
|
RelationNum int `description:"引用次数"`
|
|
|
RelationTime string `description:"引用时间"`
|
|
|
}
|
|
@@ -261,11 +262,16 @@ type BaseRelationEdbInfoDetailResp struct {
|
|
|
}
|
|
|
|
|
|
// 查询指标引用列表
|
|
|
-func GetEdbInfoRelationList(condition string, pars []interface{}, orderBy string, startSize, pageSize int) (total int, items []*BaseRelationEdbInfo, err error) {
|
|
|
+func GetEdbInfoRelationList(condition string, pars []interface{}, addFieldStr, joinTableStr, orderBy string, startSize, pageSize int) (total int, items []*BaseRelationEdbInfo, err error) {
|
|
|
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(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 1=1 `
|
|
|
+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 `
|
|
|
+
|
|
|
+ if joinTableStr != "" {
|
|
|
+ totalSql += joinTableStr
|
|
|
+ }
|
|
|
+ totalSql += ` WHERE 1=1 `
|
|
|
if condition != "" {
|
|
|
totalSql += condition
|
|
|
}
|
|
@@ -274,10 +280,15 @@ SELECT count(edb_info_id) as relation_num, edb_info_id, max(relation_time) as re
|
|
|
return
|
|
|
}
|
|
|
|
|
|
+ fieldStr := ` 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 ` + addFieldStr
|
|
|
// 列表数据
|
|
|
- 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(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 1=1
|
|
|
- `
|
|
|
+ sql := ` SELECT ` + fieldStr + ` from edb_info e LEFT JOIN (
|
|
|
+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 `
|
|
|
+ if joinTableStr != "" {
|
|
|
+ sql += joinTableStr
|
|
|
+ }
|
|
|
+ sql += ` WHERE 1=1 `
|
|
|
+
|
|
|
if condition != "" {
|
|
|
sql += condition
|
|
|
}
|