outside_report_attachment.go 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. package report
  2. import (
  3. "eta/eta_email_analysis/global"
  4. "eta/eta_email_analysis/utils"
  5. "time"
  6. )
  7. // OutsideReportAttachment 外部报告附件
  8. type OutsideReportAttachment struct {
  9. OutsideReportAttachmentID int `gorm:"primaryKey;column:outside_report_attachment_id" json:"-"`
  10. OutsideReportID int `gorm:"column:outside_report_id" json:"outsideReportId"` // 报告id
  11. Title string `gorm:"column:title" json:"title"` // 附件名称
  12. URL string `gorm:"column:url" json:"url"` // 附件地址
  13. CreateTime time.Time `gorm:"column:create_time" json:"createTime"` // 附件新增时间
  14. FileSize int64 `gorm:"column:file_size" json:"fileSize"` // 附件大小
  15. }
  16. // TableName get sql table name.获取数据库表名
  17. func (m *OutsideReportAttachment) TableName() string {
  18. return "outside_report_attachment"
  19. }
  20. // OutsideReportAttachmentColumns get sql column name.获取数据库列名
  21. var OutsideReportAttachmentColumns = struct {
  22. OutsideReportAttachmentID string
  23. OutsideReportID string
  24. Title string
  25. URL string
  26. CreateTime string
  27. FileSize string
  28. }{
  29. OutsideReportAttachmentID: "outside_report_attachment_id",
  30. OutsideReportID: "outside_report_id",
  31. Title: "title",
  32. URL: "url",
  33. CreateTime: "create_time",
  34. FileSize: "file_size",
  35. }
  36. // AddOutsideReportAttachment
  37. // @Description: 新增附件
  38. // @author: Roc
  39. // @datetime 2024-09-14 09:36:48
  40. // @param item *OutsideReportAttachment
  41. // @return err error
  42. func AddOutsideReportAttachment(item *OutsideReportAttachment) (err error) {
  43. err = global.DEFAULT_MYSQL.Create(item).Error
  44. return
  45. }
  46. // BatchesAddOutsideReportAttachment
  47. // @Description: 批量新增附件
  48. // @author: Roc
  49. // @datetime 2024-09-14 09:36:48
  50. // @param items []*OutsideReportAttachment
  51. // @return err error
  52. func BatchesAddOutsideReportAttachment(items []*OutsideReportAttachment) (err error) {
  53. err = global.DEFAULT_MYSQL.CreateInBatches(items, utils.BatchSize).Error
  54. return
  55. }
  56. type MailRule struct {
  57. Rule string `json:"rule"`
  58. Title string `json:"title"`
  59. Author string `json:"author"`
  60. ClassifyId int `json:"classify_id"`
  61. Abstract string `json:"abstract"`
  62. }