Browse Source

fix: PDF报告详情

hsun 5 ngày trước cách đây
mục cha
commit
cae8a103fc
1 tập tin đã thay đổi với 3 bổ sung3 xóa
  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