切换导航条
此项目
正在载入...
登录
allied-creation
/
performance
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
tangxvhui
2 years ago
提交
5adcc2d163ec84b17834ae4aff58f1f1b62e2853
1 个父辈
a2edf44f
删除任务时 连带删除 周期评估任务
隐藏空白字符变更
内嵌
并排对比
正在显示
3 个修改的文件
包含
16 行增加
和
2 行删除
pkg/application/evaluation_project/project_service.go
pkg/domain/summary_evaluation.go
pkg/infrastructure/repository/pg_summary_evaluation_repository.go
pkg/application/evaluation_project/project_service.go
查看文件 @
5adcc2d
...
...
@@ -365,7 +365,7 @@ func (rs *EvaluationProjectService) Remove(in *command.DeleteProjectCommand) (in
projectRepository
:=
factory
.
CreateEvaluationProjectRepository
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
})
taskRepository
:=
factory
.
CreateNodeTaskRepository
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
})
staffRepository
:=
factory
.
CreateStaffAssessTaskRepository
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
})
summaryRepository
:=
factory
.
CreateSummaryEvaluationRepository
(
map
[
string
]
interface
{}{
"transactionContext"
:
transactionContext
})
project
,
err
:=
projectRepository
.
FindOne
(
map
[
string
]
interface
{}{
"id"
:
in
.
Id
})
if
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
...
...
@@ -378,7 +378,10 @@ func (rs *EvaluationProjectService) Remove(in *command.DeleteProjectCommand) (in
if
err
:=
staffRepository
.
RemoveByProjectId
(
int
(
project
.
Id
));
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
// 删除项目已生成的周期评估数据
if
err
:=
summaryRepository
.
RemoveByProjectId
(
int
(
project
.
Id
));
err
!=
nil
{
return
nil
,
application
.
ThrowError
(
application
.
INTERNAL_SERVER_ERROR
,
err
.
Error
())
}
// 移除项目关联的所有定时任务
tasks
,
err
:=
taskRepository
.
Find
(
map
[
string
]
interface
{}{
"projectId"
:
project
.
Id
})
if
err
!=
nil
{
...
...
pkg/domain/summary_evaluation.go
查看文件 @
5adcc2d
...
...
@@ -66,6 +66,7 @@ type SummaryEvaluationRepository interface {
Remove
(
id
int
)
error
FindOne
(
queryOptions
map
[
string
]
interface
{})
(
*
SummaryEvaluation
,
error
)
Find
(
queryOptions
map
[
string
]
interface
{})
(
int
,
[]
*
SummaryEvaluation
,
error
)
RemoveByProjectId
(
id
int
)
error
}
// 计算总分。TotalScore 保留1位小数
...
...
pkg/infrastructure/repository/pg_summary_evaluation_repository.go
查看文件 @
5adcc2d
...
...
@@ -184,3 +184,13 @@ func (repo *SummaryEvaluationRepository) Find(queryOptions map[string]interface{
}
return
count
,
datas
,
nil
}
func
(
repo
*
SummaryEvaluationRepository
)
RemoveByProjectId
(
id
int
)
error
{
tx
:=
repo
.
transactionContext
.
PgTx
nowTime
:=
time
.
Now
()
_
,
err
:=
tx
.
Model
(
&
models
.
SummaryEvaluation
{})
.
Where
(
"evaluation_project_id=?"
,
id
)
.
Set
(
"deleted_at=?"
,
nowTime
)
.
Update
()
return
err
}
...
...
请
注册
或
登录
后发表评论