切换导航条
此项目
正在载入...
登录
allied-creation
/
performance
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
郑周
2 years ago
提交
f00bf3a0cd51ccdae4e6c2157ce052b1652014e9
1 个父辈
b7c9bd74
增加 获取 周期下的模板列表
隐藏空白字符变更
内嵌
并排对比
正在显示
8 个修改的文件
包含
93 行增加
和
41 行删除
pkg/application/evaluation_cycle/command/cycle_query.go
pkg/application/evaluation_cycle/cycle_service.go
pkg/domain/evaluation_cycle.go
pkg/domain/evaluation_cycle_template.go
pkg/infrastructure/pg/models/evaluation_cycle_template.go
pkg/infrastructure/repository/pg_evaluation_cycle_template_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
查看文件 @
f00bf3a
...
...
@@ -24,3 +24,11 @@ type StatisticCycleProjectUserCommand struct {
func
(
in
*
StatisticCycleProjectUserCommand
)
Valid
(
*
validation
.
Validation
)
{
}
type
CycleTemplateCommand
struct
{
CycleId
int64
`cname:"周期ID" json:"cycleId,string" valid:"Required"`
}
func
(
in
*
CycleTemplateCommand
)
Valid
(
*
validation
.
Validation
)
{
}
...
...
pkg/application/evaluation_cycle/cycle_service.go
查看文件 @
f00bf3a
...
...
@@ -100,10 +100,11 @@ func (rs *EvaluationCycleService) Create(in *command.CreateCycleCommand) (interf
// 周期模板数据表中插入数据
cycleTemplate
:=
&
domain
.
EvaluationCycleTemplate
{
Id
:
0
,
Name
:
v
.
Name
,
Template
:
v
,
CycleId
:
cycle
.
Id
,
Id
:
0
,
Name
:
v
.
Name
,
TemplateCreatedAt
:
v
.
CreatedAt
,
Template
:
v
,
CycleId
:
cycle
.
Id
,
}
_
,
err
:=
cycleTemplateRepository
.
Insert
(
cycleTemplate
)
if
err
!=
nil
{
...
...
@@ -114,7 +115,7 @@ func (rs *EvaluationCycleService) Create(in *command.CreateCycleCommand) (interf
ctAdapter
.
TemplateSimples
=
append
(
ctAdapter
.
TemplateSimples
,
&
domain
.
TemplateSimple
{
Id
:
cycleTemplate
.
Id
,
Name
:
cycleTemplate
.
Name
,
CreatedAt
:
cycleTemplate
.
CreatedAt
,
CreatedAt
:
cycleTemplate
.
TemplateCreatedAt
,
// 模板创建时间
})
}
...
...
@@ -188,10 +189,11 @@ func (rs *EvaluationCycleService) Update(in *command.UpdateCycleCommand) (interf
for
i
:=
range
templates
{
v
:=
templates
[
i
]
cycleTemplate
:=
&
domain
.
EvaluationCycleTemplate
{
Id
:
0
,
Name
:
v
.
Name
,
Template
:
v
,
CycleId
:
cycle
.
Id
,
Id
:
0
,
Name
:
v
.
Name
,
TemplateCreatedAt
:
v
.
CreatedAt
,
Template
:
v
,
CycleId
:
cycle
.
Id
,
}
_
,
err
:=
cycleTemplateRepository
.
Insert
(
cycleTemplate
)
if
err
!=
nil
{
...
...
@@ -220,7 +222,7 @@ func (rs *EvaluationCycleService) Update(in *command.UpdateCycleCommand) (interf
ctAdapter
.
TemplateSimples
=
append
(
ctAdapter
.
TemplateSimples
,
&
domain
.
TemplateSimple
{
Id
:
cycleTemplates
[
i
]
.
Id
,
Name
:
cycleTemplates
[
i
]
.
Name
,
CreatedAt
:
cycleTemplates
[
i
]
.
CreatedAt
,
CreatedAt
:
cycleTemplates
[
i
]
.
Template
CreatedAt
,
})
}
...
...
@@ -257,7 +259,7 @@ func (rs *EvaluationCycleService) Get(in *command.GetCycleCommand) (interface{},
ctAdapter
.
TemplateSimples
=
append
(
ctAdapter
.
TemplateSimples
,
&
domain
.
TemplateSimple
{
Id
:
cycleTemplates
[
i
]
.
Id
,
Name
:
cycleTemplates
[
i
]
.
Name
,
CreatedAt
:
cycleTemplates
[
i
]
.
CreatedAt
,
CreatedAt
:
cycleTemplates
[
i
]
.
Template
CreatedAt
,
})
}
...
...
@@ -361,3 +363,30 @@ func (rs *EvaluationCycleService) StatisticCycleUser(in *command.StatisticCycleP
}
return
map
[
string
]
interface
{}{
"userTotal"
:
userTotal
,
"departmentTotal"
:
departmentTotal
},
nil
}
func
(
rs
*
EvaluationCycleService
)
CycleTemplateList
(
in
*
command
.
CycleTemplateCommand
)
(
interface
{},
error
)
{
transactionContext
,
err
:=
factory
.
ValidateStartTransaction
(
in
)
if
err
!=
nil
{
return
nil
,
err
}
defer
func
()
{
transactionContext
.
RollbackTransaction
()
}()
cycleTemplateRepository
:=
factory
.
CreateEvaluationCycleTemplateRepository
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
})
_
,
cycleTemplates
,
err
:=
cycleTemplateRepository
.
Find
(
map
[
string
]
interface
{}{
"cycleId"
:
in
.
CycleId
},
"template"
)
list
:=
make
([]
*
domain
.
TemplateSimple
,
0
)
for
i
:=
range
cycleTemplates
{
list
=
append
(
list
,
&
domain
.
TemplateSimple
{
Id
:
cycleTemplates
[
i
]
.
Id
,
Name
:
cycleTemplates
[
i
]
.
Name
,
CreatedAt
:
cycleTemplates
[
i
]
.
TemplateCreatedAt
,
})
}
if
err
:=
transactionContext
.
CommitTransaction
();
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
TRANSACTION_ERROR
,
err
.
Error
())
}
return
map
[
string
]
interface
{}{
"list"
:
list
},
nil
}
...
...
pkg/domain/evaluation_cycle.go
查看文件 @
f00bf3a
...
...
@@ -17,7 +17,7 @@ const (
type
TemplateSimple
struct
{
Id
int64
`json:"id,string" comment:"模板ID"`
Name
string
`json:"name" comment:"模板名称"`
CreatedAt
time
.
Time
`json:"createdAt" comment:"创建时间"`
CreatedAt
time
.
Time
`json:"createdAt" comment:"
模板
创建时间"`
}
type
EvaluationCycle
struct
{
...
...
pkg/domain/evaluation_cycle_template.go
查看文件 @
f00bf3a
...
...
@@ -5,13 +5,14 @@ import (
)
type
EvaluationCycleTemplate
struct
{
Id
int64
`json:"id,string" comment:"模板ID"`
Name
string
`json:"name" comment:"模板名称"`
Template
*
EvaluationTemplate
`json:"template" comment:"模板数据"`
CycleId
int64
`json:"cycleId,string" comment:"周期ID"`
CreatedAt
time
.
Time
`json:"createdAt" comment:"创建时间"`
UpdatedAt
time
.
Time
`json:"updatedAt" comment:"更新时间"`
DeletedAt
*
time
.
Time
`json:"deletedAt" comment:"删除时间"`
Id
int64
`json:"id,string" comment:"模板ID"`
Name
string
`json:"name" comment:"模板名称"`
TemplateCreatedAt
time
.
Time
`json:"templateCreatedAt" comment:"模板创建时间"`
Template
*
EvaluationTemplate
`json:"template" comment:"模板数据"`
CycleId
int64
`json:"cycleId,string" comment:"周期ID"`
CreatedAt
time
.
Time
`json:"createdAt" comment:"创建时间"`
UpdatedAt
time
.
Time
`json:"updatedAt" comment:"更新时间"`
DeletedAt
*
time
.
Time
`json:"deletedAt" comment:"删除时间"`
}
type
EvaluationCycleTemplateRepository
interface
{
...
...
pkg/infrastructure/pg/models/evaluation_cycle_template.go
查看文件 @
f00bf3a
...
...
@@ -6,12 +6,13 @@ import (
)
type
EvaluationCycleTemplate
struct
{
tableName
struct
{}
`comment:"评估周期模板" pg:"evaluation_cycle_template"`
Id
int64
`comment:"模板ID" pg:"pk:id"`
Name
string
`comment:"模板名称"`
Template
*
domain
.
EvaluationTemplate
`comment:"模板数据"`
CycleId
int64
`comment:"周期ID"`
CreatedAt
time
.
Time
`comment:"创建时间"`
UpdatedAt
time
.
Time
`comment:"更新时间"`
DeletedAt
*
time
.
Time
`comment:"删除时间"`
tableName
struct
{}
`comment:"评估周期模板" pg:"evaluation_cycle_template"`
Id
int64
`comment:"模板ID" pg:"pk:id"`
Name
string
`comment:"模板名称"`
TemplateCreatedAt
time
.
Time
`comment:"模板创建时间"`
Template
*
domain
.
EvaluationTemplate
`comment:"模板数据"`
CycleId
int64
`comment:"周期ID"`
CreatedAt
time
.
Time
`comment:"创建时间"`
UpdatedAt
time
.
Time
`comment:"更新时间"`
DeletedAt
*
time
.
Time
`comment:"删除时间"`
}
...
...
pkg/infrastructure/repository/pg_evaluation_cycle_template_repository.go
查看文件 @
f00bf3a
...
...
@@ -22,25 +22,27 @@ func NewEvaluationCycleTemplateRepository(transactionContext *pgTransaction.Tran
func
(
repo
*
EvaluationCycleTemplateRepository
)
TransformToDomain
(
m
*
models
.
EvaluationCycleTemplate
)
domain
.
EvaluationCycleTemplate
{
return
domain
.
EvaluationCycleTemplate
{
Id
:
m
.
Id
,
Name
:
m
.
Name
,
Template
:
m
.
Template
,
CycleId
:
m
.
CycleId
,
CreatedAt
:
m
.
CreatedAt
,
UpdatedAt
:
m
.
UpdatedAt
,
DeletedAt
:
m
.
DeletedAt
,
Id
:
m
.
Id
,
Name
:
m
.
Name
,
TemplateCreatedAt
:
m
.
TemplateCreatedAt
,
Template
:
m
.
Template
,
CycleId
:
m
.
CycleId
,
CreatedAt
:
m
.
CreatedAt
,
UpdatedAt
:
m
.
UpdatedAt
,
DeletedAt
:
m
.
DeletedAt
,
}
}
func
(
repo
*
EvaluationCycleTemplateRepository
)
TransformToModel
(
d
*
domain
.
EvaluationCycleTemplate
)
models
.
EvaluationCycleTemplate
{
return
models
.
EvaluationCycleTemplate
{
Id
:
d
.
Id
,
Name
:
d
.
Name
,
Template
:
d
.
Template
,
CycleId
:
d
.
CycleId
,
CreatedAt
:
d
.
CreatedAt
,
UpdatedAt
:
d
.
UpdatedAt
,
DeletedAt
:
d
.
DeletedAt
,
Id
:
d
.
Id
,
Name
:
d
.
Name
,
TemplateCreatedAt
:
d
.
TemplateCreatedAt
,
Template
:
d
.
Template
,
CycleId
:
d
.
CycleId
,
CreatedAt
:
d
.
CreatedAt
,
UpdatedAt
:
d
.
UpdatedAt
,
DeletedAt
:
d
.
DeletedAt
,
}
}
...
...
pkg/port/beego/controllers/evaluation_cycle_controller.go
查看文件 @
f00bf3a
...
...
@@ -87,3 +87,13 @@ func (controller *CycleController) StatisticCycleUser() {
controller
.
Response
(
ruService
.
StatisticCycleUser
(
in
))
}
}
func
(
controller
*
CycleController
)
CycleTemplateList
()
{
ruService
:=
service
.
NewEvaluationCycleService
()
in
:=
&
command
.
CycleTemplateCommand
{}
if
err
:=
controller
.
Unmarshal
(
in
);
err
!=
nil
{
controller
.
Response
(
nil
,
application
.
ThrowError
(
application
.
ARG_ERROR
,
err
.
Error
()))
}
else
{
controller
.
Response
(
ruService
.
CycleTemplateList
(
in
))
}
}
...
...
pkg/port/beego/routers/evaluation_cycle_router.go
查看文件 @
f00bf3a
...
...
@@ -16,6 +16,7 @@ func init() {
web
.
NSRouter
(
"/:Id"
,
&
controllers
.
CycleController
{},
"Get:GetCycle"
),
web
.
NSRouter
(
"/list"
,
&
controllers
.
CycleController
{},
"Post:ListCycle"
),
web
.
NSRouter
(
"/statistic"
,
&
controllers
.
CycleController
{},
"Post:StatisticCycleUser"
),
web
.
NSRouter
(
"/templates"
,
&
controllers
.
CycleController
{},
"Post:CycleTemplateList"
),
)
web
.
AddNamespace
(
ns
)
}
...
...
请
注册
或
登录
后发表评论