切换导航条
此项目
正在载入...
登录
allied-creation
/
performance
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
郑周
2 years ago
提交
18189bb55eb979bb60a417407b46c5819a7113e8
1 个父辈
5cb7d590
优化分页
周期接口调试
隐藏空白字符变更
内嵌
并排对比
正在显示
13 个修改的文件
包含
44 行增加
和
39 行删除
pkg/application/evaluation_cycle/command/cycle_query.go
pkg/application/evaluation_cycle/cycle_service.go
pkg/application/evaluation_project/project_service.go
pkg/application/role/role_user_service.go
pkg/infrastructure/repository/pg_evaluation_cycle_repository.go
pkg/infrastructure/repository/pg_evaluation_cycle_template_repository.go
pkg/infrastructure/repository/pg_evaluation_project_repository.go
pkg/infrastructure/repository/pg_evaluation_rule_repository.go
pkg/infrastructure/repository/pg_evaluation_template_repository.go
pkg/infrastructure/repository/pg_role_repository.go
pkg/infrastructure/repository/pg_role_user_repository.go
pkg/port/beego/controllers/evaluation_cycle_controller.go
pkg/port/beego/routers/evaluation_cycle_router.go
pkg/application/evaluation_cycle/command/cycle_query.go
查看文件 @
18189bb
...
...
@@ -19,8 +19,7 @@ type CycleTemplateListCommand struct {
}
type
CycleTemplateCommand
struct
{
CycleId
int64
`cname:"周期ID" json:"cycleId,string" valid:"Required"`
TemplateId
int64
`cname:"模板ID" json:"templateId,string" valid:"Required"`
Id
int64
`cname:"模板ID" json:"id,string" valid:"Required"`
}
func
(
in
*
QueryCycleCommand
)
Valid
(
validation
*
validation
.
Validation
)
{
...
...
pkg/application/evaluation_cycle/cycle_service.go
查看文件 @
18189bb
...
...
@@ -321,6 +321,10 @@ func (rs *EvaluationCycleService) List(in *command.QueryCycleCommand) (interface
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
if
err
:=
transactionContext
.
CommitTransaction
();
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
TRANSACTION_ERROR
,
err
.
Error
())
}
return
tool_funs
.
SimpleWrapGridMap
(
total
,
cycles
),
nil
}
...
...
@@ -333,7 +337,7 @@ func (rs *EvaluationCycleService) StatisticCycleUser(in *command.StatisticCycleP
transactionContext
.
RollbackTransaction
()
}()
projectRepository
:=
factory
.
CreateEvaluationProjectRepository
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
})
_
,
projects
,
err
:=
projectRepository
.
Find
(
tool_funs
.
SimpleStructToMap
(
in
),
"
linkNodes
"
)
_
,
projects
,
err
:=
projectRepository
.
Find
(
tool_funs
.
SimpleStructToMap
(
in
),
"
template
"
)
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
...
...
@@ -347,8 +351,8 @@ func (rs *EvaluationCycleService) StatisticCycleUser(in *command.StatisticCycleP
userIdMap
[
userId
]
=
userId
}
}
for
_
,
v
:=
range
userIdMap
{
userIds
=
append
(
userIds
,
v
)
for
k
:=
range
userIdMap
{
userIds
=
append
(
userIds
,
k
)
}
userTotal
:=
0
...
...
@@ -412,7 +416,7 @@ func (rs *EvaluationCycleService) CycleTemplate(in *command.CycleTemplateCommand
}()
cycleTemplateRepository
:=
factory
.
CreateEvaluationCycleTemplateRepository
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
})
cycleTemplate
,
err
:=
cycleTemplateRepository
.
FindOne
(
map
[
string
]
interface
{}{
"id"
:
in
.
Template
Id
})
cycleTemplate
,
err
:=
cycleTemplateRepository
.
FindOne
(
map
[
string
]
interface
{}{
"id"
:
in
.
Id
})
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
...
...
pkg/application/evaluation_project/project_service.go
查看文件 @
18189bb
...
...
@@ -132,7 +132,7 @@ func (rs *EvaluationProjectService) UpdateTemplate(in *command.UpdateProjectTemp
projectRepository
:=
factory
.
CreateEvaluationProjectRepository
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
})
cycleTemplateRepository
:=
factory
.
CreateEvaluationCycleTemplateRepository
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
})
_
,
projects
,
err
:=
projectRepository
.
Find
(
map
[
string
]
interface
{}{
"companyId"
:
in
.
CompanyId
,
"cycleId"
:
in
.
CycleId
},
"
linkNodes
"
)
_
,
projects
,
err
:=
projectRepository
.
Find
(
map
[
string
]
interface
{}{
"companyId"
:
in
.
CompanyId
,
"cycleId"
:
in
.
CycleId
},
"
template
"
)
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
...
...
@@ -271,7 +271,7 @@ func (rs *EvaluationProjectService) List(in *command.QueryProjectCommand) (inter
}()
projectRepository
:=
factory
.
CreateEvaluationProjectRepository
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
})
total
,
projects
,
err
:=
projectRepository
.
Find
(
tool_funs
.
SimpleStructToMap
(
in
),
"
linkNodes
"
)
total
,
projects
,
err
:=
projectRepository
.
Find
(
tool_funs
.
SimpleStructToMap
(
in
),
"
template
"
)
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
...
...
@@ -371,7 +371,7 @@ func (rs *EvaluationProjectService) CheckRecipients(in *command.CheckRecipientCo
projectRepository
:=
factory
.
CreateEvaluationProjectRepository
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
})
_
,
projects
,
err
:=
projectRepository
.
Find
(
map
[
string
]
interface
{}{
"companyId"
:
in
.
CompanyId
,
"cycleId"
:
in
.
CycleId
},
"
linkNodes
"
)
_
,
projects
,
err
:=
projectRepository
.
Find
(
map
[
string
]
interface
{}{
"companyId"
:
in
.
CompanyId
,
"cycleId"
:
in
.
CycleId
},
"
template
"
)
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
...
...
pkg/application/role/role_user_service.go
查看文件 @
18189bb
...
...
@@ -34,7 +34,7 @@ func (rs *RoleUserService) Create(in *command.UserRoleCreateCommand) (interface{
// int64Array = append(int64Array, int64Num)
//}
// 检测已存在的关联用户
_
,
rus
,
err
:=
roleUserRepository
.
Find
(
map
[
string
]
interface
{}{
"roleId"
:
in
.
RoleId
,
"companyId"
:
in
.
CompanyId
,
"userIds"
:
in
.
UserIds
,
"limit"
:
9999999
})
_
,
rus
,
err
:=
roleUserRepository
.
Find
(
map
[
string
]
interface
{}{
"roleId"
:
in
.
RoleId
,
"companyId"
:
in
.
CompanyId
,
"userIds"
:
in
.
UserIds
,
"limit"
:
int64
(
9999999
)
})
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
...
...
pkg/infrastructure/repository/pg_evaluation_cycle_repository.go
查看文件 @
18189bb
...
...
@@ -127,11 +127,11 @@ func (repo *EvaluationCycleRepository) Find(queryOptions map[string]interface{})
query
.
Where
(
"company_id = ?"
,
v
)
}
if
v
,
ok
:=
queryOptions
[
"limit"
]
.
(
int
);
ok
{
query
.
Limit
(
v
)
if
v
,
ok
:=
queryOptions
[
"limit"
]
.
(
int64
);
ok
{
query
.
Limit
(
int
(
v
))
}
if
v
,
ok
:=
queryOptions
[
"offset"
]
.
(
int
);
ok
{
query
.
Offset
(
v
)
if
v
,
ok
:=
queryOptions
[
"offset"
]
.
(
int64
);
ok
{
query
.
Offset
(
int
(
v
))
}
if
v
,
ok
:=
queryOptions
[
"timeStart"
];
ok
{
...
...
pkg/infrastructure/repository/pg_evaluation_cycle_template_repository.go
查看文件 @
18189bb
...
...
@@ -153,11 +153,11 @@ func (repo *EvaluationCycleTemplateRepository) Find(queryOptions map[string]inte
query
.
Where
(
"cycle_id = ?"
,
v
)
}
if
v
,
ok
:=
queryOptions
[
"limit"
]
.
(
int
);
ok
{
query
.
Limit
(
v
)
if
v
,
ok
:=
queryOptions
[
"limit"
]
.
(
int64
);
ok
{
query
.
Limit
(
int
(
v
))
}
if
v
,
ok
:=
queryOptions
[
"offset"
]
.
(
int
);
ok
{
query
.
Offset
(
v
)
if
v
,
ok
:=
queryOptions
[
"offset"
]
.
(
int64
);
ok
{
query
.
Offset
(
int
(
v
))
}
count
,
err
:=
query
.
SelectAndCount
()
...
...
pkg/infrastructure/repository/pg_evaluation_project_repository.go
查看文件 @
18189bb
...
...
@@ -159,11 +159,11 @@ func (repo *EvaluationProjectRepository) Find(queryOptions map[string]interface{
}
}
if
v
,
ok
:=
queryOptions
[
"limit"
]
.
(
int
);
ok
{
query
.
Limit
(
v
)
if
v
,
ok
:=
queryOptions
[
"limit"
]
.
(
int64
);
ok
{
query
.
Limit
(
int
(
v
))
}
if
v
,
ok
:=
queryOptions
[
"offset"
]
.
(
int
);
ok
{
query
.
Offset
(
v
)
if
v
,
ok
:=
queryOptions
[
"offset"
]
.
(
int64
);
ok
{
query
.
Offset
(
int
(
v
))
}
count
,
err
:=
query
.
SelectAndCount
()
...
...
pkg/infrastructure/repository/pg_evaluation_rule_repository.go
查看文件 @
18189bb
...
...
@@ -143,11 +143,11 @@ func (repo *EvaluationRuleRepository) Find(queryOptions map[string]interface{})
query
.
Where
(
"type = ?"
,
v
)
}
if
v
,
ok
:=
queryOptions
[
"limit"
]
.
(
int
);
ok
{
query
.
Limit
(
v
)
if
v
,
ok
:=
queryOptions
[
"limit"
]
.
(
int64
);
ok
{
query
.
Limit
(
int
(
v
))
}
if
v
,
ok
:=
queryOptions
[
"offset"
]
.
(
int
);
ok
{
query
.
Offset
(
v
)
if
v
,
ok
:=
queryOptions
[
"offset"
]
.
(
int64
);
ok
{
query
.
Offset
(
int
(
v
))
}
count
,
err
:=
query
.
SelectAndCount
()
...
...
pkg/infrastructure/repository/pg_evaluation_template_repository.go
查看文件 @
18189bb
...
...
@@ -150,11 +150,11 @@ func (repo *EvaluationTemplateRepository) Find(queryOptions map[string]interface
query
.
Where
(
"created_at <= ?"
,
end
)
}
if
v
,
ok
:=
queryOptions
[
"limit"
]
.
(
int
);
ok
{
query
.
Limit
(
v
)
if
v
,
ok
:=
queryOptions
[
"limit"
]
.
(
int64
);
ok
{
query
.
Limit
(
int
(
v
))
}
if
v
,
ok
:=
queryOptions
[
"offset"
]
.
(
int
);
ok
{
query
.
Offset
(
v
)
if
v
,
ok
:=
queryOptions
[
"offset"
]
.
(
int64
);
ok
{
query
.
Offset
(
int
(
v
))
}
count
,
err
:=
query
.
SelectAndCount
()
...
...
pkg/infrastructure/repository/pg_role_repository.go
查看文件 @
18189bb
...
...
@@ -121,11 +121,11 @@ func (repo *RoleRepository) Find(queryOptions map[string]interface{}) (int64, []
query
.
Where
(
"company_id = ?"
,
companyId
)
}
if
v
,
ok
:=
queryOptions
[
"limit"
]
.
(
int
);
ok
{
query
.
Limit
(
v
)
if
v
,
ok
:=
queryOptions
[
"limit"
]
.
(
int64
);
ok
{
query
.
Limit
(
int
(
v
))
}
if
v
,
ok
:=
queryOptions
[
"offset"
]
.
(
int
);
ok
{
query
.
Offset
(
v
)
if
v
,
ok
:=
queryOptions
[
"offset"
]
.
(
int64
);
ok
{
query
.
Offset
(
int
(
v
))
}
count
,
err
:=
query
.
SelectAndCount
()
...
...
pkg/infrastructure/repository/pg_role_user_repository.go
查看文件 @
18189bb
...
...
@@ -128,11 +128,11 @@ func (repo *RoleUserRepository) Find(queryOptions map[string]interface{}) (int64
query
.
Where
(
"user_id in (?)"
,
pg
.
In
(
userIds
))
}
if
v
,
ok
:=
queryOptions
[
"limit"
]
.
(
int
);
ok
{
query
.
Limit
(
v
)
if
v
,
ok
:=
queryOptions
[
"limit"
]
.
(
int64
);
ok
{
query
.
Limit
(
int
(
v
))
}
if
v
,
ok
:=
queryOptions
[
"offset"
]
.
(
int
);
ok
{
query
.
Offset
(
v
)
if
v
,
ok
:=
queryOptions
[
"offset"
]
.
(
int64
);
ok
{
query
.
Offset
(
int
(
v
))
}
count
,
err
:=
query
.
SelectAndCount
()
...
...
pkg/port/beego/controllers/evaluation_cycle_controller.go
查看文件 @
18189bb
...
...
@@ -99,9 +99,10 @@ func (controller *CycleController) CycleTemplateList() {
func
(
controller
*
CycleController
)
CycleTemplate
()
{
ruService
:=
service
.
NewEvaluationCycleService
()
in
:=
&
command
.
CycleTemplateCommand
{}
if
err
:=
controller
.
Unmarshal
(
in
);
err
!=
nil
{
if
id
,
err
:=
controller
.
GetInt64
(
":Id"
);
err
!=
nil
{
controller
.
Response
(
nil
,
application
.
ThrowError
(
application
.
ARG_ERROR
,
err
.
Error
()))
}
else
{
in
.
Id
=
id
controller
.
Response
(
ruService
.
CycleTemplate
(
in
))
}
}
...
...
pkg/port/beego/routers/evaluation_cycle_router.go
查看文件 @
18189bb
...
...
@@ -17,6 +17,7 @@ func init() {
web
.
NSRouter
(
"/list"
,
&
controllers
.
CycleController
{},
"Post:ListCycle"
),
web
.
NSRouter
(
"/statistic"
,
&
controllers
.
CycleController
{},
"Post:StatisticCycleUser"
),
web
.
NSRouter
(
"/templates"
,
&
controllers
.
CycleController
{},
"Post:CycleTemplateList"
),
web
.
NSRouter
(
"/template/:Id"
,
&
controllers
.
CycleController
{},
"Get:CycleTemplate"
),
)
web
.
AddNamespace
(
ns
)
}
...
...
请
注册
或
登录
后发表评论