切换导航条
此项目
正在载入...
登录
allied-creation
/
performance
·
提交
转到一个项目
GitLab
转到群组
项目
活动
文件
提交
管道
0
构建
0
图表
里程碑
问题
0
合并请求
0
成员
标记
维基
派生
网络
创建新的问题
下载为
邮件补丁
差异文件
浏览文件
作者
tangxvhui
2 years ago
提交
6455976ac0a4d3a34e711ea20188839e81499bc4
1 个父辈
1a957d38
新添加 结构
隐藏空白字符变更
内嵌
并排对比
正在显示
9 个修改的文件
包含
389 行增加
和
1 行删除
pkg/domain/evaluation_item_used.go
pkg/domain/summary_evaluation.go
pkg/domain/summary_evaluation_value.go
pkg/infrastructure/pg/models/evaluation_item_used.go
pkg/infrastructure/pg/models/summary_evaluation.go
pkg/infrastructure/pg/models/summary_evaluation_value.go
pkg/infrastructure/repository/pg_evaluation_item_used_repository.go
pkg/infrastructure/repository/pg_summary_evaluation_repository.go
pkg/infrastructure/repository/pg_summary_evaluation_value_repository.go
pkg/domain/evaluation_item_used.go
查看文件 @
6455976
...
...
@@ -24,6 +24,6 @@ type EvaluationItemUsed struct {
}
type
EvaluationItemUsedRepository
interface
{
Insert
(
Item
[]
EvaluationItemUsed
)
(
*
EvaluationItemUsed
,
error
)
Insert
(
Item
[]
*
EvaluationItemUsed
)
error
Find
(
queryOptions
map
[
string
]
interface
{})
(
int64
,
[]
*
EvaluationItemUsed
,
error
)
}
...
...
pkg/domain/summary_evaluation.go
查看文件 @
6455976
...
...
@@ -52,3 +52,10 @@ const (
EvaluationCheckUncompleted
EvaluationCheckResult
=
"uncompleted"
//未确认结果
EvaluationCheckCompleted
EvaluationCheckResult
=
"completed"
//已确认结果
)
type
SummaryEvaluationRepository
interface
{
Save
(
param
*
SummaryEvaluation
)
error
Remove
(
id
int
)
error
FindOne
(
queryOptions
map
[
string
]
interface
{})
(
*
SummaryEvaluation
,
error
)
Find
(
queryOptions
map
[
string
]
interface
{})
(
int
,
[]
*
SummaryEvaluation
,
error
)
}
...
...
pkg/domain/summary_evaluation_value.go
查看文件 @
6455976
...
...
@@ -15,3 +15,10 @@ type SummaryEvaluationValue struct {
UpdatedAt
time
.
Time
//数据更新时间
DeletedAt
*
time
.
Time
//数据删除时间
}
type
SummaryEvaluationValueRepository
interface
{
Save
(
param
*
SummaryEvaluationValue
)
error
Remove
(
id
int
)
error
FindOne
(
queryOptions
map
[
string
]
interface
{})
(
*
SummaryEvaluationValue
,
error
)
Find
(
queryOptions
map
[
string
]
interface
{})
(
int
,
[]
*
SummaryEvaluationValue
,
error
)
}
...
...
pkg/infrastructure/pg/models/evaluation_item_used.go
0 → 100644
查看文件 @
6455976
package
models
import
(
"time"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
)
// 实际被应用的评估条目
type
EvaluationItemUsed
struct
{
Id
int
//id
CompanyId
int
//公司id
EvaluationProjectId
int
//对应的项目id
NodeId
int
//填写评估评估节点对应id
NodeType
string
//填写评估评估节点对应类型同evaluation_template.go->LinkNode.Type,
SortBy
int
//排序
Category
string
//类别
Name
string
//名称
PromptTitle
string
//提示项标题
PromptText
string
//提示项正文
EntryItems
[]
domain
.
EntryItem
//填写的反馈
RuleType
int
//评估方式(0评级、1评分)
Rule
domain
.
EvaluationRule
//评估的选项规则
Weight
float64
//"权重"
Required
int
// 必填项
CreatedAt
time
.
Time
//数据创建时间
UpdatedAt
time
.
Time
//数据更新时间
}
...
...
pkg/infrastructure/pg/models/summary_evaluation.go
0 → 100644
查看文件 @
6455976
package
models
import
(
"time"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
)
// 周综合评估
type
SummaryEvaluation
struct
{
tableName
struct
{}
`comment:"周综合评估" pg:"summary_evaluation"`
Id
int
`pg:",pk"`
CompanyId
int
//公司id
EvaluationProjectId
int
//对应的项目id
EvaluationProjectName
string
//对应的项目名称
CycleId
int64
//对应的周期id
CycleName
string
//对应的周期名称
TargetUser
domain
.
StaffDesc
//被评估的目标用户,被执行的
TargetDepartment
[]
domain
.
StaffDepartment
//被评估的目标用户所在的部门
Executor
domain
.
StaffDesc
//填写评估的用户,执行人
Types
int
//评估类型
Status
string
//评估的填写状态
CheckResult
int
//被执行的人确认评估结果
BeginTime
time
.
Time
//开始时间
EndTime
time
.
Time
//截止时间
TotalScore
string
//最终上级评估得分.
CreatedAt
time
.
Time
//数据创建时间
UpdatedAt
time
.
Time
//数据更新时间
DeletedAt
*
time
.
Time
//数据删除时间
}
...
...
pkg/infrastructure/pg/models/summary_evaluation_value.go
0 → 100644
查看文件 @
6455976
package
models
import
"time"
// 周期综合评估填写的内容
type
SummaryEvaluationValue
struct
{
tableName
struct
{}
`comment:"周期综合评估填写的内容" pg:"summary_evaluation"`
Id
int
//
EvaluationItemId
int
//评估条目的id
SummaryEvaluationId
int
//综合评估任务(SummaryEvaluation)的id
Value
string
//评估填写的评分
Score
string
//评定得分
Types
int
//评估类型
Remark
string
//填写的内容反馈
CreatedAt
time
.
Time
//数据创建时间
UpdatedAt
time
.
Time
//数据更新时间
DeletedAt
*
time
.
Time
//数据删除时间
}
...
...
pkg/infrastructure/repository/pg_evaluation_item_used_repository.go
查看文件 @
6455976
package
repository
import
(
pgTransaction
"github.com/linmadan/egglib-go/transaction/pg"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
)
type
EvaluationItemUsedRepository
struct
{
transactionContext
*
pgTransaction
.
TransactionContext
}
var
_
domain
.
EvaluationItemUsedRepository
=
(
*
EvaluationItemUsedRepository
)(
nil
)
func
NewEvaluationItemUsedRepository
(
transactionContext
*
pgTransaction
.
TransactionContext
)
*
EvaluationItemUsedRepository
{
return
&
EvaluationItemUsedRepository
{
transactionContext
:
transactionContext
}
}
// func (repo *EvaluationItemUsedRepository) TransformToDomain(d *models.SummaryEvaluation) *domain.SummaryEvaluation {
// return &domain.SummaryEvaluation{
// Id: d.Id,
// CompanyId: d.CompanyId,
// EvaluationProjectId: d.EvaluationProjectId,
// EvaluationProjectName: d.EvaluationProjectName,
// CycleId: d.CycleId,
// CycleName: d.CycleName,
// TargetUser: d.TargetUser,
// TargetDepartment: d.TargetDepartment,
// Executor: d.Executor,
// Types: domain.EvaluationType(d.Types),
// Status: domain.EvaluationStatus(d.Status),
// CheckResult: d.CheckResult,
// BeginTime: d.BeginTime,
// EndTime: d.EndTime,
// TotalScore: d.TotalScore,
// CreatedAt: d.CreatedAt,
// UpdatedAt: d.UpdatedAt,
// DeletedAt: d.DeletedAt,
// }
// }
func
(
repo
EvaluationItemUsedRepository
)
Insert
(
Item
[]
*
domain
.
EvaluationItemUsed
)
error
{
panic
(
"not implemented"
)
// TODO: Implement
}
func
(
repo
EvaluationItemUsedRepository
)
Find
(
queryOptions
map
[
string
]
interface
{})
(
int64
,
[]
*
domain
.
EvaluationItemUsed
,
error
)
{
panic
(
"not implemented"
)
// TODO: Implement
}
...
...
pkg/infrastructure/repository/pg_summary_evaluation_repository.go
0 → 100644
查看文件 @
6455976
package
repository
import
(
"errors"
"fmt"
"time"
"github.com/go-pg/pg/v10"
pgTransaction
"github.com/linmadan/egglib-go/transaction/pg"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/pg/models"
)
type
SummaryEvaluationRepository
struct
{
transactionContext
*
pgTransaction
.
TransactionContext
}
var
_
domain
.
SummaryEvaluationRepository
=
(
*
SummaryEvaluationRepository
)(
nil
)
func
NewSummaryEvaluationRepository
(
transactionContext
*
pgTransaction
.
TransactionContext
)
*
SummaryEvaluationRepository
{
return
&
SummaryEvaluationRepository
{
transactionContext
:
transactionContext
}
}
func
(
repo
*
SummaryEvaluationRepository
)
TransformToDomain
(
d
*
models
.
SummaryEvaluation
)
*
domain
.
SummaryEvaluation
{
return
&
domain
.
SummaryEvaluation
{
Id
:
d
.
Id
,
CompanyId
:
d
.
CompanyId
,
EvaluationProjectId
:
d
.
EvaluationProjectId
,
EvaluationProjectName
:
d
.
EvaluationProjectName
,
CycleId
:
d
.
CycleId
,
CycleName
:
d
.
CycleName
,
TargetUser
:
d
.
TargetUser
,
TargetDepartment
:
d
.
TargetDepartment
,
Executor
:
d
.
Executor
,
Types
:
domain
.
EvaluationType
(
d
.
Types
),
Status
:
domain
.
EvaluationStatus
(
d
.
Status
),
CheckResult
:
d
.
CheckResult
,
BeginTime
:
d
.
BeginTime
,
EndTime
:
d
.
EndTime
,
TotalScore
:
d
.
TotalScore
,
CreatedAt
:
d
.
CreatedAt
,
UpdatedAt
:
d
.
UpdatedAt
,
DeletedAt
:
d
.
DeletedAt
,
}
}
func
(
repo
*
SummaryEvaluationRepository
)
Save
(
param
*
domain
.
SummaryEvaluation
)
error
{
m
:=
models
.
SummaryEvaluation
{
Id
:
param
.
Id
,
CompanyId
:
param
.
CompanyId
,
EvaluationProjectId
:
param
.
EvaluationProjectId
,
EvaluationProjectName
:
param
.
EvaluationProjectName
,
CycleId
:
param
.
CycleId
,
CycleName
:
param
.
CycleName
,
TargetUser
:
param
.
TargetUser
,
TargetDepartment
:
param
.
TargetDepartment
,
Executor
:
param
.
Executor
,
Types
:
int
(
param
.
Types
),
Status
:
string
(
param
.
Status
),
CheckResult
:
param
.
CheckResult
,
BeginTime
:
param
.
BeginTime
,
EndTime
:
param
.
EndTime
,
TotalScore
:
param
.
TotalScore
,
CreatedAt
:
param
.
CreatedAt
,
UpdatedAt
:
param
.
UpdatedAt
,
DeletedAt
:
param
.
DeletedAt
,
}
db
:=
repo
.
transactionContext
.
PgTx
if
m
.
Id
==
0
{
_
,
err
:=
db
.
Model
(
&
m
)
.
Insert
()
if
err
!=
nil
{
return
err
}
}
else
{
_
,
err
:=
db
.
Model
(
&
m
)
.
Update
()
if
err
!=
nil
{
return
err
}
}
param
.
Id
=
m
.
Id
return
nil
}
func
(
repo
*
SummaryEvaluationRepository
)
Remove
(
id
int
)
error
{
tx
:=
repo
.
transactionContext
.
PgTx
nowTime
:=
time
.
Now
()
_
,
err
:=
tx
.
Model
(
&
models
.
SummaryEvaluation
{})
.
Where
(
"id=?"
,
id
)
.
Set
(
"deleted_at=?"
,
nowTime
)
.
Update
()
return
err
}
func
(
repo
*
SummaryEvaluationRepository
)
FindOne
(
queryOptions
map
[
string
]
interface
{})
(
*
domain
.
SummaryEvaluation
,
error
)
{
tx
:=
repo
.
transactionContext
.
PgTx
m
:=
new
(
models
.
SummaryEvaluation
)
query
:=
tx
.
Model
(
m
)
query
.
Where
(
"deleted_at isnull"
)
if
id
,
ok
:=
queryOptions
[
"id"
];
ok
{
query
.
Where
(
"id=?"
,
id
)
}
if
err
:=
query
.
First
();
err
!=
nil
{
if
errors
.
Is
(
err
,
pg
.
ErrNoRows
)
{
return
nil
,
fmt
.
Errorf
(
"没有此资源"
)
}
else
{
return
nil
,
err
}
}
u
:=
repo
.
TransformToDomain
(
m
)
return
u
,
nil
}
func
(
repo
*
SummaryEvaluationRepository
)
Find
(
queryOptions
map
[
string
]
interface
{})
(
int
,
[]
*
domain
.
SummaryEvaluation
,
error
)
{
tx
:=
repo
.
transactionContext
.
PgTx
var
m
[]
*
models
.
SummaryEvaluation
query
:=
tx
.
Model
(
&
m
)
.
Where
(
"deleted_at isnull"
)
.
Limit
(
20
)
if
v
,
ok
:=
queryOptions
[
"limit"
]
.
(
int
);
ok
{
query
.
Limit
(
v
)
}
if
v
,
ok
:=
queryOptions
[
"offset"
]
.
(
int
);
ok
{
query
.
Offset
(
v
)
}
count
,
err
:=
query
.
SelectAndCount
()
if
err
!=
nil
{
return
0
,
nil
,
err
}
var
datas
[]
*
domain
.
SummaryEvaluation
for
_
,
v
:=
range
m
{
d
:=
repo
.
TransformToDomain
(
v
)
datas
=
append
(
datas
,
d
)
}
return
count
,
datas
,
nil
}
...
...
pkg/infrastructure/repository/pg_summary_evaluation_value_repository.go
0 → 100644
查看文件 @
6455976
package
repository
import
(
"errors"
"fmt"
"time"
"github.com/go-pg/pg/v10"
pgTransaction
"github.com/linmadan/egglib-go/transaction/pg"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/performance/pkg/infrastructure/pg/models"
)
type
SummaryEvaluationValueRepository
struct
{
transactionContext
*
pgTransaction
.
TransactionContext
}
var
_
domain
.
SummaryEvaluationValueRepository
=
(
*
SummaryEvaluationValueRepository
)(
nil
)
func
NewSummaryEvaluationValueRepository
(
transactionContext
*
pgTransaction
.
TransactionContext
)
*
SummaryEvaluationValueRepository
{
return
&
SummaryEvaluationValueRepository
{
transactionContext
:
transactionContext
}
}
func
(
repo
*
SummaryEvaluationValueRepository
)
TransformToDomain
(
d
*
models
.
SummaryEvaluationValue
)
*
domain
.
SummaryEvaluationValue
{
return
&
domain
.
SummaryEvaluationValue
{
Id
:
d
.
Id
,
EvaluationItemId
:
d
.
EvaluationItemId
,
SummaryEvaluationId
:
d
.
SummaryEvaluationId
,
Value
:
d
.
Value
,
Score
:
d
.
Score
,
Types
:
domain
.
EvaluationType
(
d
.
Types
),
Remark
:
d
.
Remark
,
CreatedAt
:
d
.
CreatedAt
,
UpdatedAt
:
d
.
UpdatedAt
,
DeletedAt
:
d
.
DeletedAt
,
}
}
func
(
repo
*
SummaryEvaluationValueRepository
)
Save
(
param
*
domain
.
SummaryEvaluationValue
)
error
{
m
:=
models
.
SummaryEvaluationValue
{
Id
:
param
.
Id
,
EvaluationItemId
:
param
.
EvaluationItemId
,
SummaryEvaluationId
:
param
.
SummaryEvaluationId
,
Value
:
param
.
Value
,
Score
:
param
.
Score
,
Types
:
int
(
param
.
Types
),
Remark
:
param
.
Remark
,
CreatedAt
:
param
.
CreatedAt
,
UpdatedAt
:
param
.
UpdatedAt
,
DeletedAt
:
param
.
DeletedAt
,
}
db
:=
repo
.
transactionContext
.
PgTx
if
m
.
Id
==
0
{
_
,
err
:=
db
.
Model
(
&
m
)
.
Insert
()
if
err
!=
nil
{
return
err
}
}
else
{
_
,
err
:=
db
.
Model
(
&
m
)
.
Update
()
if
err
!=
nil
{
return
err
}
}
param
.
Id
=
m
.
Id
return
nil
}
func
(
repo
*
SummaryEvaluationValueRepository
)
Remove
(
id
int
)
error
{
tx
:=
repo
.
transactionContext
.
PgTx
nowTime
:=
time
.
Now
()
_
,
err
:=
tx
.
Model
(
&
models
.
SummaryEvaluationValue
{})
.
Where
(
"id=?"
,
id
)
.
Set
(
"deleted_at=?"
,
nowTime
)
.
Update
()
return
err
}
func
(
repo
*
SummaryEvaluationValueRepository
)
FindOne
(
queryOptions
map
[
string
]
interface
{})
(
*
domain
.
SummaryEvaluationValue
,
error
)
{
tx
:=
repo
.
transactionContext
.
PgTx
m
:=
new
(
models
.
SummaryEvaluationValue
)
query
:=
tx
.
Model
(
m
)
query
.
Where
(
"deleted_at isnull"
)
if
id
,
ok
:=
queryOptions
[
"id"
];
ok
{
query
.
Where
(
"id=?"
,
id
)
}
if
err
:=
query
.
First
();
err
!=
nil
{
if
errors
.
Is
(
err
,
pg
.
ErrNoRows
)
{
return
nil
,
fmt
.
Errorf
(
"没有此资源"
)
}
else
{
return
nil
,
err
}
}
u
:=
repo
.
TransformToDomain
(
m
)
return
u
,
nil
}
func
(
repo
*
SummaryEvaluationValueRepository
)
Find
(
queryOptions
map
[
string
]
interface
{})
(
int
,
[]
*
domain
.
SummaryEvaluationValue
,
error
)
{
tx
:=
repo
.
transactionContext
.
PgTx
var
m
[]
*
models
.
SummaryEvaluationValue
query
:=
tx
.
Model
(
&
m
)
.
Where
(
"deleted_at isnull"
)
.
Limit
(
20
)
if
v
,
ok
:=
queryOptions
[
"limit"
]
.
(
int
);
ok
{
query
.
Limit
(
v
)
}
if
v
,
ok
:=
queryOptions
[
"offset"
]
.
(
int
);
ok
{
query
.
Offset
(
v
)
}
count
,
err
:=
query
.
SelectAndCount
()
if
err
!=
nil
{
return
0
,
nil
,
err
}
var
datas
[]
*
domain
.
SummaryEvaluationValue
for
_
,
v
:=
range
m
{
d
:=
repo
.
TransformToDomain
(
v
)
datas
=
append
(
datas
,
d
)
}
return
count
,
datas
,
nil
}
...
...
请
注册
或
登录
后发表评论