WiiCITMS/models/oa/schedule.go

43 lines
2.2 KiB
Go
Raw Normal View History

2025-11-07 14:14:34 +08:00
package oa
import (
"time"
"WiiGoLibrary/framework/db/v1/utils/mssql/unique"
"WiiGoLibrary/framework/hub/v1/dblib"
)
const ScheduleTable = "oa_t_schedule"
// ScheduleModel 个人日程
type ScheduleModel struct {
RecordGuid unique.UUID `gorm:"column:RecordGuid;type:UNIQUEIDENTIFIER;primaryKey;not null;default:newid();" json:"RecordGuid"`
OwnerStaffGuid unique.UUID `gorm:"column:OwnerStaffGuid;type:UNIQUEIDENTIFIER;not null;index" json:"OwnerStaffGuid"` // 所属员工
Title string `gorm:"column:Title;type:NVARCHAR(200);not null;" json:"Title"`
Description string `gorm:"column:Description;type:NVARCHAR(1000);" json:"Description"`
Location string `gorm:"column:Location;type:NVARCHAR(200);" json:"Location"`
StartTime time.Time `gorm:"column:StartTime;type:DATETIME;not null;index" json:"StartTime"`
EndTime time.Time `gorm:"column:EndTime;type:DATETIME;not null;index" json:"EndTime"`
AllDay bool `gorm:"column:AllDay;type:BIT;default:0;" json:"AllDay"`
RemindMinutesBefore int `gorm:"column:RemindMinutesBefore;type:INT;default:0;" json:"RemindMinutesBefore"` // 提前多少分钟提醒0表示不提醒
Reminded bool `gorm:"column:Reminded;type:BIT;default:0;" json:"Reminded"` // 是否已提醒(一次性)
Status int16 `gorm:"column:Status;type:SMALLINT;default:0;" json:"Status"` // 0=正常, 1=取消
RecordStatus int16 `gorm:"column:RecordStatus;not null;default:0;" json:"RecordStatus"`
CreateTime time.Time `gorm:"column:CreateTime;type:DATETIME;default:CURRENT_TIMESTAMP;<-:create;" json:"CreateTime"`
UpdateTime time.Time `gorm:"column:UpdateTime;type:DATETIME;default:CURRENT_TIMESTAMP;autoUpdateTime;" json:"UpdateTime"`
}
func init() {
dblib.DBIns.RegisterAutoMigrateModel(&ScheduleModel{})
}
func (m *ScheduleModel) TableName() string { return ScheduleTable }
func ScheduleInstance() *ScheduleModel {
return &ScheduleModel{
RecordGuid: unique.NewV4(),
RecordStatus: 0,
Status: 0,
}
}