evaluation_rule.go
2.3 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package domain
import (
"time"
)
const (
EvaluationTypeRating int = 0 // 评估方式-评级
EvaluationTypeScore int = 1 // 评估方式-评分
)
type Rating struct {
Levels []*RatingLevel `json:"levels" comment:"配置等级"`
}
type RatingLevel struct {
Code string `json:"code" comment:"等级代号"`
Name string `json:"name" comment:"等级名称"`
Color int `json:"color" comment:"等级颜色"`
QuantizedValue float64 `json:"quantizedValue" comment:"等级量化值"`
}
type Score struct {
Min float64 `json:"min" comment:"评分下限"`
Max float64 `json:"max" comment:"评分上限"`
IntervalState int `json:"intervalState" comment:"按分数子区间匹配等级(0关闭、1开启)"`
DecimalPlaces int `json:"decimalPlaces" comment:"保留小数点(0不保留、1保留一位、以此类推)"`
Levels []*ScoreLevel `json:"levels" comment:"配置等级区间"`
}
type ScoreLevel struct {
Code string `json:"code" comment:"等级代号"`
Name string `json:"name" comment:"等级名称"`
Start float64 `json:"start" comment:"分数区间开始值"`
End float64 `json:"end" comment:"分数区间结束值"`
}
type EvaluationRule struct {
Id int64 `json:"id,string" comment:"ID"`
Name string `json:"name" comment:"名称"`
Remark string `json:"remark" comment:"备注"`
CompanyId int64 `json:"companyId,string" comment:"公司ID"`
CreatorId int64 `json:"creatorId,string" comment:"创建人ID"`
Type int `json:"type" comment:"评估方式(0评级、1评分)"`
Rating Rating `json:"rating" comment:"评级"`
Score Score `json:"score" comment:"评分"`
CreatedAt time.Time `json:"createdAt" comment:"创建时间"`
UpdatedAt time.Time `json:"updatedAt" comment:"更新时间"`
DeletedAt *time.Time `json:"deletedAt" comment:"删除时间"`
}
type EvaluationRuleRepository interface {
Insert(rule *EvaluationRule) (*EvaluationRule, error)
Remove(rule *EvaluationRule) (*EvaluationRule, error)
FindOne(queryOptions map[string]interface{}) (*EvaluationRule, error)
Find(queryOptions map[string]interface{}) (int64, []*EvaluationRule, error)
Count(queryOptions map[string]interface{}) (int64, error)
}