审查视图

pkg/domain/evaluation_template.go 3.7 KB
郑周 authored
1 2 3 4 5 6 7 8 9 10 11 12 13 14
package domain

import (
	"time"
)

const (
	TemplateStateWaitConfig int = 0 // 模板状态-待完成配置
	TemplateStateWaitActive int = 1 // 模板状态-待启用
	TemplateStateEnable     int = 2 // 模板状态-启用
	TemplateStateDisable    int = 3 // 模板状态-停用
)

const (
郑周 authored
15 16 17 18 19
	LinkNodeSelfAssessment     int = 1 // 环节-填写反馈自评
	LinkNodeAllInvite          int = 2 // 环节-360°邀请
	LinkNodeAllAssessment      int = 3 // 环节-360°评估
	LinkNodeSuperiorAssessment int = 4 // 环节-上级评估
	LinkNodeViewResult         int = 5 // 环节-绩效结果查看
郑周 authored
20 21
)
22
const (
23 24
	NodeRequiredYes int = 1 // 必填项-必填(默认)
	NodeRequiredNo  int = 2 // 必填项-非必填
25 26
)
27 28 29 30 31
const (
	IndicatorTypeDef  int = 0 // 指标类型-指标
	IndicatorTypeTask int = 1 // 指标类型-任务
)
郑周 authored
32
type EntryItem struct {
庄敏学 authored
33 34 35
	Title      string `json:"title" comment:"填写标题"`
	HintText   string `json:"hintText" comment:"文本内容提示"`
	Definition string `json:"definition" comment:"定义"`
郑周 authored
36 37
}
38 39
// NodeContent 评估内容
type NodeContent struct {
40 41 42 43 44 45 46 47 48 49
	Category      string          `json:"category" comment:"类别"`
	Name          string          `json:"name" comment:"名称"`
	RuleId        int64           `json:"ruleId,string" comment:"评估规则ID"`
	Rule          *EvaluationRule `json:"rule" comment:"评估规则对象"`
	Weight        float64         `json:"weight" comment:"权重"`
	PromptTitle   string          `json:"promptTitle" comment:"提示项标题"`
	PromptText    string          `json:"promptText" comment:"提示项正文"`
	EntryItems    []*EntryItem    `json:"entryItems" comment:"填写项"`
	Required      int             `json:"required" comment:"必填项"`
	EvaluatorId   int64           `json:"evaluatorId,string" comment:"项目评估人ID ( 0=无评估人、-1=HRBP、评估人ID)"`
郑周 authored
50
	IndicatorType int             `json:"indicatorType" comment:"指标类型(0指标、1任务)"`
郑周 authored
51 52
}
53
// LinkNode 评估流程、环节
54
type LinkNode struct {
55 56 57 58 59 60 61
	Id           int64          `json:"id,string" comment:"环节ID"`
	Type         int            `json:"type" comment:"环节类型"`
	Name         string         `json:"name" comment:"环节名称"`
	Describe     string         `json:"describe" comment:"环节描述"`
	NodeContents []*NodeContent `json:"nodeContents" comment:"环节-评估内容"`
	TimeStart    *time.Time     `json:"timeStart" comment:"起始时间"`
	TimeEnd      *time.Time     `json:"timeEnd" comment:"截至时间"`
郑周 authored
62
	KpiCycle     int            `json:"kpiCycle" comment:"考核周期(1日、2周、3月)"`
63
}
郑周 authored
64
65
// EvaluationTemplate 评估模板
郑周 authored
66
type EvaluationTemplate struct {
郑周 authored
67 68 69 70 71 72 73 74 75 76
	Id        int64       `json:"id,string" comment:"ID"`
	Name      string      `json:"name" comment:"名称"`
	Describe  string      `json:"describe" comment:"描述"`
	CompanyId int64       `json:"companyId,string" comment:"公司ID"`
	CreatorId int64       `json:"creatorId,string" comment:"创建人ID"`
	State     int         `json:"state" comment:"状态(0待完成配置、1待启用、2启用、3停用)"`
	LinkNodes []*LinkNode `json:"linkNodes" comment:"评估流程"`
	CreatedAt time.Time   `json:"createdAt" comment:"创建时间"`
	UpdatedAt time.Time   `json:"updatedAt" comment:"更新时间"`
	DeletedAt *time.Time  `json:"deletedAt" comment:"删除时间"`
郑周 authored
77
}
78 79 80 81 82

type EvaluationTemplateRepository interface {
	Insert(template *EvaluationTemplate) (*EvaluationTemplate, error)
	Remove(template *EvaluationTemplate) (*EvaluationTemplate, error)
	FindOne(queryOptions map[string]interface{}) (*EvaluationTemplate, error)
郑周 authored
83
	Find(queryOptions map[string]interface{}, excludeColumns ...string) (int64, []*EvaluationTemplate, error)
84 85
	Count(queryOptions map[string]interface{}) (int64, error)
}