outside_report_attachment.go 1.1 KB

1234567891011121314151617181920212223242526272829
  1. // @Author gmy 2024/9/19 15:13:00
  2. package document_manage_model
  3. import (
  4. "eta/eta_hub/global"
  5. "eta/eta_hub/utils"
  6. "github.com/beego/beego/v2/client/orm"
  7. )
  8. type OutsideReportAttachment struct {
  9. OutsideReportAttachmentId int `orm:"column(outside_report_attachment_id);pk" description:"外部报告附件ID"`
  10. OutsideReportId int `orm:"column(outside_report_id)" description:"报告id"`
  11. Title string `orm:"column(title)" description:"附件名称"`
  12. Url string `orm:"column(url)" description:"附件地址"`
  13. CreateTime string `orm:"column(create_time)" description:"附件新增时间"`
  14. FileSize int64 `orm:"column(file_size)" description:"附件大小"`
  15. }
  16. // 在 init 函数中注册模型
  17. func init() {
  18. orm.RegisterModel(new(OutsideReportAttachment))
  19. }
  20. // SaveOutsideReportAttachment 保存附件
  21. func SaveOutsideReportAttachment(attachment *OutsideReportAttachment) (int64, error) {
  22. //o := orm.NewOrmUsingDB("rddp")
  23. err := global.DbMap[utils.DbNameReport].Create(attachment).Error
  24. return int64(attachment.OutsideReportAttachmentId), err
  25. }