article_models.go 7.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  1. package models
  2. type ArticleCategory struct {
  3. //对应数据库中的字段
  4. IMenuId int64 `gorm:"column:id" json:"id" form:"id"`
  5. Name string `gorm:"column:name" json:"name" form:"Name"`
  6. Order int64 `gorm:"column:order" json:"order" form:"order"`
  7. Status int64 `gorm:"column:status" json:"status" form:"status"`
  8. Summary string `gorm:"column:summary" json:"summary" form:"summary"`
  9. Type int64 `gorm:"column:type" json:"type" form:"type"`
  10. UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
  11. Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
  12. Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
  13. Num int64 `gorm:"column:num" json:"num" form:"num"`
  14. }
  15. func (ArticleCategory) TableName() string {
  16. return "sgj_patient_articles_menu"
  17. }
  18. //type Articles struct {
  19. // ID int64 `gorm:"column:id" json:"id"`
  20. // Title string `gorm:"column:title" json:"title"`
  21. // Summary string `gorm:"column:summary" json:"summary"`
  22. // Content string `gorm:"column:content" json:"content"`
  23. // Type int `gorm:"column:type" json:"type"`
  24. // Num int `gorm:"column:num" json:"num"`
  25. // Realreadnum int64 `gorm:"column:real_read_num" json:"real_read_num"`
  26. // Mtime int64 `gorm:"column:mtime" json:"mtime"`
  27. // Ctime int64 `gorm:"column:ctime" json:"ctime"`
  28. // ClassId int64 `gorm:"column:class_id" json:"class_id"`
  29. // Author string `gorm:"column:author" json:"author"`
  30. // Status int `gorm:"column:status" json:"status"`
  31. // Reason string `gorm:"column:reason" json:"reason"`
  32. // StarNum int `gorm:"column:star_num" json:"star_num"`
  33. // CommentNum int `gorm:"column:comment_num" json:"comment_num"`
  34. // UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id"`
  35. // ArticleStatus int64 `gorm:"column:article_status" json:"article_status"`
  36. // Imgs string `gorm:"column:imgs" json:"imgs"`
  37. // VideoUrl string `gorm:"column:video_url" json:"video_url"`
  38. // Cover string `gorm:"-" json:"cover"`
  39. // PublicTime string `gorm:"-" json:"publicTime"`
  40. // Comments []Comment `gorm:"ForeignKey:ArticleId"`
  41. // ArticleId int64 `gorm:"-"`
  42. //}
  43. type Articles struct {
  44. ID int64 `gorm:"column:id" json:"id" form:"id"`
  45. Title string `gorm:"column:title" json:"title" form:"title"`
  46. Summary string `gorm:"column:summary" json:"summary" form:"summary"`
  47. Content string `gorm:"column:content" json:"content" form:"content"`
  48. Type int64 `gorm:"column:type" json:"type" form:"type"`
  49. Num int64 `gorm:"column:num" json:"num" form:"num"`
  50. Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
  51. RealReadNum int64 `gorm:"column:real_read_num" json:"real_read_num" form:"real_read_num"`
  52. Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
  53. ClassId int64 `gorm:"column:class_id" json:"class_id" form:"class_id"`
  54. Author string `gorm:"column:author" json:"author" form:"author"`
  55. Status int64 `gorm:"column:status" json:"status" form:"status"`
  56. Reason string `gorm:"column:reason" json:"reason" form:"reason"`
  57. StarNum int64 `gorm:"column:star_num" json:"star_num" form:"star_num"`
  58. CommentNum int64 `gorm:"column:comment_num" json:"comment_num" form:"comment_num"`
  59. UserOrgId int64 `gorm:"column:user_org_id" json:"user_org_id" form:"user_org_id"`
  60. ArticleStatus int64 `gorm:"column:article_status" json:"article_status" form:"article_status"`
  61. Imgs string `gorm:"column:imgs" json:"imgs" form:"imgs"`
  62. VideoUrl string `gorm:"column:video_url" json:"video_url" form:"video_url"`
  63. Source int64 `gorm:"column:source" json:"source" form:"source"`
  64. CategoryId int64 `gorm:"column:category_id" json:"category_id" form:"category_id"`
  65. Ttid int64 `gorm:"column:ttid" json:"ttid" form:"ttid"`
  66. Ttype int64 `gorm:"column:ttype" json:"ttype" form:"ttype"`
  67. Toid int64 `gorm:"column:toid" json:"toid" form:"toid"`
  68. Comments []Comment `gorm:"ForeignKey:ArticleId"`
  69. PublicTime string `gorm:"-" json:"publicTime"`
  70. ArticleId int64 `gorm:"-"`
  71. }
  72. func (Articles) TableName() string {
  73. return "sgj_patient_articles"
  74. }
  75. type Comment struct {
  76. ID int64 `gorm:"column:id" json:"id"`
  77. ArticleId int64 `gorm:"column:article_id" json:"article_id"`
  78. CommentUserId int64 `gorm:"column:comment_user_id" json:"comment_user_id"`
  79. ParentId int64 `gorm:"column:parent_id" json:"parent_id"`
  80. Content string `gorm:"column:content" json:"content"`
  81. Ctime int64 `gorm:"column:ctime" json:"ctime"`
  82. Mtime int64 `gorm:"column:mtime" json:"mtime"`
  83. Status int64 `gorm:"column:status" json:"status"`
  84. StarNum int64 `gorm:"column:star_num" json:"star_num"`
  85. CommentNum int64 `gorm:"column:comment_num" json:"comment_num"`
  86. CommentId int64 `gorm:"column:comment_id" json:"comment_id"`
  87. CommentUserName string `gorm:"column:comment_user_name" json:"comment_user_name"`
  88. CommentUserAvater string `gorm:"column:comment_user_avater" json:"comment_user_avater"`
  89. CommentTime string `gorm:"-" json:"commentTime"`
  90. Article Articles
  91. Parent Parents
  92. }
  93. type Parents struct {
  94. ID int64 `gorm:"column:id" json:"id" form:"id"`
  95. ArticleId int64 `gorm:"column:article_id" json:"article_id" form:"article_id"`
  96. CommentUserId int64 `gorm:"column:comment_user_id" json:"comment_user_id" form:"comment_user_id"`
  97. ParentId int64 `gorm:"column:parent_id" json:"parent_id" form:"parent_id"`
  98. Content string `gorm:"column:content" json:"content" form:"content"`
  99. Ctime int64 `gorm:"column:ctime" json:"ctime" form:"ctime"`
  100. Mtime int64 `gorm:"column:mtime" json:"mtime" form:"mtime"`
  101. Status int64 `gorm:"column:status" json:"status" form:"status"`
  102. StarNum int64 `gorm:"column:star_num" json:"star_num" form:"star_num"`
  103. CommentNum int64 `gorm:"column:comment_num" json:"comment_num" form:"comment_num"`
  104. CommentId int64 `gorm:"column:comment_id" json:"comment_id" form:"comment_id"`
  105. CommentUserName string `gorm:"column:comment_user_name" json:"comment_user_name" form:"comment_user_name"`
  106. CommentUserAvater string `gorm:"column:comment_user_avater" json:"comment_user_avater" form:"comment_user_avater"`
  107. Source int64 `gorm:"column:source" json:"source" form:"source"`
  108. Ttid int64 `gorm:"column:ttid" json:"ttid" form:"ttid"`
  109. TuserId int64 `gorm:"column:tuser_id" json:"tuser_id" form:"tuser_id"`
  110. Taid int64 `gorm:"column:taid" json:"taid" form:"taid"`
  111. Tpid int64 `gorm:"column:tpid" json:"tpid" form:"tpid"`
  112. Tcid int64 `gorm:"column:tcid" json:"tcid" form:"tcid"`
  113. }
  114. func (Comment) TableName() string {
  115. return "sgj_patient_articles_comment"
  116. }