소스 검색

fix: PDF报告详情

hsun 5 일 전
부모
커밋
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