cooperation_contract.go
3.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
package domain
import (
"time"
)
// CooperationContract 共创项目合约实体
type CooperationContract struct {
// 共创合约ID
CooperationContractId int64 `json:"cooperationContractId,string"`
// 共创合约描述
CooperationContractDescription string `json:"cooperationContractDescription"`
// 共创合约名称
CooperationContractName string `json:"cooperationContractName"`
// 共创合约编号
CooperationContractNumber string `json:"cooperationContractNumber"`
// 共创项目编号
CooperationProjectNumber string `json:"cooperationProjectNumber"`
// 共创合约承接对象,1员工,2共创用户,3公开
CooperationContractUndertakerTypes []int32 `json:"cooperationContractUndertakerTypes"`
// 共创合约发起人
CooperationContractSponsor *User `json:"cooperationContractSponsor"`
// 共创模式或者合伙模式
CooperationMode *CooperationMode `json:"cooperationMode"`
// 合约状态,1恢复,2暂停
Status int32 `json:"status"`
// 数据所属组织机构
Org *Org `json:"org"`
// 公司
Company *Company `json:"company"`
// 操作人
Operator *User `json:"operator"`
// 分红激励规则
DividendsIncentivesRules []*DividendsIncentivesRule `json:"dividendsIncentivesRules"`
// 金额激励规则
MoneyIncentivesRules []*MoneyIncentivesRule `json:"moneyIncentivesRules"`
// 共创承接人列表
Undertakers []*Undertaker `json:"undertakers"`
// 共创合约相关人列表
RelevantPeople []*Relevant `json:"relevantPeople"`
// 操作时间
OperateTime time.Time `json:"operateTime"`
// 创建时间
CreatedAt time.Time `json:"createdAt"`
// 删除时间
DeletedAt time.Time `json:"deletedAt"`
// 更新时间
UpdatedAt time.Time `json:"updatedAt"`
}
type CooperationContractRepository interface {
Save(cooperationContract *CooperationContract) (*CooperationContract, error)
Remove(cooperationContract *CooperationContract) (*CooperationContract, error)
FindOne(queryOptions map[string]interface{}) (*CooperationContract, error)
Find(queryOptions map[string]interface{}) (int64, []*CooperationContract, error)
}
func (cooperationContract *CooperationContract) Identify() interface{} {
if cooperationContract.CooperationContractId == 0 {
return nil
}
return cooperationContract.CooperationContractId
}
func (cooperationContract *CooperationContract) Update(data map[string]interface{}) error {
if cooperationContractDescription, ok := data["cooperationContractDescription"]; ok {
cooperationContract.CooperationContractDescription = cooperationContractDescription.(string)
}
if cooperationContractName, ok := data["cooperationContractName"]; ok {
cooperationContract.CooperationContractName = cooperationContractName.(string)
}
if cooperationContractNumber, ok := data["cooperationContractNumber"]; ok {
cooperationContract.CooperationContractNumber = cooperationContractNumber.(string)
}
if cooperationContractUndertakerTypes, ok := data["cooperationContractUndertakerTypes"]; ok {
cooperationContract.CooperationContractUndertakerTypes = cooperationContractUndertakerTypes.([]int32)
}
if status, ok := data["status"]; ok {
cooperationContract.Status = status.(int32)
}
if operateTime, ok := data["operateTime"]; ok {
cooperationContract.OperateTime = operateTime.(time.Time)
}
return nil
}