cooperation_mode.go
1.8 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
package domain
import "time"
// CooperationMode 共创模式实体
type CooperationMode struct {
// 共创模式ID
CooperationModeId int64 `json:"cooperationModeId,string"`
// 共创模式编码,唯一确定
CooperationModeNumber string `json:"cooperationModeNumber"`
// 模式名称,唯一确定
CooperationModeName string `json:"cooperationModeName"`
// 共创模式状态,1启用,2禁用
Status int32 `json:"status"`
// 数据所属组织机构
Org *Org `json:"org"`
// 公司
Company *Company `json:"company"`
// 备注
Remarks string `json:"remarks"`
// 操作人
Operator *User `json:"operator"`
// 操作时间
OperateTime time.Time `json:"operateTime"`
// 更新时间
UpdatedAt time.Time `json:"updatedAt"`
// 删除时间
DeletedAt time.Time `json:"deletedAt"`
// 创建时间
CreatedAt time.Time `json:"createdAt"`
}
type CooperationModeRepository interface {
Save(cooperationMode *CooperationMode) (*CooperationMode, error)
Remove(cooperationMode *CooperationMode) (*CooperationMode, error)
BatchRemove(cooperationModes []*CooperationMode) ([]*CooperationMode, error)
FindOne(queryOptions map[string]interface{}) (*CooperationMode, error)
Find(queryOptions map[string]interface{}) (int64, []*CooperationMode, error)
}
func (cooperationMode *CooperationMode) Identify() interface{} {
if cooperationMode.CooperationModeId == 0 {
return nil
}
return cooperationMode.CooperationModeId
}
func (cooperationMode *CooperationMode) Update(data map[string]interface{}) error {
if cooperationModeName, ok := data["cooperationModeName"]; ok {
cooperationMode.CooperationModeName = cooperationModeName.(string)
}
if status, ok := data["status"]; ok {
cooperationMode.Status = status.(int32)
}
if remarks, ok := data["remarks"]; ok {
cooperationMode.Remarks = remarks.(string)
}
return nil
}