Files
ArmedPolice/app/common/model/work_schedule.go
2021-11-08 11:09:27 +08:00

57 lines
1.8 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 model
import "strings"
// WorkSchedule 工单流程数据模型
type WorkSchedule struct {
Model
Title string `gorm:"column:title;type:varchar(30);default:null;comment:标题" json:"title"`
Stage int `orm:"column:stage;type:tinyint(1);default:1;comment:阶段" json:"stage"`
Step int `orm:"column:step;type:tinyint(1);default:1;comment:步骤1阶段-1步骤" json:"step"`
Target WorkScheduleTarget `orm:"column:target;type:tinyint(1);default:1;comment:对象类型" json:"target"`
TargetValue string `orm:"column:target_value;type:tinyint(1);default:1;comment:对象信息" json:"target_value"`
IsCountersign WorkScheduleCountersign `orm:"column:is_countersign;type:tinyint(1);default:0;comment:是否会签" json:"is_countersign"`
ModelDeleted
ModelAt
}
// WorkScheduleTarget 工单对象类型
type WorkScheduleTarget int
const (
// WorkScheduleTargetForPerson 个人
WorkScheduleTargetForPerson WorkScheduleTarget = iota + 1
// WorkScheduleTargetForRole 角色
WorkScheduleTargetForRole
)
// WorkScheduleCountersign 工单会签模式
type WorkScheduleCountersign int
const (
// WorkScheduleCountersignForNot 不是会签模式
WorkScheduleCountersignForNot WorkScheduleCountersign = iota
// WorkScheduleCountersignForYes 是会签模式
WorkScheduleCountersignForYes
)
func (m *WorkSchedule) TableName() string {
return "work_schedule"
}
func (m *WorkSchedule) CountersignStatus() bool {
return m.IsCountersign == WorkScheduleCountersignForYes
}
func (m *WorkSchedule) GetTargetValueAttribute() []string {
return strings.Split(m.TargetValue, ",")
}
func (m *WorkSchedule) SetTargetValueAttribute(value []string) {
m.TargetValue = strings.Join(value, ",")
}
func NewWorkSchedule() *WorkSchedule {
return &WorkSchedule{}
}