fix: complete nested portrait views and binding alert scope
This commit is contained in:
@@ -87,6 +87,16 @@ func (r *alertRecordRepo) List(ctx context.Context, scope business.AlertRecordSc
|
||||
if empty || !available {
|
||||
return page, nil
|
||||
}
|
||||
if filter.PlatformBusierID != nil {
|
||||
available, err := businessTableAvailable(db, "tab_promote")
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
if !available {
|
||||
page.Available = false
|
||||
return page, nil
|
||||
}
|
||||
}
|
||||
base := func() *gorm.DB {
|
||||
q := alertScopedQuery(db, scope)
|
||||
if len(filter.PlatformCodes) > 0 {
|
||||
@@ -95,6 +105,9 @@ func (r *alertRecordRepo) List(ctx context.Context, scope business.AlertRecordSc
|
||||
if filter.TargetPromoteID != nil {
|
||||
q = q.Where("r.target_promote_id = ?", *filter.TargetPromoteID)
|
||||
}
|
||||
if filter.PlatformBusierID != nil {
|
||||
q = q.Where("EXISTS (?)", db.Table("tab_promote bp").Select("1").Where("bp.id=r.target_promote_id AND bp.source_db=r.platform_code AND bp.busier_id=?", *filter.PlatformBusierID))
|
||||
}
|
||||
return q
|
||||
}
|
||||
q := base()
|
||||
|
||||
Reference in New Issue
Block a user