Merge branch 'test' of http://gitlab.fjmaimaimai.com/allied-creation/performance into test
正在显示
32 个修改的文件
包含
247 行增加
和
71 行删除
不能预览此文件类型
@@ -142,6 +142,8 @@ func (srv SyncDataDepartmentService) editDepartment(param *command.EditDepartmen | @@ -142,6 +142,8 @@ func (srv SyncDataDepartmentService) editDepartment(param *command.EditDepartmen | ||
142 | } | 142 | } |
143 | if len(param.ChargeUserIds) > 0 { | 143 | if len(param.ChargeUserIds) > 0 { |
144 | departmentList[i].ChargeUserIds = param.ChargeUserIds | 144 | departmentList[i].ChargeUserIds = param.ChargeUserIds |
145 | + } else { | ||
146 | + departmentList[i].ChargeUserIds = make([]int64, 0) | ||
145 | } | 147 | } |
146 | continue | 148 | continue |
147 | } | 149 | } |
@@ -25,9 +25,14 @@ func (in *CreateCycleCommand) Valid(validation *validation.Validation) { | @@ -25,9 +25,14 @@ func (in *CreateCycleCommand) Valid(validation *validation.Validation) { | ||
25 | return | 25 | return |
26 | } | 26 | } |
27 | if len(in.Name) > 40 { | 27 | if len(in.Name) > 40 { |
28 | - validation.SetError("name", "角色名称最大长度40个字符") | 28 | + validation.SetError("name", "名称最大长度40个字符") |
29 | return | 29 | return |
30 | } | 30 | } |
31 | + if in.KpiCycle == 0 { | ||
32 | + validation.SetError("kpiCycle", "请选择考核周期") | ||
33 | + return | ||
34 | + } | ||
35 | + | ||
31 | if in.TimeStart == nil { | 36 | if in.TimeStart == nil { |
32 | validation.SetError("timeStart", "请选择考核周期的开始时间") | 37 | validation.SetError("timeStart", "请选择考核周期的开始时间") |
33 | return | 38 | return |
@@ -37,7 +42,7 @@ func (in *CreateCycleCommand) Valid(validation *validation.Validation) { | @@ -37,7 +42,7 @@ func (in *CreateCycleCommand) Valid(validation *validation.Validation) { | ||
37 | return | 42 | return |
38 | } | 43 | } |
39 | if len(in.TemplateIds) == 0 { | 44 | if len(in.TemplateIds) == 0 { |
40 | - validation.SetError("templates", "请选择周期内使用的评估模板") | 45 | + validation.SetError("templates", "请添加评估模板") |
41 | return | 46 | return |
42 | } | 47 | } |
43 | } | 48 | } |
@@ -19,8 +19,7 @@ type CycleTemplateListCommand struct { | @@ -19,8 +19,7 @@ type CycleTemplateListCommand struct { | ||
19 | } | 19 | } |
20 | 20 | ||
21 | type CycleTemplateCommand struct { | 21 | type CycleTemplateCommand struct { |
22 | - CycleId int64 `cname:"周期ID" json:"cycleId,string" valid:"Required"` | ||
23 | - TemplateId int64 `cname:"模板ID" json:"templateId,string" valid:"Required"` | 22 | + Id int64 `cname:"模板ID" json:"id,string" valid:"Required"` |
24 | } | 23 | } |
25 | 24 | ||
26 | func (in *QueryCycleCommand) Valid(validation *validation.Validation) { | 25 | func (in *QueryCycleCommand) Valid(validation *validation.Validation) { |
@@ -38,7 +38,7 @@ func (rs *EvaluationCycleService) Create(in *command.CreateCycleCommand) (interf | @@ -38,7 +38,7 @@ func (rs *EvaluationCycleService) Create(in *command.CreateCycleCommand) (interf | ||
38 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 38 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
39 | } | 39 | } |
40 | if count > 0 { | 40 | if count > 0 { |
41 | - return nil, application.ThrowError(application.BUSINESS_ERROR, "名称已存在") | 41 | + return nil, application.ThrowError(application.BUSINESS_ERROR, "已存在相同名称的周期") |
42 | } | 42 | } |
43 | 43 | ||
44 | _, templates, err := templateRepository.Find(map[string]interface{}{"companyId": in.CompanyId, "ids": in.TemplateIds}) | 44 | _, templates, err := templateRepository.Find(map[string]interface{}{"companyId": in.CompanyId, "ids": in.TemplateIds}) |
@@ -65,19 +65,27 @@ func (rs *EvaluationCycleService) Create(in *command.CreateCycleCommand) (interf | @@ -65,19 +65,27 @@ func (rs *EvaluationCycleService) Create(in *command.CreateCycleCommand) (interf | ||
65 | } | 65 | } |
66 | 66 | ||
67 | // 获取所有模板中的规则对象数据 | 67 | // 获取所有模板中的规则对象数据 |
68 | - ruleIds := make([]int64, 0) | ||
69 | - ruleMap := map[int64]*domain.EvaluationRule{} | 68 | + ruleIdsMap := map[int64]int64{} |
70 | for i := range templates { | 69 | for i := range templates { |
71 | v := templates[i] | 70 | v := templates[i] |
72 | for j := range v.LinkNodes { | 71 | for j := range v.LinkNodes { |
73 | node := v.LinkNodes[j] | 72 | node := v.LinkNodes[j] |
74 | for k := range node.NodeContents { | 73 | for k := range node.NodeContents { |
75 | nodeContent := node.NodeContents[k] | 74 | nodeContent := node.NodeContents[k] |
76 | - ruleIds = append(ruleIds, nodeContent.RuleId) | 75 | + if nodeContent.RuleId != 0 { |
76 | + ruleIdsMap[nodeContent.RuleId] = nodeContent.RuleId | ||
77 | + } | ||
77 | } | 78 | } |
78 | } | 79 | } |
79 | } | 80 | } |
81 | + ruleIds := make([]int64, 0) | ||
82 | + for k := range ruleIdsMap { | ||
83 | + ruleIds = append(ruleIds, k) | ||
84 | + } | ||
85 | + | ||
80 | _, rules, err := ruleRepository.Find(map[string]interface{}{"ids": ruleIds, "companyId": in.CompanyId}) | 86 | _, rules, err := ruleRepository.Find(map[string]interface{}{"ids": ruleIds, "companyId": in.CompanyId}) |
87 | + | ||
88 | + ruleMap := map[int64]*domain.EvaluationRule{} | ||
81 | for i := range rules { | 89 | for i := range rules { |
82 | ruleMap[rules[i].Id] = rules[i] | 90 | ruleMap[rules[i].Id] = rules[i] |
83 | } | 91 | } |
@@ -313,6 +321,10 @@ func (rs *EvaluationCycleService) List(in *command.QueryCycleCommand) (interface | @@ -313,6 +321,10 @@ func (rs *EvaluationCycleService) List(in *command.QueryCycleCommand) (interface | ||
313 | if err != nil { | 321 | if err != nil { |
314 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 322 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
315 | } | 323 | } |
324 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
325 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
326 | + } | ||
327 | + | ||
316 | return tool_funs.SimpleWrapGridMap(total, cycles), nil | 328 | return tool_funs.SimpleWrapGridMap(total, cycles), nil |
317 | } | 329 | } |
318 | 330 | ||
@@ -325,7 +337,7 @@ func (rs *EvaluationCycleService) StatisticCycleUser(in *command.StatisticCycleP | @@ -325,7 +337,7 @@ func (rs *EvaluationCycleService) StatisticCycleUser(in *command.StatisticCycleP | ||
325 | transactionContext.RollbackTransaction() | 337 | transactionContext.RollbackTransaction() |
326 | }() | 338 | }() |
327 | projectRepository := factory.CreateEvaluationProjectRepository(map[string]interface{}{"transactionContext": transactionContext}) | 339 | projectRepository := factory.CreateEvaluationProjectRepository(map[string]interface{}{"transactionContext": transactionContext}) |
328 | - _, projects, err := projectRepository.Find(tool_funs.SimpleStructToMap(in), "linkNodes") | 340 | + _, projects, err := projectRepository.Find(tool_funs.SimpleStructToMap(in), "template") |
329 | if err != nil { | 341 | if err != nil { |
330 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 342 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
331 | } | 343 | } |
@@ -339,8 +351,8 @@ func (rs *EvaluationCycleService) StatisticCycleUser(in *command.StatisticCycleP | @@ -339,8 +351,8 @@ func (rs *EvaluationCycleService) StatisticCycleUser(in *command.StatisticCycleP | ||
339 | userIdMap[userId] = userId | 351 | userIdMap[userId] = userId |
340 | } | 352 | } |
341 | } | 353 | } |
342 | - for _, v := range userIdMap { | ||
343 | - userIds = append(userIds, v) | 354 | + for k := range userIdMap { |
355 | + userIds = append(userIds, k) | ||
344 | } | 356 | } |
345 | 357 | ||
346 | userTotal := 0 | 358 | userTotal := 0 |
@@ -404,7 +416,7 @@ func (rs *EvaluationCycleService) CycleTemplate(in *command.CycleTemplateCommand | @@ -404,7 +416,7 @@ func (rs *EvaluationCycleService) CycleTemplate(in *command.CycleTemplateCommand | ||
404 | }() | 416 | }() |
405 | 417 | ||
406 | cycleTemplateRepository := factory.CreateEvaluationCycleTemplateRepository(map[string]interface{}{"transactionContext": transactionContext}) | 418 | cycleTemplateRepository := factory.CreateEvaluationCycleTemplateRepository(map[string]interface{}{"transactionContext": transactionContext}) |
407 | - cycleTemplate, err := cycleTemplateRepository.FindOne(map[string]interface{}{"id": in.TemplateId}) | 419 | + cycleTemplate, err := cycleTemplateRepository.FindOne(map[string]interface{}{"id": in.Id}) |
408 | if err != nil { | 420 | if err != nil { |
409 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 421 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
410 | } | 422 | } |
@@ -132,7 +132,7 @@ func (rs *EvaluationProjectService) UpdateTemplate(in *command.UpdateProjectTemp | @@ -132,7 +132,7 @@ func (rs *EvaluationProjectService) UpdateTemplate(in *command.UpdateProjectTemp | ||
132 | projectRepository := factory.CreateEvaluationProjectRepository(map[string]interface{}{"transactionContext": transactionContext}) | 132 | projectRepository := factory.CreateEvaluationProjectRepository(map[string]interface{}{"transactionContext": transactionContext}) |
133 | cycleTemplateRepository := factory.CreateEvaluationCycleTemplateRepository(map[string]interface{}{"transactionContext": transactionContext}) | 133 | cycleTemplateRepository := factory.CreateEvaluationCycleTemplateRepository(map[string]interface{}{"transactionContext": transactionContext}) |
134 | 134 | ||
135 | - _, projects, err := projectRepository.Find(map[string]interface{}{"companyId": in.CompanyId, "cycleId": in.CycleId}, "linkNodes") | 135 | + _, projects, err := projectRepository.Find(map[string]interface{}{"companyId": in.CompanyId, "cycleId": in.CycleId}, "template") |
136 | if err != nil { | 136 | if err != nil { |
137 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 137 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
138 | } | 138 | } |
@@ -271,7 +271,7 @@ func (rs *EvaluationProjectService) List(in *command.QueryProjectCommand) (inter | @@ -271,7 +271,7 @@ func (rs *EvaluationProjectService) List(in *command.QueryProjectCommand) (inter | ||
271 | }() | 271 | }() |
272 | 272 | ||
273 | projectRepository := factory.CreateEvaluationProjectRepository(map[string]interface{}{"transactionContext": transactionContext}) | 273 | projectRepository := factory.CreateEvaluationProjectRepository(map[string]interface{}{"transactionContext": transactionContext}) |
274 | - total, projects, err := projectRepository.Find(tool_funs.SimpleStructToMap(in), "linkNodes") | 274 | + total, projects, err := projectRepository.Find(tool_funs.SimpleStructToMap(in), "template") |
275 | if err != nil { | 275 | if err != nil { |
276 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 276 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
277 | } | 277 | } |
@@ -371,7 +371,7 @@ func (rs *EvaluationProjectService) CheckRecipients(in *command.CheckRecipientCo | @@ -371,7 +371,7 @@ func (rs *EvaluationProjectService) CheckRecipients(in *command.CheckRecipientCo | ||
371 | 371 | ||
372 | projectRepository := factory.CreateEvaluationProjectRepository(map[string]interface{}{"transactionContext": transactionContext}) | 372 | projectRepository := factory.CreateEvaluationProjectRepository(map[string]interface{}{"transactionContext": transactionContext}) |
373 | 373 | ||
374 | - _, projects, err := projectRepository.Find(map[string]interface{}{"companyId": in.CompanyId, "cycleId": in.CycleId}, "linkNodes") | 374 | + _, projects, err := projectRepository.Find(map[string]interface{}{"companyId": in.CompanyId, "cycleId": in.CycleId}, "template") |
375 | if err != nil { | 375 | if err != nil { |
376 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 376 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
377 | } | 377 | } |
@@ -8,3 +8,8 @@ type RuleAdapter struct { | @@ -8,3 +8,8 @@ type RuleAdapter struct { | ||
8 | *domain.EvaluationRule | 8 | *domain.EvaluationRule |
9 | CreatorName string `json:"creatorName" comment:"创建人名称"` | 9 | CreatorName string `json:"creatorName" comment:"创建人名称"` |
10 | } | 10 | } |
11 | + | ||
12 | +type CreatorAdapter struct { | ||
13 | + Id int64 `json:"id,string" comment:"创建人ID"` | ||
14 | + Name string `json:"name" comment:"创建人名称"` | ||
15 | +} |
@@ -11,9 +11,20 @@ type QueryRuleCommand struct { | @@ -11,9 +11,20 @@ type QueryRuleCommand struct { | ||
11 | PageSize int64 `cname:"分页数量" json:"pageSize" valid:"Required"` | 11 | PageSize int64 `cname:"分页数量" json:"pageSize" valid:"Required"` |
12 | } | 12 | } |
13 | 13 | ||
14 | +type QueryCreatorCommand struct { | ||
15 | + CompanyId int64 `cname:"公司ID" json:"companyId"` | ||
16 | +} | ||
17 | + | ||
14 | func (in *QueryRuleCommand) Valid(validation *validation.Validation) { | 18 | func (in *QueryRuleCommand) Valid(validation *validation.Validation) { |
15 | if in.CompanyId == 0 { | 19 | if in.CompanyId == 0 { |
16 | validation.SetError("companyId", "公司ID无效") | 20 | validation.SetError("companyId", "公司ID无效") |
17 | return | 21 | return |
18 | } | 22 | } |
19 | } | 23 | } |
24 | + | ||
25 | +func (in *QueryCreatorCommand) Valid(validation *validation.Validation) { | ||
26 | + if in.CompanyId == 0 { | ||
27 | + validation.SetError("companyId", "公司ID无效") | ||
28 | + return | ||
29 | + } | ||
30 | +} |
@@ -212,3 +212,40 @@ func (rs *EvaluationRuleService) ListRelCreator(in *command.QueryRuleCommand) (i | @@ -212,3 +212,40 @@ func (rs *EvaluationRuleService) ListRelCreator(in *command.QueryRuleCommand) (i | ||
212 | } | 212 | } |
213 | return tool_funs.SimpleWrapGridMap(total, ras), nil | 213 | return tool_funs.SimpleWrapGridMap(total, ras), nil |
214 | } | 214 | } |
215 | + | ||
216 | +func (rs *EvaluationRuleService) ListCreator(in *command.QueryCreatorCommand) (interface{}, error) { | ||
217 | + transactionContext, err := factory.StartTransaction() | ||
218 | + if err != nil { | ||
219 | + return nil, err | ||
220 | + } | ||
221 | + defer func() { | ||
222 | + transactionContext.RollbackTransaction() | ||
223 | + }() | ||
224 | + ruleRepository := factory.CreateEvaluationRuleRepository(map[string]interface{}{"transactionContext": transactionContext}) | ||
225 | + userRepository := factory.CreateUserRepository(map[string]interface{}{"transactionContext": transactionContext}) | ||
226 | + | ||
227 | + _, rules, err := ruleRepository.Find(tool_funs.SimpleStructToMap(in)) | ||
228 | + if err != nil { | ||
229 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
230 | + } | ||
231 | + | ||
232 | + // 获取所有创建人ID | ||
233 | + creatorMap := map[int64]int64{} | ||
234 | + for i := range rules { | ||
235 | + creatorMap[rules[i].CreatorId] = rules[i].CreatorId | ||
236 | + } | ||
237 | + creatorIds := make([]int64, 0) | ||
238 | + for k := range creatorMap { | ||
239 | + creatorIds = append(creatorIds, k) | ||
240 | + } | ||
241 | + _, users, _ := userRepository.Find(map[string]interface{}{"ids": creatorIds, "limit": len(creatorIds)}) | ||
242 | + cas := make([]*adapter.CreatorAdapter, 0) | ||
243 | + for i := range users { | ||
244 | + ca := &adapter.CreatorAdapter{ | ||
245 | + Id: users[i].Id, | ||
246 | + Name: users[i].Name, | ||
247 | + } | ||
248 | + cas = append(cas, ca) | ||
249 | + } | ||
250 | + return map[string]interface{}{"list": cas}, nil | ||
251 | +} |
@@ -188,8 +188,14 @@ func (rs *EvaluationTemplateService) List(in *command.QueryTemplateCommand) (int | @@ -188,8 +188,14 @@ func (rs *EvaluationTemplateService) List(in *command.QueryTemplateCommand) (int | ||
188 | defer func() { | 188 | defer func() { |
189 | transactionContext.RollbackTransaction() | 189 | transactionContext.RollbackTransaction() |
190 | }() | 190 | }() |
191 | + | ||
192 | + queryOptions := tool_funs.SimpleStructToMap(in) | ||
193 | + if in.CreatedAt == nil { | ||
194 | + delete(queryOptions, "createdAt") // 删除创建时间 | ||
195 | + } | ||
196 | + | ||
191 | templateRepository := factory.CreateEvaluationTemplateRepository(map[string]interface{}{"transactionContext": transactionContext}) | 197 | templateRepository := factory.CreateEvaluationTemplateRepository(map[string]interface{}{"transactionContext": transactionContext}) |
192 | - total, templates, err := templateRepository.Find(tool_funs.SimpleStructToMap(in), "linkNodes") | 198 | + total, templates, err := templateRepository.Find(queryOptions, "link_nodes") |
193 | if err != nil { | 199 | if err != nil { |
194 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 200 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
195 | } | 201 | } |
@@ -34,7 +34,7 @@ func (rs *RoleUserService) Create(in *command.UserRoleCreateCommand) (interface{ | @@ -34,7 +34,7 @@ func (rs *RoleUserService) Create(in *command.UserRoleCreateCommand) (interface{ | ||
34 | // int64Array = append(int64Array, int64Num) | 34 | // int64Array = append(int64Array, int64Num) |
35 | //} | 35 | //} |
36 | // 检测已存在的关联用户 | 36 | // 检测已存在的关联用户 |
37 | - _, rus, err := roleUserRepository.Find(map[string]interface{}{"roleId": in.RoleId, "companyId": in.CompanyId, "userIds": in.UserIds, "limit": 9999999}) | 37 | + _, rus, err := roleUserRepository.Find(map[string]interface{}{"roleId": in.RoleId, "companyId": in.CompanyId, "userIds": in.UserIds, "limit": int64(9999999)}) |
38 | if err != nil { | 38 | if err != nil { |
39 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | 39 | return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) |
40 | } | 40 | } |
@@ -8,6 +8,7 @@ type SaveUserCommand struct { | @@ -8,6 +8,7 @@ type SaveUserCommand struct { | ||
8 | AdminType int `json:"admin_type"` // 1普通员工 2 主管理员 | 8 | AdminType int `json:"admin_type"` // 1普通员工 2 主管理员 |
9 | Name string `json:"name"` // 用户姓名 | 9 | Name string `json:"name"` // 用户姓名 |
10 | Status int `json:"status"` // 用户状态(1正常 2禁用) | 10 | Status int `json:"status"` // 用户状态(1正常 2禁用) |
11 | + EntryTime string `json:"entryTime"` //入职日期 | ||
11 | Email string `json:"email"` // 邮箱 | 12 | Email string `json:"email"` // 邮箱 |
12 | UserDepartments []struct { | 13 | UserDepartments []struct { |
13 | DepartmentId int `json:"department_id" ` | 14 | DepartmentId int `json:"department_id" ` |
@@ -102,6 +102,7 @@ func (srv SyncDataUserService) AddUser(param *command.SaveUserCommand) error { | @@ -102,6 +102,7 @@ func (srv SyncDataUserService) AddUser(param *command.SaveUserCommand) error { | ||
102 | Name: param.Name, | 102 | Name: param.Name, |
103 | Email: param.Email, | 103 | Email: param.Email, |
104 | Status: param.Status, | 104 | Status: param.Status, |
105 | + EntryTime: param.EntryTime, | ||
105 | UpdatedAt: nowTime, | 106 | UpdatedAt: nowTime, |
106 | CreatedAt: nowTime, | 107 | CreatedAt: nowTime, |
107 | } | 108 | } |
@@ -160,6 +161,7 @@ func (srv SyncDataUserService) UpdateUser(param *command.SaveUserCommand) error | @@ -160,6 +161,7 @@ func (srv SyncDataUserService) UpdateUser(param *command.SaveUserCommand) error | ||
160 | newUser.AdminType = param.AdminType | 161 | newUser.AdminType = param.AdminType |
161 | newUser.Name = param.Name | 162 | newUser.Name = param.Name |
162 | newUser.Status = param.Status | 163 | newUser.Status = param.Status |
164 | + newUser.EntryTime = param.EntryTime | ||
163 | newUser.PositionId = param.PositionIds() | 165 | newUser.PositionId = param.PositionIds() |
164 | newUser.DepartmentId = param.DepartmentIds() | 166 | newUser.DepartmentId = param.DepartmentIds() |
165 | 167 | ||
@@ -294,6 +296,7 @@ func (srv SyncDataUserService) importUser(param *command.ImportUserCommand) erro | @@ -294,6 +296,7 @@ func (srv SyncDataUserService) importUser(param *command.ImportUserCommand) erro | ||
294 | editUserList[i].Name = mVal.Name | 296 | editUserList[i].Name = mVal.Name |
295 | editUserList[i].Status = mVal.Status | 297 | editUserList[i].Status = mVal.Status |
296 | editUserList[i].CompanyId = mVal.CompanyId | 298 | editUserList[i].CompanyId = mVal.CompanyId |
299 | + editUserList[i].EntryTime = mVal.EntryTime | ||
297 | editUserList[i].UpdatedAt = nowTime | 300 | editUserList[i].UpdatedAt = nowTime |
298 | _, err = userRepo.Update(editUserList[i]) | 301 | _, err = userRepo.Update(editUserList[i]) |
299 | if err != nil { | 302 | if err != nil { |
@@ -312,6 +315,7 @@ func (srv SyncDataUserService) importUser(param *command.ImportUserCommand) erro | @@ -312,6 +315,7 @@ func (srv SyncDataUserService) importUser(param *command.ImportUserCommand) erro | ||
312 | AdminType: param.AddUsers[i].AdminType, | 315 | AdminType: param.AddUsers[i].AdminType, |
313 | Name: param.AddUsers[i].Name, | 316 | Name: param.AddUsers[i].Name, |
314 | Status: param.AddUsers[i].Status, | 317 | Status: param.AddUsers[i].Status, |
318 | + EntryTime: param.AddUsers[i].EntryTime, | ||
315 | UpdatedAt: nowTime, | 319 | UpdatedAt: nowTime, |
316 | DeletedAt: nil, | 320 | DeletedAt: nil, |
317 | CreatedAt: nowTime, | 321 | CreatedAt: nowTime, |
pkg/application/user/user.go
0 → 100644
1 | +package user | ||
2 | + | ||
3 | +import ( | ||
4 | + "github.com/linmadan/egglib-go/core/application" | ||
5 | + "github.com/linmadan/egglib-go/utils/tool_funs" | ||
6 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/factory" | ||
7 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/user/query" | ||
8 | +) | ||
9 | + | ||
10 | +type UserService struct{} | ||
11 | + | ||
12 | +func (service *UserService) ListUsers(listUserQuery *query.ListUserQuery) (interface{}, error) { | ||
13 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
14 | + if err != nil { | ||
15 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
16 | + } | ||
17 | + if err := transactionContext.StartTransaction(); err != nil { | ||
18 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
19 | + } | ||
20 | + defer func() { | ||
21 | + _ = transactionContext.RollbackTransaction() | ||
22 | + }() | ||
23 | + userRepo := factory.CreateUserRepository(map[string]interface{}{ | ||
24 | + "transactionContext": transactionContext, | ||
25 | + }) | ||
26 | + count, list, err := userRepo.Find(map[string]interface{}{ | ||
27 | + "companyId": listUserQuery.CompanyId, | ||
28 | + "name": listUserQuery.Name, | ||
29 | + }) | ||
30 | + if err != nil { | ||
31 | + return nil, application.ThrowError(application.INTERNAL_SERVER_ERROR, err.Error()) | ||
32 | + } | ||
33 | + if err := transactionContext.CommitTransaction(); err != nil { | ||
34 | + return nil, application.ThrowError(application.TRANSACTION_ERROR, err.Error()) | ||
35 | + } | ||
36 | + return tool_funs.SimpleWrapGridMap(int64(count), list), nil | ||
37 | +} |
@@ -3,19 +3,20 @@ package domain | @@ -3,19 +3,20 @@ package domain | ||
3 | import "time" | 3 | import "time" |
4 | 4 | ||
5 | type User struct { | 5 | type User struct { |
6 | - Id int64 // 用户Id | ||
7 | - Account string // 用户账号 | ||
8 | - AvatarUrl string // 用户头像URL | ||
9 | - CompanyId int64 // 公司编号 | ||
10 | - AdminType int // 1普通员工 2 主管理员 | ||
11 | - Name string // 用户姓名 | ||
12 | - Email string // 邮箱 | ||
13 | - Status int // 用户状态(1正常 2禁用) | ||
14 | - DepartmentId []int // 用户归属的部门 | ||
15 | - PositionId []int //用户职位 | ||
16 | - UpdatedAt time.Time // 更新时间 | ||
17 | - DeletedAt *time.Time | ||
18 | - CreatedAt time.Time | 6 | + Id int64 `json:"id"` // 用户Id |
7 | + Account string `json:"account"` // 用户账号 | ||
8 | + AvatarUrl string `json:"avatarUrl"` // 用户头像URL | ||
9 | + CompanyId int64 `json:"companyId"` // 公司编号 | ||
10 | + AdminType int `json:"adminType"` // 1普通员工 2 主管理员 | ||
11 | + Name string `json:"name"` // 用户姓名 | ||
12 | + Email string `json:"email"` // 邮箱 | ||
13 | + Status int `json:"status"` // 用户状态(1正常 2禁用) | ||
14 | + DepartmentId []int `json:"departmentId"` // 用户归属的部门 | ||
15 | + PositionId []int `json:"PositionId"` //用户职位 | ||
16 | + EntryTime string `json:"entryTime"` //入职日期 | ||
17 | + UpdatedAt time.Time `json:"updatedAt"` // 更新时间 | ||
18 | + DeletedAt *time.Time `json:"deletedAt"` | ||
19 | + CreatedAt time.Time `json:"createdAt"` | ||
19 | } | 20 | } |
20 | 21 | ||
21 | // 1普通员工 2 主管理员 | 22 | // 1普通员工 2 主管理员 |
@@ -14,6 +14,7 @@ type User struct { | @@ -14,6 +14,7 @@ type User struct { | ||
14 | Status int // 用户状态(1正常 2禁用) | 14 | Status int // 用户状态(1正常 2禁用) |
15 | DepartmentId []int // 用户归属的部门 | 15 | DepartmentId []int // 用户归属的部门 |
16 | PositionId []int // 用户职位 | 16 | PositionId []int // 用户职位 |
17 | + EntryTime string //入职日期 | ||
17 | CreatedAt time.Time // 创建时间 | 18 | CreatedAt time.Time // 创建时间 |
18 | UpdatedAt time.Time // 更新时间 | 19 | UpdatedAt time.Time // 更新时间 |
19 | DeletedAt *time.Time `pg:",soft_delete"` // 删除时间 | 20 | DeletedAt *time.Time `pg:",soft_delete"` // 删除时间 |
@@ -127,11 +127,11 @@ func (repo *EvaluationCycleRepository) Find(queryOptions map[string]interface{}) | @@ -127,11 +127,11 @@ func (repo *EvaluationCycleRepository) Find(queryOptions map[string]interface{}) | ||
127 | query.Where("company_id = ?", v) | 127 | query.Where("company_id = ?", v) |
128 | } | 128 | } |
129 | 129 | ||
130 | - if v, ok := queryOptions["limit"].(int); ok { | ||
131 | - query.Limit(v) | 130 | + if v, ok := queryOptions["limit"].(int64); ok { |
131 | + query.Limit(int(v)) | ||
132 | } | 132 | } |
133 | - if v, ok := queryOptions["offset"].(int); ok { | ||
134 | - query.Offset(v) | 133 | + if v, ok := queryOptions["offset"].(int64); ok { |
134 | + query.Offset(int(v)) | ||
135 | } | 135 | } |
136 | 136 | ||
137 | if v, ok := queryOptions["timeStart"]; ok { | 137 | if v, ok := queryOptions["timeStart"]; ok { |
@@ -153,11 +153,11 @@ func (repo *EvaluationCycleTemplateRepository) Find(queryOptions map[string]inte | @@ -153,11 +153,11 @@ func (repo *EvaluationCycleTemplateRepository) Find(queryOptions map[string]inte | ||
153 | query.Where("cycle_id = ?", v) | 153 | query.Where("cycle_id = ?", v) |
154 | } | 154 | } |
155 | 155 | ||
156 | - if v, ok := queryOptions["limit"].(int); ok { | ||
157 | - query.Limit(v) | 156 | + if v, ok := queryOptions["limit"].(int64); ok { |
157 | + query.Limit(int(v)) | ||
158 | } | 158 | } |
159 | - if v, ok := queryOptions["offset"].(int); ok { | ||
160 | - query.Offset(v) | 159 | + if v, ok := queryOptions["offset"].(int64); ok { |
160 | + query.Offset(int(v)) | ||
161 | } | 161 | } |
162 | 162 | ||
163 | count, err := query.SelectAndCount() | 163 | count, err := query.SelectAndCount() |
@@ -159,11 +159,11 @@ func (repo *EvaluationProjectRepository) Find(queryOptions map[string]interface{ | @@ -159,11 +159,11 @@ func (repo *EvaluationProjectRepository) Find(queryOptions map[string]interface{ | ||
159 | } | 159 | } |
160 | } | 160 | } |
161 | 161 | ||
162 | - if v, ok := queryOptions["limit"].(int); ok { | ||
163 | - query.Limit(v) | 162 | + if v, ok := queryOptions["limit"].(int64); ok { |
163 | + query.Limit(int(v)) | ||
164 | } | 164 | } |
165 | - if v, ok := queryOptions["offset"].(int); ok { | ||
166 | - query.Offset(v) | 165 | + if v, ok := queryOptions["offset"].(int64); ok { |
166 | + query.Offset(int(v)) | ||
167 | } | 167 | } |
168 | 168 | ||
169 | count, err := query.SelectAndCount() | 169 | count, err := query.SelectAndCount() |
@@ -143,11 +143,11 @@ func (repo *EvaluationRuleRepository) Find(queryOptions map[string]interface{}) | @@ -143,11 +143,11 @@ func (repo *EvaluationRuleRepository) Find(queryOptions map[string]interface{}) | ||
143 | query.Where("type = ?", v) | 143 | query.Where("type = ?", v) |
144 | } | 144 | } |
145 | 145 | ||
146 | - if v, ok := queryOptions["limit"].(int); ok { | ||
147 | - query.Limit(v) | 146 | + if v, ok := queryOptions["limit"].(int64); ok { |
147 | + query.Limit(int(v)) | ||
148 | } | 148 | } |
149 | - if v, ok := queryOptions["offset"].(int); ok { | ||
150 | - query.Offset(v) | 149 | + if v, ok := queryOptions["offset"].(int64); ok { |
150 | + query.Offset(int(v)) | ||
151 | } | 151 | } |
152 | 152 | ||
153 | count, err := query.SelectAndCount() | 153 | count, err := query.SelectAndCount() |
@@ -142,14 +142,19 @@ func (repo *EvaluationTemplateRepository) Find(queryOptions map[string]interface | @@ -142,14 +142,19 @@ func (repo *EvaluationTemplateRepository) Find(queryOptions map[string]interface | ||
142 | } | 142 | } |
143 | 143 | ||
144 | if v, ok := queryOptions["createdAt"]; ok { | 144 | if v, ok := queryOptions["createdAt"]; ok { |
145 | - query.Where("created_at = ?", v) | 145 | + t := v.(*time.Time) |
146 | + year, month, day := t.Date() | ||
147 | + begin := time.Date(year, month, day, 0, 0, 0, 0, time.Local) | ||
148 | + end := time.Date(year, month, day, 23, 59, 59, 0, time.Local) | ||
149 | + query.Where("created_at >= ?", begin) | ||
150 | + query.Where("created_at <= ?", end) | ||
146 | } | 151 | } |
147 | 152 | ||
148 | - if v, ok := queryOptions["limit"].(int); ok { | ||
149 | - query.Limit(v) | 153 | + if v, ok := queryOptions["limit"].(int64); ok { |
154 | + query.Limit(int(v)) | ||
150 | } | 155 | } |
151 | - if v, ok := queryOptions["offset"].(int); ok { | ||
152 | - query.Offset(v) | 156 | + if v, ok := queryOptions["offset"].(int64); ok { |
157 | + query.Offset(int(v)) | ||
153 | } | 158 | } |
154 | 159 | ||
155 | count, err := query.SelectAndCount() | 160 | count, err := query.SelectAndCount() |
@@ -121,11 +121,11 @@ func (repo *RoleRepository) Find(queryOptions map[string]interface{}) (int64, [] | @@ -121,11 +121,11 @@ func (repo *RoleRepository) Find(queryOptions map[string]interface{}) (int64, [] | ||
121 | query.Where("company_id = ?", companyId) | 121 | query.Where("company_id = ?", companyId) |
122 | } | 122 | } |
123 | 123 | ||
124 | - if v, ok := queryOptions["limit"].(int); ok { | ||
125 | - query.Limit(v) | 124 | + if v, ok := queryOptions["limit"].(int64); ok { |
125 | + query.Limit(int(v)) | ||
126 | } | 126 | } |
127 | - if v, ok := queryOptions["offset"].(int); ok { | ||
128 | - query.Offset(v) | 127 | + if v, ok := queryOptions["offset"].(int64); ok { |
128 | + query.Offset(int(v)) | ||
129 | } | 129 | } |
130 | 130 | ||
131 | count, err := query.SelectAndCount() | 131 | count, err := query.SelectAndCount() |
@@ -128,11 +128,11 @@ func (repo *RoleUserRepository) Find(queryOptions map[string]interface{}) (int64 | @@ -128,11 +128,11 @@ func (repo *RoleUserRepository) Find(queryOptions map[string]interface{}) (int64 | ||
128 | query.Where("user_id in (?)", pg.In(userIds)) | 128 | query.Where("user_id in (?)", pg.In(userIds)) |
129 | } | 129 | } |
130 | 130 | ||
131 | - if v, ok := queryOptions["limit"].(int); ok { | ||
132 | - query.Limit(v) | 131 | + if v, ok := queryOptions["limit"].(int64); ok { |
132 | + query.Limit(int(v)) | ||
133 | } | 133 | } |
134 | - if v, ok := queryOptions["offset"].(int); ok { | ||
135 | - query.Offset(v) | 134 | + if v, ok := queryOptions["offset"].(int64); ok { |
135 | + query.Offset(int(v)) | ||
136 | } | 136 | } |
137 | 137 | ||
138 | count, err := query.SelectAndCount() | 138 | count, err := query.SelectAndCount() |
@@ -21,8 +21,6 @@ func (controller *CycleController) CreateCycle() { | @@ -21,8 +21,6 @@ func (controller *CycleController) CreateCycle() { | ||
21 | ua := middlewares.GetUser(controller.Ctx) | 21 | ua := middlewares.GetUser(controller.Ctx) |
22 | in.CompanyId = ua.CompanyId | 22 | in.CompanyId = ua.CompanyId |
23 | in.CreatorId = ua.UserId | 23 | in.CreatorId = ua.UserId |
24 | - //in.CompanyId = middlewares.GetCompanyId(controller.Ctx) | ||
25 | - //in.CreatorId = middlewares.GetUserId(controller.Ctx) | ||
26 | controller.Response(ruService.Create(in)) | 24 | controller.Response(ruService.Create(in)) |
27 | } | 25 | } |
28 | } | 26 | } |
@@ -101,9 +99,10 @@ func (controller *CycleController) CycleTemplateList() { | @@ -101,9 +99,10 @@ func (controller *CycleController) CycleTemplateList() { | ||
101 | func (controller *CycleController) CycleTemplate() { | 99 | func (controller *CycleController) CycleTemplate() { |
102 | ruService := service.NewEvaluationCycleService() | 100 | ruService := service.NewEvaluationCycleService() |
103 | in := &command.CycleTemplateCommand{} | 101 | in := &command.CycleTemplateCommand{} |
104 | - if err := controller.Unmarshal(in); err != nil { | 102 | + if id, err := controller.GetInt64(":Id"); err != nil { |
105 | controller.Response(nil, application.ThrowError(application.ARG_ERROR, err.Error())) | 103 | controller.Response(nil, application.ThrowError(application.ARG_ERROR, err.Error())) |
106 | } else { | 104 | } else { |
105 | + in.Id = id | ||
107 | controller.Response(ruService.CycleTemplate(in)) | 106 | controller.Response(ruService.CycleTemplate(in)) |
108 | } | 107 | } |
109 | } | 108 | } |
@@ -85,7 +85,19 @@ func (controller *RuleController) ListRuleRelCreator() { | @@ -85,7 +85,19 @@ func (controller *RuleController) ListRuleRelCreator() { | ||
85 | } | 85 | } |
86 | ua := middlewares.GetUser(controller.Ctx) | 86 | ua := middlewares.GetUser(controller.Ctx) |
87 | in.CompanyId = ua.CompanyId | 87 | in.CompanyId = ua.CompanyId |
88 | - //in.CompanyId = middlewares.GetCompanyId(controller.Ctx) | ||
89 | controller.Response(ruService.ListRelCreator(in)) | 88 | controller.Response(ruService.ListRelCreator(in)) |
90 | } | 89 | } |
91 | } | 90 | } |
91 | + | ||
92 | +func (controller *RuleController) ListCreator() { | ||
93 | + ruService := service.NewEvaluationRuleService() | ||
94 | + in := &command.QueryCreatorCommand{} | ||
95 | + if err := controller.Unmarshal(in); err != nil { | ||
96 | + controller.Response(nil, application.ThrowError(application.ARG_ERROR, err.Error())) | ||
97 | + } else { | ||
98 | + | ||
99 | + ua := middlewares.GetUser(controller.Ctx) | ||
100 | + in.CompanyId = ua.CompanyId | ||
101 | + controller.Response(ruService.ListCreator(in)) | ||
102 | + } | ||
103 | +} |
@@ -22,8 +22,6 @@ func (controller *TemplateController) CreateTemplate() { | @@ -22,8 +22,6 @@ func (controller *TemplateController) CreateTemplate() { | ||
22 | ua := middlewares.GetUser(controller.Ctx) | 22 | ua := middlewares.GetUser(controller.Ctx) |
23 | in.CompanyId = ua.CompanyId | 23 | in.CompanyId = ua.CompanyId |
24 | in.CreatorId = ua.UserId | 24 | in.CreatorId = ua.UserId |
25 | - //in.CompanyId = middlewares.GetCompanyId(controller.Ctx) | ||
26 | - //in.CreatorId = middlewares.GetUserId(controller.Ctx) | ||
27 | controller.Response(ruService.Create(in)) | 25 | controller.Response(ruService.Create(in)) |
28 | } | 26 | } |
29 | } | 27 | } |
@@ -36,7 +34,6 @@ func (controller *TemplateController) UpdateTemplate() { | @@ -36,7 +34,6 @@ func (controller *TemplateController) UpdateTemplate() { | ||
36 | } else { | 34 | } else { |
37 | ua := middlewares.GetUser(controller.Ctx) | 35 | ua := middlewares.GetUser(controller.Ctx) |
38 | in.CompanyId = ua.CompanyId | 36 | in.CompanyId = ua.CompanyId |
39 | - //in.CompanyId = middlewares.GetCompanyId(controller.Ctx) | ||
40 | controller.Response(ruService.Update(in)) | 37 | controller.Response(ruService.Update(in)) |
41 | } | 38 | } |
42 | } | 39 | } |
@@ -74,7 +71,6 @@ func (controller *TemplateController) ListTemplate() { | @@ -74,7 +71,6 @@ func (controller *TemplateController) ListTemplate() { | ||
74 | } | 71 | } |
75 | ua := middlewares.GetUser(controller.Ctx) | 72 | ua := middlewares.GetUser(controller.Ctx) |
76 | in.CompanyId = ua.CompanyId | 73 | in.CompanyId = ua.CompanyId |
77 | - //in.CompanyId = middlewares.GetCompanyId(controller.Ctx) | ||
78 | controller.Response(ruService.List(in)) | 74 | controller.Response(ruService.List(in)) |
79 | } | 75 | } |
80 | } | 76 | } |
@@ -90,7 +86,6 @@ func (controller *TemplateController) ListEnableTemplate() { | @@ -90,7 +86,6 @@ func (controller *TemplateController) ListEnableTemplate() { | ||
90 | } else { | 86 | } else { |
91 | ua := middlewares.GetUser(controller.Ctx) | 87 | ua := middlewares.GetUser(controller.Ctx) |
92 | in.CompanyId = ua.CompanyId | 88 | in.CompanyId = ua.CompanyId |
93 | - //in.CompanyId = middlewares.GetCompanyId(controller.Ctx) | ||
94 | controller.Response(ruService.List(in)) | 89 | controller.Response(ruService.List(in)) |
95 | } | 90 | } |
96 | } | 91 | } |
@@ -103,7 +98,6 @@ func (controller *TemplateController) StateTemplate() { | @@ -103,7 +98,6 @@ func (controller *TemplateController) StateTemplate() { | ||
103 | } else { | 98 | } else { |
104 | ua := middlewares.GetUser(controller.Ctx) | 99 | ua := middlewares.GetUser(controller.Ctx) |
105 | in.CompanyId = ua.CompanyId | 100 | in.CompanyId = ua.CompanyId |
106 | - //in.CompanyId = middlewares.GetCompanyId(controller.Ctx) | ||
107 | controller.Response(ruService.State(in)) | 101 | controller.Response(ruService.State(in)) |
108 | } | 102 | } |
109 | } | 103 | } |
@@ -117,8 +111,6 @@ func (controller *TemplateController) CopyTemplate() { | @@ -117,8 +111,6 @@ func (controller *TemplateController) CopyTemplate() { | ||
117 | ua := middlewares.GetUser(controller.Ctx) | 111 | ua := middlewares.GetUser(controller.Ctx) |
118 | in.CompanyId = ua.CompanyId | 112 | in.CompanyId = ua.CompanyId |
119 | in.CreatorId = ua.UserId | 113 | in.CreatorId = ua.UserId |
120 | - //in.CompanyId = middlewares.GetCompanyId(controller.Ctx) | ||
121 | - //in.CreatorId = middlewares.GetUserId(controller.Ctx) | ||
122 | controller.Response(ruService.Copy(in)) | 114 | controller.Response(ruService.Copy(in)) |
123 | } | 115 | } |
124 | } | 116 | } |
1 | +package controllers | ||
2 | + | ||
3 | +import ( | ||
4 | + "github.com/linmadan/egglib-go/web/beego" | ||
5 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/user" | ||
6 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/application/user/query" | ||
7 | + "gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain" | ||
8 | +) | ||
9 | + | ||
10 | +type UserController struct { | ||
11 | + beego.BaseController | ||
12 | +} | ||
13 | + | ||
14 | +// ListUsers 搜索用户 | ||
15 | +func (controller *UserController) ListUsers() { | ||
16 | + listUserQuery := &query.ListUserQuery{} | ||
17 | + _ = controller.Unmarshal(listUserQuery) | ||
18 | + userAuth := controller.Ctx.Input.GetData(domain.UserAuth{}).(*domain.UserAuth) | ||
19 | + listUserQuery.CompanyId = userAuth.CompanyId | ||
20 | + resp, err := (&user.UserService{}).ListUsers(listUserQuery) | ||
21 | + controller.Response(resp, err) | ||
22 | +} |
@@ -17,6 +17,7 @@ func init() { | @@ -17,6 +17,7 @@ func init() { | ||
17 | web.NSRouter("/list", &controllers.CycleController{}, "Post:ListCycle"), | 17 | web.NSRouter("/list", &controllers.CycleController{}, "Post:ListCycle"), |
18 | web.NSRouter("/statistic", &controllers.CycleController{}, "Post:StatisticCycleUser"), | 18 | web.NSRouter("/statistic", &controllers.CycleController{}, "Post:StatisticCycleUser"), |
19 | web.NSRouter("/templates", &controllers.CycleController{}, "Post:CycleTemplateList"), | 19 | web.NSRouter("/templates", &controllers.CycleController{}, "Post:CycleTemplateList"), |
20 | + web.NSRouter("/template/:Id", &controllers.CycleController{}, "Get:CycleTemplate"), | ||
20 | ) | 21 | ) |
21 | web.AddNamespace(ns) | 22 | web.AddNamespace(ns) |
22 | } | 23 | } |
@@ -15,6 +15,7 @@ func init() { | @@ -15,6 +15,7 @@ func init() { | ||
15 | web.NSRouter("/", &controllers.RuleController{}, "Delete:RemoveRule"), | 15 | web.NSRouter("/", &controllers.RuleController{}, "Delete:RemoveRule"), |
16 | web.NSRouter("/:Id", &controllers.RuleController{}, "Get:GetRule"), | 16 | web.NSRouter("/:Id", &controllers.RuleController{}, "Get:GetRule"), |
17 | web.NSRouter("/list", &controllers.RuleController{}, "Post:ListRuleRelCreator"), | 17 | web.NSRouter("/list", &controllers.RuleController{}, "Post:ListRuleRelCreator"), |
18 | + web.NSRouter("/list-creator", &controllers.RuleController{}, "Post:ListCreator"), | ||
18 | ) | 19 | ) |
19 | web.AddNamespace(ns) | 20 | web.AddNamespace(ns) |
20 | } | 21 | } |
@@ -16,6 +16,7 @@ func init() { | @@ -16,6 +16,7 @@ func init() { | ||
16 | web.NSRouter("/:Id", &controllers.TemplateController{}, "Get:GetTemplate"), | 16 | web.NSRouter("/:Id", &controllers.TemplateController{}, "Get:GetTemplate"), |
17 | web.NSRouter("/list", &controllers.TemplateController{}, "Post:ListTemplate"), | 17 | web.NSRouter("/list", &controllers.TemplateController{}, "Post:ListTemplate"), |
18 | web.NSRouter("/list-enable", &controllers.TemplateController{}, "Post:ListEnableTemplate"), | 18 | web.NSRouter("/list-enable", &controllers.TemplateController{}, "Post:ListEnableTemplate"), |
19 | + web.NSRouter("/copy", &controllers.TemplateController{}, "Post:CopyTemplate"), | ||
19 | ) | 20 | ) |
20 | web.AddNamespace(ns) | 21 | web.AddNamespace(ns) |
21 | } | 22 | } |
pkg/port/beego/routers/user_router.go
0 → 100644
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/users", | ||
12 | + web.NSBefore(filters.AllowCors(), middlewares.CheckAdminToken()), | ||
13 | + web.NSRouter("/search", &controllers.UserController{}, "Post:ListUsers"), | ||
14 | + ) | ||
15 | + web.AddNamespace(ns) | ||
16 | +} |
-
请 注册 或 登录 后发表评论