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
40 lines
1.7 KiB
package models
|
|
|
|
import (
|
|
"time"
|
|
|
|
"git.ouxuan.net/tommy/osmanthuswine/src/core"
|
|
)
|
|
|
|
const InvitationLetterTableName = TableNamePrefix + "invitation_letter"
|
|
|
|
type InvitationLetter struct {
|
|
Id int `json:"id" xorm:"pk autoincr" description:"主键"`
|
|
UserId int `json:"user_id" xorm:"not null default(0) comment('用户id') INT(11)"`
|
|
ActivityId int `json:"activity_id" xorm:"not null default(0) comment('主活动id') INT(11)"`
|
|
InvitationId int `json:"invitation_id" xorm:"not null default(0) comment('邀请函id') INT(11)"`
|
|
RehearsalId int `json:"rehearsal_id" xorm:"not null default 0 comment('彩排id') INT(11)"`
|
|
ArchId int `json:"arch_id" xorm:"not null default 0 comment('归档id') INT(11)"`
|
|
ExtraData string `json:"extra_data" xorm:"comment('邀请函信息') TEXT"`
|
|
IsDelete bool `json:"is_delete" xorm:"default(0)" description:"删除"`
|
|
CreatedAt time.Time `json:"created_at" xorm:"created" description:"创建"`
|
|
UpdatedAt time.Time `json:"updated_at" xorm:"updated" description:"更新"`
|
|
}
|
|
|
|
func (t *InvitationLetter) TableName() string {
|
|
return InvitationLetterTableName
|
|
}
|
|
|
|
func (t *InvitationLetter) Alias(name string) string {
|
|
return Alias(t, name)
|
|
}
|
|
|
|
func (t *InvitationLetter) GetByUserIdAndActivityId(userId, activityId, archId, rehearsalId interface{}) (bool, error) {
|
|
return core.GetXormAuto().Where("user_id=? and activity_id=? and arch_id=? and rehearsal_id=? and is_delete=0",
|
|
userId, activityId, archId, rehearsalId).Get(t)
|
|
}
|
|
|
|
func (t *InvitationLetter) Count(activityId, archId, rehearsalId interface{}) (int64, error) {
|
|
return core.GetXormAuto().Where("is_delete=0 and activity_id=? and arch_id=? and rehearsal_id=?",
|
|
activityId, archId, rehearsalId).Count(t)
|
|
}
|