自引用的话比较简单 ,这一篇就是用来水的 书接上文,现在需要实现评论的评论,怎么办? 很简单,只需这样 12345678910111213type Comment struct { Id int Body string Comments []Comment `gorm:"polymorphic:Owner;"` OwnerID int // 拥有者ID OwnerType string // 拥有者类型}// 添加评论func AddComment(Body string, OwnerID int, OwnerType string) { GLOBAL_DB.Create(&Comment{Body: Body, OwnerID: OwnerID, OwnerType: OwnerType})}