Files
yunzerwebsiteallinone/go/models/sched_template.go
T
2026-10-26 08:54:34 +08:00

85 lines
4.2 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
package models
import "time"
// 排班模板对齐方式(align_mode)
//
// 1 按自然周:双休 / 单休 / 大小周,day_index 0=周一 ... 6=周日
// 2 按开始日滚动:三班倒 / 做一休一,从方案开始日期起按周期顺延
// 3 按自然月:月休,按月计算休息日
const (
SchedTplAlignWeek int8 = 1
SchedTplAlignRoll int8 = 2
SchedTplAlignMonth int8 = 3
)
// 排班模板每天类型(day_type)
const (
SchedTplDayWork int8 = 1 // 上班
SchedTplDayRest int8 = 2 // 休息
)
// 排班模板类型(template_type)
const (
SchedTplTypeDoubleWeekend int8 = 1 // 双休
SchedTplTypeSingleWeekend int8 = 2 // 单休
SchedTplTypeBigSmallWeek int8 = 3 // 大小周
SchedTplTypeMonthRest int8 = 4 // 月休
SchedTplTypeThreeShift int8 = 5 // 三班倒
SchedTplTypeWorkRestOne int8 = 6 // 做一休一
SchedTplTypeCustom int8 = 9 // 自定义
)
// PlatformSchedTpl 平台端排班模板 yz_platform_sched_tpl
//
// 模板是全局数据(不按租户隔离),只有平台端可维护;系统预置模板
// (is_system=1)由平台锁定,禁止编辑 / 删除 / 停用。租户端调用模板时
// 会把规则快照进自己的排班方案(OaSchedulePlan.Pattern),之后互不影响。
type PlatformSchedTpl struct {
ID uint64 `orm:"column(id);pk;auto" json:"id"`
Code string `orm:"column(code);size(50);default()" json:"code"`
Name string `orm:"column(name);size(50)" json:"name"`
TemplateType int8 `orm:"column(template_type);default(9)" json:"template_type"`
AlignMode int8 `orm:"column(align_mode);default(1)" json:"align_mode"`
CycleDays int `orm:"column(cycle_days);default(7)" json:"cycle_days"`
WeekOffset int8 `orm:"column(week_offset);default(0)" json:"week_offset"`
MonthRestDays int8 `orm:"column(month_rest_days);default(0)" json:"month_rest_days"`
MonthRestWeekday int8 `orm:"column(month_rest_weekday);default(0)" json:"month_rest_weekday"`
Summary string `orm:"column(summary);size(255);default()" json:"summary"`
IsSystem int8 `orm:"column(is_system);default(0)" json:"is_system"`
Status int8 `orm:"column(status);default(1)" json:"status"`
Sort int `orm:"column(sort);default(0)" json:"sort"`
Creater string `orm:"column(creater);size(50);default()" json:"creater"`
CreateTime time.Time `orm:"column(create_time);auto_now_add;type(datetime)" json:"create_time"`
UpdateTime *time.Time `orm:"column(update_time);auto_now;type(datetime);null" json:"update_time"`
DeleteTime *time.Time `orm:"column(delete_time);type(datetime);null" json:"delete_time"`
}
func (m *PlatformSchedTpl) TableName() string {
return "yz_platform_sched_tpl"
}
// PlatformSchedTplDay 平台端排班模板的周期每日规则 yz_platform_sched_tpl_day
//
// day_index 为周期内第几天(从 0 开始)。day_type=2 表示休息,
// 此时班次字段为空;day_type=1 时填写班次名称与上下班时间。
type PlatformSchedTplDay struct {
ID uint64 `orm:"column(id);pk;auto" json:"id"`
TemplateID uint64 `orm:"column(template_id);default(0)" json:"template_id"`
DayIndex int `orm:"column(day_index);default(0)" json:"day_index"`
DayType int8 `orm:"column(day_type);default(1)" json:"day_type"`
ShiftName string `orm:"column(shift_name);size(50);default()" json:"shift_name"`
ShiftShort string `orm:"column(shift_short);size(20);default()" json:"shift_short"`
Color string `orm:"column(color);size(20);default(#409EFF)" json:"color"`
WorkStart string `orm:"column(work_start);size(8);default()" json:"work_start"`
WorkEnd string `orm:"column(work_end);size(8);default()" json:"work_end"`
RestStart string `orm:"column(rest_start);size(8);default()" json:"rest_start"`
RestEnd string `orm:"column(rest_end);size(8);default()" json:"rest_end"`
WorkHours float64 `orm:"column(work_hours);type(decimal);digits(5);decimals(2);default(0)" json:"work_hours"`
Remark string `orm:"column(remark);size(100);default()" json:"remark"`
}
func (m *PlatformSchedTplDay) TableName() string {
return "yz_platform_sched_tpl_day"
}