正在显示
20 个修改的文件
包含
127 行增加
和
76 行删除
@@ -249,10 +249,9 @@ func (rs *EvaluationCycleService) List(in *command.QueryCycleCommand) (interface | @@ -249,10 +249,9 @@ func (rs *EvaluationCycleService) List(in *command.QueryCycleCommand) (interface | ||
249 | transactionContext.RollbackTransaction() | 249 | transactionContext.RollbackTransaction() |
250 | }() | 250 | }() |
251 | cycleRepository := factory.CreateEvaluationCycleRepository(map[string]interface{}{"transactionContext": transactionContext}) | 251 | cycleRepository := factory.CreateEvaluationCycleRepository(map[string]interface{}{"transactionContext": transactionContext}) |
252 | - // FIXME 总数量是否使用Count获取一个总数量 | ||
253 | - count, cycles, err := cycleRepository.Find(tool_funs.SimpleStructToMap(in)) | 252 | + total, cycles, err := cycleRepository.Find(tool_funs.SimpleStructToMap(in)) |
254 | if err != nil { | 253 | if err != nil { |
255 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 254 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
256 | } | 255 | } |
257 | - return tool_funs.SimpleWrapGridMap(count, cycles), nil | 256 | + return tool_funs.SimpleWrapGridMap(total, cycles), nil |
258 | } | 257 | } |
@@ -268,8 +268,7 @@ func (rs *EvaluationProjectService) List(in *command.QueryProjectCommand) (inter | @@ -268,8 +268,7 @@ func (rs *EvaluationProjectService) List(in *command.QueryProjectCommand) (inter | ||
268 | }() | 268 | }() |
269 | 269 | ||
270 | projectRepository := factory.CreateEvaluationProjectRepository(map[string]interface{}{"transactionContext": transactionContext}) | 270 | projectRepository := factory.CreateEvaluationProjectRepository(map[string]interface{}{"transactionContext": transactionContext}) |
271 | - // FIXME 总数量是否使用Count获取一个总数量 | ||
272 | - count, projects, err := projectRepository.Find(tool_funs.SimpleStructToMap(in), "linkNodes") | 271 | + total, projects, err := projectRepository.Find(tool_funs.SimpleStructToMap(in), "linkNodes") |
273 | if err != nil { | 272 | if err != nil { |
274 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 273 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
275 | } | 274 | } |
@@ -288,7 +287,7 @@ func (rs *EvaluationProjectService) List(in *command.QueryProjectCommand) (inter | @@ -288,7 +287,7 @@ func (rs *EvaluationProjectService) List(in *command.QueryProjectCommand) (inter | ||
288 | pmpUsers = users | 287 | pmpUsers = users |
289 | } | 288 | } |
290 | projectAdapters := adapter.TransformProjectListAdapter(projects, pmpUsers) | 289 | projectAdapters := adapter.TransformProjectListAdapter(projects, pmpUsers) |
291 | - return tool_funs.SimpleWrapGridMap(count, projectAdapters), nil | 290 | + return tool_funs.SimpleWrapGridMap(total, projectAdapters), nil |
292 | } | 291 | } |
293 | 292 | ||
294 | func (rs *EvaluationProjectService) State(in *command.StateProjectCommand) (interface{}, error) { | 293 | func (rs *EvaluationProjectService) State(in *command.StateProjectCommand) (interface{}, error) { |
@@ -6,13 +6,13 @@ import ( | @@ -6,13 +6,13 @@ import ( | ||
6 | ) | 6 | ) |
7 | 7 | ||
8 | type CreateRuleCommand struct { | 8 | type CreateRuleCommand struct { |
9 | - CompanyId int64 `cname:"公司ID" json:"companyId"` | ||
10 | - CreatorId int64 `cname:"创建人ID" json:"creatorId"` | ||
11 | - Name string `cname:"规则名称" json:"name" valid:"Required"` | ||
12 | - Remark string `cname:"规则备注" json:"remark"` | ||
13 | - Type int `cname:"评估方式" json:"type"` | ||
14 | - Rating *domain.Rating `cname:"评级" json:"rating"` | ||
15 | - Score *domain.Score `cname:"评分" json:"score"` | 9 | + CompanyId int64 `cname:"公司ID" json:"companyId"` |
10 | + CreatorId int64 `cname:"创建人ID" json:"creatorId"` | ||
11 | + Name string `cname:"规则名称" json:"name" valid:"Required"` | ||
12 | + Remark string `cname:"规则备注" json:"remark"` | ||
13 | + Type int `cname:"评估方式" json:"type"` | ||
14 | + Rating domain.Rating `cname:"评级" json:"rating"` | ||
15 | + Score domain.Score `cname:"评分" json:"score"` | ||
16 | } | 16 | } |
17 | 17 | ||
18 | func (in *CreateRuleCommand) Valid(validation *validation.Validation) { | 18 | func (in *CreateRuleCommand) Valid(validation *validation.Validation) { |
@@ -26,20 +26,23 @@ func (in *CreateRuleCommand) Valid(validation *validation.Validation) { | @@ -26,20 +26,23 @@ func (in *CreateRuleCommand) Valid(validation *validation.Validation) { | ||
26 | } | 26 | } |
27 | 27 | ||
28 | if len(in.Name) > 40 { | 28 | if len(in.Name) > 40 { |
29 | - validation.SetError("name", "角色名称最大长度40个字符") | 29 | + validation.SetError("name", "名称最大长度40个字符") |
30 | + return | ||
31 | + } | ||
32 | + | ||
33 | + if len(in.Remark) > 100 { | ||
34 | + validation.SetError("remark", "备注不能超过100个字符") | ||
30 | return | 35 | return |
31 | } | 36 | } |
32 | 37 | ||
33 | if in.Type == domain.EvaluationTypeRating { | 38 | if in.Type == domain.EvaluationTypeRating { |
34 | - if nil == in.Rating || len(in.Rating.Levels) == 0 { | 39 | + if len(in.Rating.Levels) == 0 { |
35 | validation.SetError("rating", "评级内容不能为空") | 40 | validation.SetError("rating", "评级内容不能为空") |
36 | return | 41 | return |
37 | } | 42 | } |
38 | - } | ||
39 | - | ||
40 | - if in.Type == domain.EvaluationTypeScore { | ||
41 | - if nil == in.Score { | ||
42 | - validation.SetError("rating", "评分内容不能为空") | 43 | + } else if in.Type == domain.EvaluationTypeScore { |
44 | + if len(in.Score.Levels) == 0 { | ||
45 | + validation.SetError("score", "评分内容不能为空") | ||
43 | return | 46 | return |
44 | } | 47 | } |
45 | } | 48 | } |
@@ -5,6 +5,8 @@ import "github.com/beego/beego/v2/core/validation" | @@ -5,6 +5,8 @@ import "github.com/beego/beego/v2/core/validation" | ||
5 | type QueryRuleCommand struct { | 5 | type QueryRuleCommand struct { |
6 | CompanyId int64 `cname:"公司ID" json:"companyId"` | 6 | CompanyId int64 `cname:"公司ID" json:"companyId"` |
7 | NameOrRemark string `cname:"规则名称或备注" json:"nameOrRemark"` | 7 | NameOrRemark string `cname:"规则名称或备注" json:"nameOrRemark"` |
8 | + Type int `cname:"评估方式(0评级、1评分)" json:"type"` | ||
9 | + CreatorId int64 `cname:"创建人ID" json:"creatorId,string"` | ||
8 | PageNumber int `cname:"分页页码" json:"pageNumber" valid:"Required"` | 10 | PageNumber int `cname:"分页页码" json:"pageNumber" valid:"Required"` |
9 | PageSize int `cname:"分页数量" json:"pageSize" valid:"Required"` | 11 | PageSize int `cname:"分页数量" json:"pageSize" valid:"Required"` |
10 | } | 12 | } |
@@ -6,14 +6,14 @@ import ( | @@ -6,14 +6,14 @@ import ( | ||
6 | ) | 6 | ) |
7 | 7 | ||
8 | type UpdateRuleCommand struct { | 8 | type UpdateRuleCommand struct { |
9 | - Id int64 `cname:"规则ID" json:"id,string" valid:"Required"` | ||
10 | - CompanyId int64 `cname:"公司ID" json:"companyId"` | ||
11 | - CreatorId int64 `cname:"创建人ID" json:"creatorId"` | ||
12 | - Name string `cname:"规则名称" json:"name" valid:"Required"` | ||
13 | - Remark string `cname:"规则备注" json:"remark"` | ||
14 | - Type int `cname:"评估方式" json:"type"` | ||
15 | - Rating *domain.Rating `cname:"评级" json:"rating"` | ||
16 | - Score *domain.Score `cname:"评分" json:"score"` | 9 | + Id int64 `cname:"规则ID" json:"id,string" valid:"Required"` |
10 | + CompanyId int64 `cname:"公司ID" json:"companyId"` | ||
11 | + CreatorId int64 `cname:"创建人ID" json:"creatorId"` | ||
12 | + Name string `cname:"规则名称" json:"name" valid:"Required"` | ||
13 | + Remark string `cname:"规则备注" json:"remark"` | ||
14 | + Type int `cname:"评估方式" json:"type"` | ||
15 | + Rating domain.Rating `cname:"评级" json:"rating"` | ||
16 | + Score domain.Score `cname:"评分" json:"score"` | ||
17 | } | 17 | } |
18 | 18 | ||
19 | func (in *UpdateRuleCommand) Valid(validation *validation.Validation) { | 19 | func (in *UpdateRuleCommand) Valid(validation *validation.Validation) { |
@@ -27,20 +27,23 @@ func (in *UpdateRuleCommand) Valid(validation *validation.Validation) { | @@ -27,20 +27,23 @@ func (in *UpdateRuleCommand) Valid(validation *validation.Validation) { | ||
27 | } | 27 | } |
28 | 28 | ||
29 | if len(in.Name) > 40 { | 29 | if len(in.Name) > 40 { |
30 | - validation.SetError("name", "角色名称最大长度40个字符") | 30 | + validation.SetError("name", "名称最大长度40个字符") |
31 | + return | ||
32 | + } | ||
33 | + | ||
34 | + if len(in.Remark) > 100 { | ||
35 | + validation.SetError("remark", "备注不能超过100个字符") | ||
31 | return | 36 | return |
32 | } | 37 | } |
33 | 38 | ||
34 | if in.Type == domain.EvaluationTypeRating { | 39 | if in.Type == domain.EvaluationTypeRating { |
35 | - if nil == in.Rating || len(in.Rating.Levels) == 0 { | 40 | + if len(in.Rating.Levels) == 0 { |
36 | validation.SetError("rating", "评级内容不能为空") | 41 | validation.SetError("rating", "评级内容不能为空") |
37 | return | 42 | return |
38 | } | 43 | } |
39 | - } | ||
40 | - | ||
41 | - if in.Type == domain.EvaluationTypeScore { | ||
42 | - if nil == in.Score { | ||
43 | - validation.SetError("rating", "评分内容不能为空") | 44 | + } else if in.Type == domain.EvaluationTypeScore { |
45 | + if len(in.Score.Levels) == 0 { | ||
46 | + validation.SetError("score", "评分内容不能为空") | ||
44 | return | 47 | return |
45 | } | 48 | } |
46 | } | 49 | } |
@@ -7,6 +7,7 @@ import ( | @@ -7,6 +7,7 @@ import ( | ||
7 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/evaluation_rule/command" | 7 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/evaluation_rule/command" |
8 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory" | 8 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory" |
9 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" | 9 | "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" |
10 | + "sort" | ||
10 | ) | 11 | ) |
11 | 12 | ||
12 | type EvaluationRuleService struct { | 13 | type EvaluationRuleService struct { |
@@ -36,6 +37,13 @@ func (rs *EvaluationRuleService) Create(in *command.CreateRuleCommand) (interfac | @@ -36,6 +37,13 @@ func (rs *EvaluationRuleService) Create(in *command.CreateRuleCommand) (interfac | ||
36 | if count > 0 { | 37 | if count > 0 { |
37 | return nil, application.ThrowError(application.BUSINESS_ERROR, "名称已存在") | 38 | return nil, application.ThrowError(application.BUSINESS_ERROR, "名称已存在") |
38 | } | 39 | } |
40 | + | ||
41 | + if in.Type == domain.EvaluationTypeRating { // 按等级量化值排序 | ||
42 | + sort.SliceStable(in.Rating.Levels, func(i, j int) bool { | ||
43 | + return in.Rating.Levels[i].QuantizedValue < in.Rating.Levels[j].QuantizedValue | ||
44 | + }) | ||
45 | + } | ||
46 | + | ||
39 | newRule := &domain.EvaluationRule{ | 47 | newRule := &domain.EvaluationRule{ |
40 | Id: 0, | 48 | Id: 0, |
41 | Name: in.Name, | 49 | Name: in.Name, |
@@ -82,6 +90,12 @@ func (rs *EvaluationRuleService) Update(in *command.UpdateRuleCommand) (interfac | @@ -82,6 +90,12 @@ func (rs *EvaluationRuleService) Update(in *command.UpdateRuleCommand) (interfac | ||
82 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 90 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
83 | } | 91 | } |
84 | 92 | ||
93 | + if in.Type == domain.EvaluationTypeRating { // 按等级量化值排序 | ||
94 | + sort.SliceStable(in.Rating.Levels, func(i, j int) bool { | ||
95 | + return in.Rating.Levels[i].QuantizedValue < in.Rating.Levels[j].QuantizedValue | ||
96 | + }) | ||
97 | + } | ||
98 | + | ||
85 | rule.Name = in.Name | 99 | rule.Name = in.Name |
86 | rule.Remark = in.Remark | 100 | rule.Remark = in.Remark |
87 | rule.Type = in.Type | 101 | rule.Type = in.Type |
@@ -152,12 +166,12 @@ func (rs *EvaluationRuleService) List(in *command.QueryRuleCommand) (interface{} | @@ -152,12 +166,12 @@ func (rs *EvaluationRuleService) List(in *command.QueryRuleCommand) (interface{} | ||
152 | transactionContext.RollbackTransaction() | 166 | transactionContext.RollbackTransaction() |
153 | }() | 167 | }() |
154 | ruleRepository := factory.CreateEvaluationRuleRepository(map[string]interface{}{"transactionContext": transactionContext}) | 168 | ruleRepository := factory.CreateEvaluationRuleRepository(map[string]interface{}{"transactionContext": transactionContext}) |
155 | - // FIXME 总数量是否使用Count获取一个总数量 | ||
156 | - count, rules, err := ruleRepository.Find(tool_funs.SimpleStructToMap(in)) | 169 | + |
170 | + total, rules, err := ruleRepository.Find(tool_funs.SimpleStructToMap(in)) | ||
157 | if err != nil { | 171 | if err != nil { |
158 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 172 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
159 | } | 173 | } |
160 | - return tool_funs.SimpleWrapGridMap(count, rules), nil | 174 | + return tool_funs.SimpleWrapGridMap(total, rules), nil |
161 | } | 175 | } |
162 | 176 | ||
163 | func (rs *EvaluationRuleService) ListRelCreator(in *command.QueryRuleCommand) (interface{}, error) { | 177 | func (rs *EvaluationRuleService) ListRelCreator(in *command.QueryRuleCommand) (interface{}, error) { |
@@ -171,8 +185,7 @@ func (rs *EvaluationRuleService) ListRelCreator(in *command.QueryRuleCommand) (i | @@ -171,8 +185,7 @@ func (rs *EvaluationRuleService) ListRelCreator(in *command.QueryRuleCommand) (i | ||
171 | ruleRepository := factory.CreateEvaluationRuleRepository(map[string]interface{}{"transactionContext": transactionContext}) | 185 | ruleRepository := factory.CreateEvaluationRuleRepository(map[string]interface{}{"transactionContext": transactionContext}) |
172 | userRepository := factory.CreateUserRepository(map[string]interface{}{"transactionContext": transactionContext}) | 186 | userRepository := factory.CreateUserRepository(map[string]interface{}{"transactionContext": transactionContext}) |
173 | 187 | ||
174 | - // FIXME 总数量是否使用Count获取一个总数量 | ||
175 | - count, rules, err := ruleRepository.Find(tool_funs.SimpleStructToMap(in)) | 188 | + total, rules, err := ruleRepository.Find(tool_funs.SimpleStructToMap(in)) |
176 | if err != nil { | 189 | if err != nil { |
177 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 190 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
178 | } | 191 | } |
@@ -197,5 +210,5 @@ func (rs *EvaluationRuleService) ListRelCreator(in *command.QueryRuleCommand) (i | @@ -197,5 +210,5 @@ func (rs *EvaluationRuleService) ListRelCreator(in *command.QueryRuleCommand) (i | ||
197 | ras[i].CreatorName = v | 210 | ras[i].CreatorName = v |
198 | } | 211 | } |
199 | } | 212 | } |
200 | - return tool_funs.SimpleWrapGridMap(count, ras), nil | 213 | + return tool_funs.SimpleWrapGridMap(total, ras), nil |
201 | } | 214 | } |
@@ -184,13 +184,11 @@ func (rs *EvaluationTemplateService) List(in *command.QueryTemplateCommand) (int | @@ -184,13 +184,11 @@ func (rs *EvaluationTemplateService) List(in *command.QueryTemplateCommand) (int | ||
184 | transactionContext.RollbackTransaction() | 184 | transactionContext.RollbackTransaction() |
185 | }() | 185 | }() |
186 | templateRepository := factory.CreateEvaluationTemplateRepository(map[string]interface{}{"transactionContext": transactionContext}) | 186 | templateRepository := factory.CreateEvaluationTemplateRepository(map[string]interface{}{"transactionContext": transactionContext}) |
187 | - | ||
188 | - // FIXME 总数量是否使用Count获取一个总数量 | ||
189 | - count, templates, err := templateRepository.Find(tool_funs.SimpleStructToMap(in), "linkNodes") | 187 | + total, templates, err := templateRepository.Find(tool_funs.SimpleStructToMap(in), "linkNodes") |
190 | if err != nil { | 188 | if err != nil { |
191 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 189 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
192 | } | 190 | } |
193 | - return tool_funs.SimpleWrapGridMap(count, templates), nil | 191 | + return tool_funs.SimpleWrapGridMap(total, templates), nil |
194 | } | 192 | } |
195 | 193 | ||
196 | func (rs *EvaluationTemplateService) ListForEnable(in *command.AllEnableTemplateCommand) (interface{}, error) { | 194 | func (rs *EvaluationTemplateService) ListForEnable(in *command.AllEnableTemplateCommand) (interface{}, error) { |
@@ -17,7 +17,7 @@ type EvaluationCycle struct { | @@ -17,7 +17,7 @@ type EvaluationCycle struct { | ||
17 | TimeEnd *time.Time `json:"timeEnd" comment:"截至时间"` | 17 | TimeEnd *time.Time `json:"timeEnd" comment:"截至时间"` |
18 | CompanyId int64 `json:"companyId,string" comment:"公司ID"` | 18 | CompanyId int64 `json:"companyId,string" comment:"公司ID"` |
19 | CreatorId int64 `json:"creatorId,string" comment:"创建人ID"` | 19 | CreatorId int64 `json:"creatorId,string" comment:"创建人ID"` |
20 | - KpiCycle int `json:"state" comment:"考核周期(0日、1周、2月)"` | 20 | + KpiCycle int `json:"state" comment:"考核周期(1日、2周、3月)"` |
21 | CreatedAt time.Time `json:"createdAt" comment:"创建时间"` | 21 | CreatedAt time.Time `json:"createdAt" comment:"创建时间"` |
22 | UpdatedAt time.Time `json:"updatedAt" comment:"更新时间"` | 22 | UpdatedAt time.Time `json:"updatedAt" comment:"更新时间"` |
23 | DeletedAt *time.Time `json:"deletedAt" comment:"删除时间"` | 23 | DeletedAt *time.Time `json:"deletedAt" comment:"删除时间"` |
@@ -42,8 +42,8 @@ type EvaluationRule struct { | @@ -42,8 +42,8 @@ type EvaluationRule struct { | ||
42 | CompanyId int64 `json:"companyId,string" comment:"公司ID"` | 42 | CompanyId int64 `json:"companyId,string" comment:"公司ID"` |
43 | CreatorId int64 `json:"creatorId,string" comment:"创建人ID"` | 43 | CreatorId int64 `json:"creatorId,string" comment:"创建人ID"` |
44 | Type int `json:"type" comment:"评估方式(0评级、1评分)"` | 44 | Type int `json:"type" comment:"评估方式(0评级、1评分)"` |
45 | - Rating *Rating `json:"rating" comment:"评级"` | ||
46 | - Score *Score `json:"score" comment:"评分"` | 45 | + Rating Rating `json:"rating" comment:"评级"` |
46 | + Score Score `json:"score" comment:"评分"` | ||
47 | CreatedAt time.Time `json:"createdAt" comment:"创建时间"` | 47 | CreatedAt time.Time `json:"createdAt" comment:"创建时间"` |
48 | UpdatedAt time.Time `json:"updatedAt" comment:"更新时间"` | 48 | UpdatedAt time.Time `json:"updatedAt" comment:"更新时间"` |
49 | DeletedAt *time.Time `json:"deletedAt" comment:"删除时间"` | 49 | DeletedAt *time.Time `json:"deletedAt" comment:"删除时间"` |
@@ -25,9 +25,9 @@ const ( | @@ -25,9 +25,9 @@ const ( | ||
25 | ) | 25 | ) |
26 | 26 | ||
27 | const ( | 27 | const ( |
28 | - KpiCycleDay int = 0 // 考核周期-日 | ||
29 | - KpiCycleWeek int = 1 // 考核周期-周 | ||
30 | - KpiCycleMonth int = 2 // 考核周期-月 | 28 | + KpiCycleDay int = 1 // 考核周期-日 |
29 | + KpiCycleWeek int = 2 // 考核周期-周 | ||
30 | + KpiCycleMonth int = 3 // 考核周期-月 | ||
31 | ) | 31 | ) |
32 | 32 | ||
33 | type EntryItem struct { | 33 | type EntryItem struct { |
@@ -65,7 +65,7 @@ type LinkNode struct { | @@ -65,7 +65,7 @@ type LinkNode struct { | ||
65 | NodeAllInvite *NodeAllInvite `json:"nodeAllInvite" comment:"360°邀请人员"` | 65 | NodeAllInvite *NodeAllInvite `json:"nodeAllInvite" comment:"360°邀请人员"` |
66 | TimeStart *time.Time `json:"timeStart" comment:"起始时间"` | 66 | TimeStart *time.Time `json:"timeStart" comment:"起始时间"` |
67 | TimeEnd *time.Time `json:"timeEnd" comment:"截至时间"` | 67 | TimeEnd *time.Time `json:"timeEnd" comment:"截至时间"` |
68 | - KpiCycle int `json:"state" comment:"考核周期(0日、1周、2月)"` | 68 | + KpiCycle int `json:"state" comment:"考核周期(1日、2周、3月)"` |
69 | } | 69 | } |
70 | 70 | ||
71 | // 评估模板 | 71 | // 评估模板 |
@@ -33,6 +33,11 @@ func init() { | @@ -33,6 +33,11 @@ func init() { | ||
33 | &models.ReceivedMessage{}, | 33 | &models.ReceivedMessage{}, |
34 | &models.Role{}, | 34 | &models.Role{}, |
35 | &models.RoleUser{}, | 35 | &models.RoleUser{}, |
36 | + &models.EvaluationRule{}, | ||
37 | + &models.EvaluationTemplate{}, | ||
38 | + &models.EvaluationCycle{}, | ||
39 | + &models.EvaluationCycleTemplate{}, | ||
40 | + &models.EvaluationProject{}, | ||
36 | } | 41 | } |
37 | for _, model := range tables { | 42 | for _, model := range tables { |
38 | err := DB.Model(model).CreateTable(&orm.CreateTableOptions{ | 43 | err := DB.Model(model).CreateTable(&orm.CreateTableOptions{ |
@@ -5,14 +5,14 @@ import ( | @@ -5,14 +5,14 @@ import ( | ||
5 | ) | 5 | ) |
6 | 6 | ||
7 | type EvaluationCycle struct { | 7 | type EvaluationCycle struct { |
8 | - tableName struct{} `pg:"evaluation_cycle" comment:"评估周期"` | ||
9 | - Id int64 `pg:"pk:id" comment:"周期ID"` | 8 | + tableName struct{} `comment:"评估周期" pg:"evaluation_cycle"` |
9 | + Id int64 `comment:"周期ID" pg:"pk:id"` | ||
10 | Name string `comment:"名称"` | 10 | Name string `comment:"名称"` |
11 | TimeStart *time.Time `comment:"起始时间"` | 11 | TimeStart *time.Time `comment:"起始时间"` |
12 | TimeEnd *time.Time `comment:"截至时间"` | 12 | TimeEnd *time.Time `comment:"截至时间"` |
13 | CompanyId int64 `comment:"公司ID"` | 13 | CompanyId int64 `comment:"公司ID"` |
14 | CreatorId int64 `comment:"创建人ID"` | 14 | CreatorId int64 `comment:"创建人ID"` |
15 | - KpiCycle int `comment:"考核周期(0日、1周、2月)"` | 15 | + KpiCycle int `comment:"考核周期(1日、2周、3月)"` |
16 | CreatedAt time.Time `comment:"创建时间"` | 16 | CreatedAt time.Time `comment:"创建时间"` |
17 | UpdatedAt time.Time `comment:"更新时间"` | 17 | UpdatedAt time.Time `comment:"更新时间"` |
18 | DeletedAt *time.Time `comment:"删除时间"` | 18 | DeletedAt *time.Time `comment:"删除时间"` |
@@ -6,8 +6,8 @@ import ( | @@ -6,8 +6,8 @@ import ( | ||
6 | ) | 6 | ) |
7 | 7 | ||
8 | type EvaluationCycleTemplate struct { | 8 | type EvaluationCycleTemplate struct { |
9 | - tableName struct{} `pg:"evaluation_cycle_template" comment:"评估周期模板"` | ||
10 | - Id int64 `pg:"pk:id" comment:"模板ID"` | 9 | + tableName struct{} `comment:"评估周期模板" pg:"evaluation_cycle_template"` |
10 | + Id int64 `comment:"模板ID" pg:"pk:id"` | ||
11 | Name string `comment:"模板名称"` | 11 | Name string `comment:"模板名称"` |
12 | Template *domain.EvaluationTemplate `comment:"模板数据"` | 12 | Template *domain.EvaluationTemplate `comment:"模板数据"` |
13 | CycleId int64 `comment:"周期ID"` | 13 | CycleId int64 `comment:"周期ID"` |
@@ -6,14 +6,14 @@ import ( | @@ -6,14 +6,14 @@ import ( | ||
6 | ) | 6 | ) |
7 | 7 | ||
8 | type EvaluationProject struct { | 8 | type EvaluationProject struct { |
9 | - tableName struct{} `pg:"evaluation_project" comment:"评估项目"` | ||
10 | - Id int64 `pg:"pk:id" comment:"ID"` | 9 | + tableName struct{} `comment:"评估项目" pg:"evaluation_project"` |
10 | + Id int64 `comment:"ID" pg:"pk:id"` | ||
11 | Name string `comment:"名称"` | 11 | Name string `comment:"名称"` |
12 | Describe string `comment:"描述"` | 12 | Describe string `comment:"描述"` |
13 | CompanyId int64 `comment:"公司ID"` | 13 | CompanyId int64 `comment:"公司ID"` |
14 | CycleId int64 `comment:"周期ID"` | 14 | CycleId int64 `comment:"周期ID"` |
15 | CreatorId int64 `comment:"创建人ID"` | 15 | CreatorId int64 `comment:"创建人ID"` |
16 | - State int `comment:"状态(0待完成配置、1待启用、2启用、3停用)"` | 16 | + State int `comment:"状态(0待完成配置、1待启用、2启用、3停用)" pg:",use_zero"` |
17 | HrBp int `comment:"HR角色权限"` | 17 | HrBp int `comment:"HR角色权限"` |
18 | Pmp int `comment:"PM角色权限"` | 18 | Pmp int `comment:"PM角色权限"` |
19 | PmpIds []string `comment:"项目管理员ID"` | 19 | PmpIds []string `comment:"项目管理员ID"` |
@@ -6,16 +6,16 @@ import ( | @@ -6,16 +6,16 @@ import ( | ||
6 | ) | 6 | ) |
7 | 7 | ||
8 | type EvaluationRule struct { | 8 | type EvaluationRule struct { |
9 | - tableName struct{} `pg:"evaluation_rule" comment:"评估规则"` | ||
10 | - Id int64 `pg:"pk:id" comment:"ID"` | ||
11 | - Name string `comment:"名称"` | ||
12 | - Remark string `comment:"备注"` | ||
13 | - CompanyId int64 `comment:"公司ID"` | ||
14 | - CreatorId int64 `comment:"创建人ID"` | ||
15 | - Type int `comment:"评估方式(0评级、1评分)"` | ||
16 | - Rating *domain.Rating `comment:"评级"` | ||
17 | - Score *domain.Score `comment:"评分"` | ||
18 | - CreatedAt time.Time `comment:"创建时间"` | ||
19 | - UpdatedAt time.Time `comment:"更新时间"` | ||
20 | - DeletedAt *time.Time `comment:"删除时间"` | 9 | + tableName struct{} `comment:"评估规则" pg:"evaluation_rule"` |
10 | + Id int64 `comment:"ID" pg:"pk:id"` | ||
11 | + Name string `comment:"名称"` | ||
12 | + Remark string `comment:"备注"` | ||
13 | + CompanyId int64 `comment:"公司ID"` | ||
14 | + CreatorId int64 `comment:"创建人ID"` | ||
15 | + Type int `comment:"评估方式(0评级、1评分)" pg:",use_zero"` | ||
16 | + Rating domain.Rating `comment:"评级"` | ||
17 | + Score domain.Score `comment:"评分"` | ||
18 | + CreatedAt time.Time `comment:"创建时间"` | ||
19 | + UpdatedAt time.Time `comment:"更新时间"` | ||
20 | + DeletedAt *time.Time `comment:"删除时间" pg:",soft_delete"` | ||
21 | } | 21 | } |
@@ -6,13 +6,13 @@ import ( | @@ -6,13 +6,13 @@ import ( | ||
6 | ) | 6 | ) |
7 | 7 | ||
8 | type EvaluationTemplate struct { | 8 | type EvaluationTemplate struct { |
9 | - tableName struct{} `pg:"evaluation_template" comment:"评估模板"` | ||
10 | - Id int64 `comment:"ID"` | 9 | + tableName struct{} `comment:"评估模板" pg:"evaluation_template"` |
10 | + Id int64 `comment:"ID" pg:"pk:id"` | ||
11 | Name string `comment:"名称"` | 11 | Name string `comment:"名称"` |
12 | Describe string `comment:"描述"` | 12 | Describe string `comment:"描述"` |
13 | CompanyId int64 `comment:"公司ID"` | 13 | CompanyId int64 `comment:"公司ID"` |
14 | CreatorId int64 `comment:"创建人ID"` | 14 | CreatorId int64 `comment:"创建人ID"` |
15 | - State int `comment:"状态(0待完成配置、1待启用、2启用、3停用)"` | 15 | + State int `comment:"状态(0待完成配置、1待启用、2启用、3停用)" pg:",use_zero"` |
16 | LinkNodes []*domain.LinkNode `comment:"评估流程"` | 16 | LinkNodes []*domain.LinkNode `comment:"评估流程"` |
17 | CreatedAt time.Time `comment:"创建时间"` | 17 | CreatedAt time.Time `comment:"创建时间"` |
18 | UpdatedAt time.Time `comment:"更新时间"` | 18 | UpdatedAt time.Time `comment:"更新时间"` |
@@ -6,7 +6,7 @@ type Role struct { | @@ -6,7 +6,7 @@ type Role struct { | ||
6 | tableName struct{} `pg:"role" comment:"角色"` | 6 | tableName struct{} `pg:"role" comment:"角色"` |
7 | Id int64 `pg:"pk:id" comment:"ID"` | 7 | Id int64 `pg:"pk:id" comment:"ID"` |
8 | Name string `comment:"角色名称"` | 8 | Name string `comment:"角色名称"` |
9 | - Type int `comment:"角色类型(0角色可删、1系统预置角色不可删)"` | 9 | + Type int `comment:"角色类型(0角色可删、1系统预置角色不可删)" pg:",use_zero"` |
10 | Description string `comment:"角色描述"` | 10 | Description string `comment:"角色描述"` |
11 | CompanyId int64 `comment:"公司ID"` | 11 | CompanyId int64 `comment:"公司ID"` |
12 | CreatedAt time.Time `comment:"创建时间"` | 12 | CreatedAt time.Time `comment:"创建时间"` |
@@ -131,6 +131,14 @@ func (repo *EvaluationRuleRepository) Find(queryOptions map[string]interface{}) | @@ -131,6 +131,14 @@ func (repo *EvaluationRuleRepository) Find(queryOptions map[string]interface{}) | ||
131 | query.Where("company_id = ?", v) | 131 | query.Where("company_id = ?", v) |
132 | } | 132 | } |
133 | 133 | ||
134 | + if v, ok := queryOptions["creatorId"]; ok && v.(int64) > 0 { | ||
135 | + query.Where("creator_id = ?", v) | ||
136 | + } | ||
137 | + | ||
138 | + if v, ok := queryOptions["type"]; ok && v.(int) >= 0 { | ||
139 | + query.Where("type = ?", v) | ||
140 | + } | ||
141 | + | ||
134 | if v, ok := queryOptions["limit"].(int); ok { | 142 | if v, ok := queryOptions["limit"].(int); ok { |
135 | query.Limit(v) | 143 | query.Limit(v) |
136 | } | 144 | } |
@@ -60,6 +60,7 @@ func (controller *RuleController) RemoveRule() { | @@ -60,6 +60,7 @@ func (controller *RuleController) RemoveRule() { | ||
60 | func (controller *RuleController) ListRule() { | 60 | func (controller *RuleController) ListRule() { |
61 | ruService := service.NewEvaluationRuleService() | 61 | ruService := service.NewEvaluationRuleService() |
62 | in := &command.QueryRuleCommand{} | 62 | in := &command.QueryRuleCommand{} |
63 | + in.Type = -1 | ||
63 | if err := controller.Unmarshal(in); err != nil { | 64 | if err := controller.Unmarshal(in); err != nil { |
64 | controller.Response(nil, application.ThrowError(application.ARG_ERROR, err.Error())) | 65 | controller.Response(nil, application.ThrowError(application.ARG_ERROR, err.Error())) |
65 | } else { | 66 | } else { |
1 | +package routers | ||
2 | + | ||
3 | +import ( | ||
4 | + "github.com/beego/beego/v2/server/web" | ||
5 | + "github.com/linmadan/egglib-go/web/beego/filters" | ||
6 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego/controllers" | ||
7 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/port/beego/middlewares" | ||
8 | +) | ||
9 | + | ||
10 | +func init() { | ||
11 | + ns := web.NewNamespace("/v1/evaluation-rule", | ||
12 | + web.NSBefore(filters.AllowCors(), middlewares.CheckToken()), | ||
13 | + web.NSRouter("/", &controllers.RuleController{}, "Post:CreateRule"), | ||
14 | + web.NSRouter("/", &controllers.RuleController{}, "Put:UpdateRule"), | ||
15 | + web.NSRouter("/", &controllers.RuleController{}, "Delete:RemoveRule"), | ||
16 | + web.NSRouter("/:Id", &controllers.RuleController{}, "Get:GetRule"), | ||
17 | + web.NSRouter("/list", &controllers.RuleController{}, "Post:ListRule"), | ||
18 | + ) | ||
19 | + web.AddNamespace(ns) | ||
20 | +} |
-
请 注册 或 登录 后发表评论