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