Explorar o código

未发布的报告不显示收藏

kobe6258 hai 2 meses
pai
achega
12101465c5
Modificáronse 1 ficheiros con 6 adicións e 2 borrados
  1. 6 2
      models/report/report.go

+ 6 - 2
models/report/report.go

@@ -420,7 +420,7 @@ func GetHiddenReportIds(classifyIds []int, plateNames []string) (reportIds []int
 
 func FilterReportIds(ids []int) (total int64, reportIds []int, err error) {
 	db := models.Main()
-	subQuery := `
+	etaSubQuery := `
 		select a.classify_id 
 		from (
 			select classify_id, IFNULL( GROUP_CONCAT(permissions.risk_level SEPARATOR ','),'') as risks 
@@ -430,9 +430,13 @@ func FilterReportIds(ids []int) (total int64, reportIds []int, err error) {
 		) a  
 		where a.risks = ''
 	`
+	htSubQuery := `
+		select a.name from (SELECT name,IFNULL(risk_level,'') as risk_level  FROM permissions) a  WHERE a.risk_level =''
+	`
 	err = db.Model(&Report{}).Select("id").
 		Where("id in ?", ids).
-		Where("classify_id not in (?)", gorm.Expr(subQuery)).
+		Where("classify_id not in (?) and source=?", gorm.Expr(etaSubQuery), SourceETA).
+		Where("plant_name not in (?) and source=?", gorm.Expr(htSubQuery), SourceHT).
 		Where("Status = ?", StatusPublish).
 		Scan(&reportIds).Error
 	if err != nil {