cooperation_contract_undertaker.go
1.9 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
package domain
import "time"
// CooperationContractUndertaker 共创合约承接人
type CooperationContractUndertaker struct {
// 共创合约承接人id
CooperationContractUndertakerId int64 `json:"cooperationContractUndertakerId,string"`
// 共创合约编号
CooperationContractNumber string `json:"cooperationContractNumber"`
// 合约ID
CooperationContractId int64 `json:"cooperationContractId"`
// 共创合约承接人
Undertaker *Undertaker `json:"undertaker"`
// 创建时间
CreatedAt time.Time `json:"createdAt"`
// 更新时间
UpdatedAt time.Time `json:"updatedAt"`
// 删除时间
DeletedAt time.Time `json:"deletedAt"`
}
type CooperationContractUndertakerRepository interface {
Save(cooperationContractUndertaker *CooperationContractUndertaker) (*CooperationContractUndertaker, error)
Remove(cooperationContractUndertaker *CooperationContractUndertaker) (*CooperationContractUndertaker, error)
FindOne(queryOptions map[string]interface{}) (*CooperationContractUndertaker, error)
Find(queryOptions map[string]interface{}) (int64, []*CooperationContractUndertaker, error)
}
func (cooperationContractUndertaker *CooperationContractUndertaker) Identify() interface{} {
if cooperationContractUndertaker.CooperationContractUndertakerId == 0 {
return nil
}
return cooperationContractUndertaker.CooperationContractUndertakerId
}
func (cooperationContractUndertaker *CooperationContractUndertaker) Update(data map[string]interface{}) error {
if cooperationContractNumber, ok := data["cooperationContractNumber"]; ok {
cooperationContractUndertaker.CooperationContractNumber = cooperationContractNumber.(string)
}
if userId, ok := data["userId"]; ok {
cooperationContractUndertaker.Undertaker.UserId = userId.(int64)
}
if userBaseId, ok := data["userBaseId"]; ok {
cooperationContractUndertaker.Undertaker.UserBaseId = userBaseId.(int64)
}
cooperationContractUndertaker.UpdatedAt = time.Now()
return nil
}