浏览代码

fix: PDF报告详情

hsun 4 天之前
父节点
当前提交
cae8a103fc
共有 1 个文件被更改,包括 3 次插入3 次删除
  1. 3 3
      models/report.go

+ 3 - 3
models/report.go

@@ -291,11 +291,11 @@ func GetOutsideReportById(reportId int) (item *OutsideReport, err error) {
 		WHERE 
 			o.outside_report_id = ?
 			AND oa.title LIKE '%.pdf%'
-			AND oa.create_time = (
-				SELECT MAX(oa2.create_time)
+			AND oa.outside_report_attachment_id = (
+				SELECT MAX(oa2.outside_report_attachment_id)
 				FROM outside_report_attachment oa2
 				WHERE oa2.outside_report_id = o.outside_report_id AND oa2.title LIKE '%.pdf%'
-			)
+			) GROUP BY o.outside_report_id
 		LIMIT 1`
 	err = o.Raw(sql, reportId).QueryRow(&item)
 	return