ソースを参照

文档管理-报告复制链接

gmy 3 ヶ月 前
コミット
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
 }