models.go 1.2KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. package member_service
  2. import (
  3. "SCRM/models"
  4. )
  5. type Members struct {
  6. models.UserCustomer
  7. Tags []*models.UserTags `gorm:"many2many:sgj_user_tag_links;association_jointable_foreignkey:tag_id;jointable_foreignkey:user_link_id;" json:"tags"`
  8. UserCard *UserCard `gorm:"foreignkey:customer_id" json:"user_card"`
  9. Illness []*CustomerIllness `gorm:"foreignkey:customer_id" json:"illness"`
  10. UserTags []*models.UserTagLinks `gorm:"foreignkey:user_link_id" json:"user_tags"`
  11. }
  12. func (Members) TableName() string {
  13. return "sgj_user_customer"
  14. }
  15. type UserCard struct {
  16. models.UserCard
  17. Card *models.UserMembershipCard `gorm:"ForeignKey:CardId" json:"card"`
  18. }
  19. func (UserCard) TableName() string {
  20. return "sgj_user_user_card"
  21. }
  22. type CustomerIllness struct {
  23. models.CustomerIllness
  24. }
  25. func (CustomerIllness) TableName() string {
  26. return "sgj_user_customer_illness"
  27. }
  28. type Tags struct {
  29. models.UserTags
  30. MemberCount int64 `json:"member_count"`
  31. }
  32. func (Tags) TableName() string {
  33. return "sgj_user_tags"
  34. }
  35. type TagsMemberCount struct {
  36. MemberCount int64 `gorm:"member_count"`
  37. TagID int64 `gorm:"tag_id"`
  38. }
  39. type CardsMemberCount struct {
  40. MemberCount int64 `gorm:"member_count"`
  41. CardID int64 `gorm:"card_id"`
  42. }