互动
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

40 lines
1.7 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. package models
  2. import (
  3. "time"
  4. "github.com/ouxuanserver/osmanthuswine/src/core"
  5. )
  6. const InvitationLetterTableName = TableNamePrefix + "invitation_letter"
  7. type InvitationLetter struct {
  8. Id int `json:"id" xorm:"pk autoincr" description:"主键"`
  9. UserId int `json:"user_id" xorm:"not null default(0) comment('用户id') INT(11)"`
  10. ActivityId int `json:"activity_id" xorm:"not null default(0) comment('主活动id') INT(11)"`
  11. InvitationId int `json:"invitation_id" xorm:"not null default(0) comment('邀请函id') INT(11)"`
  12. RehearsalId int `json:"rehearsal_id" xorm:"not null default 0 comment('彩排id') INT(11)"`
  13. ArchId int `json:"arch_id" xorm:"not null default 0 comment('归档id') INT(11)"`
  14. ExtraData string `json:"extra_data" xorm:"comment('邀请函信息') TEXT"`
  15. IsDelete bool `json:"is_delete" xorm:"default(0)" description:"删除"`
  16. CreatedAt time.Time `json:"created_at" xorm:"created" description:"创建"`
  17. UpdatedAt time.Time `json:"updated_at" xorm:"updated" description:"更新"`
  18. }
  19. func (t *InvitationLetter) TableName() string {
  20. return InvitationLetterTableName
  21. }
  22. func (t *InvitationLetter) Alias(name string) string {
  23. return Alias(t, name)
  24. }
  25. func (t *InvitationLetter) GetByUserIdAndActivityId(userId, activityId, archId, rehearsalId interface{}) (bool, error) {
  26. return core.GetXormAuto().Where("user_id=? and activity_id=? and arch_id=? and rehearsal_id=? and is_delete=0",
  27. userId, activityId, archId, rehearsalId).Get(t)
  28. }
  29. func (t *InvitationLetter) Count(activityId, archId, rehearsalId interface{}) (int64, error) {
  30. return core.GetXormAuto().Where("is_delete=0 and activity_id=? and arch_id=? and rehearsal_id=?",
  31. activityId, archId, rehearsalId).Count(t)
  32. }