Просмотр исходного кода

文档管理-报告复制链接

gmy 3 месяцев назад
Родитель
Сommit
78372ed23d
1 измененных файлов с 7 добавлено и 6 удалено
  1. 7 6
      models/outside_report_attachment.go

+ 7 - 6
models/outside_report_attachment.go

@@ -17,14 +17,15 @@ func init() {
 }
 
 // GetOutsideReportAttachmentListByReportId 根据报告id获取附件列表
-func GetOutsideReportAttachmentListByReportId(outsideReportId int) ([]*OutsideReportAttachment, error) {
-	o := orm.NewOrmUsingDB("rddp")
-	var attachmentList []*OutsideReportAttachment
-	_, err := o.QueryTable("outside_report_attachment").
-		Filter("outside_report_id", outsideReportId).
-		All(&attachmentList)
+func GetOutsideReportAttachmentListByReportId(outsideReportId int) (attachmentList []*OutsideReportAttachment, err error) {
+	o := orm.NewOrm()
+	// 改写成通过ql查询
+	sql := `select * from outside_report_attachment where outside_report_id = ?`
+
+	_, err = o.Raw(sql, outsideReportId).QueryRows(&attachmentList)
 	if err != nil {
 		return nil, err
 	}
+
 	return attachmentList, nil
 }