dividends_order.go
4.6 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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
package domain
import "time"
// DividendsOrder 分红订单实体
type DividendsOrder struct {
// 分红订单ID
DividendsOrderId int64 `json:"dividendsOrderId,string"`
// 分红订单号
DividendsOrderNumber string `json:"dividendsOrderNumber"`
// 分红订单原单号
DividendsOriginalOrderNum string `json:"dividendsOriginalOrderNum"`
// 分红订单金额
DividendsOrderAmount float64 `json:"dividendsOrderAmount"`
// 订单业务员
OrderSalesman *User `json:"orderSalesman"`
// 订单产生时间
OrderTime time.Time `json:"orderTime"`
// 分红订单分红时间
DividendTime time.Time `json:"dividendTime"`
// 分红订单分红状态,1待分红,2已分红,3部分分红
DividendStatus int32 `json:"dividendStatus"`
// 区域
Region *RegionInfo `json:"region"`
// 客户姓名
CustomerName string `json:"customerName"`
// 数据所属组织机构
Org *Org `json:"org"`
// 公司
Company *Company `json:"company"`
// 创建时间
CreatedAt time.Time `json:"createdAt"`
// 删除时间
DeletedAt time.Time `json:"deletedAt"`
// 更新时间
UpdatedAt time.Time `json:"updatedAt"`
// 操作时间
OperateTime time.Time `json:"operateTime"`
// 操作人
Operator *User `json:"operator"`
}
type DividendsOrderRepository interface {
Save(dividendsOrder *DividendsOrder) (*DividendsOrder, error)
Remove(dividendsOrder *DividendsOrder) (*DividendsOrder, error)
FindOne(queryOptions map[string]interface{}) (*DividendsOrder, error)
Find(queryOptions map[string]interface{}) (int64, []*DividendsOrder, error)
}
func (dividendsOrder *DividendsOrder) Identify() interface{} {
if dividendsOrder.DividendsOrderId == 0 {
return nil
}
return dividendsOrder.DividendsOrderId
}
func (dividendsOrder *DividendsOrder) Update(data map[string]interface{}) error {
if dividendsOrderNumber, ok := data["dividendsOrderNumber"]; ok {
dividendsOrder.DividendsOrderNumber = dividendsOrderNumber.(string)
}
if dividendsOriginalOrderNum, ok := data["dividendsOriginalOrderNum"]; ok {
dividendsOrder.DividendsOriginalOrderNum = dividendsOriginalOrderNum.(string)
}
if dividendsOrderAmount, ok := data["dividendsOrderAmount"]; ok {
dividendsOrder.DividendsOrderAmount = dividendsOrderAmount.(float64)
}
if userId, ok := data["userId"]; ok {
dividendsOrder.OrderSalesman.UserId = userId.(int64)
}
if userBaseId, ok := data["userBaseId"]; ok {
dividendsOrder.OrderSalesman.UserBaseId = userBaseId.(int64)
}
if orgId, ok := data["orgId"]; ok {
dividendsOrder.OrderSalesman.Org.OrgId = orgId.(int64)
}
if orgName, ok := data["orgName"]; ok {
dividendsOrder.OrderSalesman.Org.OrgName = orgName.(string)
}
if companyId, ok := data["companyId"]; ok {
dividendsOrder.OrderSalesman.Org.Company.CompanyId = companyId.(int64)
}
if companyLogo, ok := data["companyLogo"]; ok {
dividendsOrder.OrderSalesman.Org.Company.CompanyLogo = companyLogo.(string)
}
if companyName, ok := data["companyName"]; ok {
dividendsOrder.OrderSalesman.Org.Company.CompanyName = companyName.(string)
}
if roleId, ok := data["roleId"]; ok {
dividendsOrder.OrderSalesman.Role.RoleId = roleId.(int64)
}
if roleName, ok := data["roleName"]; ok {
dividendsOrder.OrderSalesman.Role.RoleName = roleName.(string)
}
if userAvatar, ok := data["userAvatar"]; ok {
dividendsOrder.OrderSalesman.UserInfo.UserAvatar = userAvatar.(string)
}
if userEmail, ok := data["userEmail"]; ok {
dividendsOrder.OrderSalesman.UserInfo.UserEmail = userEmail.(string)
}
if userName, ok := data["userName"]; ok {
dividendsOrder.OrderSalesman.UserInfo.UserName = userName.(string)
}
if userPhone, ok := data["userPhone"]; ok {
dividendsOrder.OrderSalesman.UserInfo.UserPhone = userPhone.(string)
}
if userAccount, ok := data["userAccount"]; ok {
dividendsOrder.OrderSalesman.UserInfo.UserAccount = userAccount.(string)
}
if userType, ok := data["userType"]; ok {
dividendsOrder.OrderSalesman.UserType = userType.(int32)
}
if status, ok := data["status"]; ok {
dividendsOrder.OrderSalesman.Status = status.(int32)
}
if orderTime, ok := data["orderTime"]; ok {
dividendsOrder.OrderTime = orderTime.(time.Time)
}
if dividendTime, ok := data["dividendTime"]; ok {
dividendsOrder.DividendTime = dividendTime.(time.Time)
}
if dividendStatus, ok := data["dividendStatus"]; ok {
dividendsOrder.DividendStatus = dividendStatus.(int32)
}
if regionNumber, ok := data["regionNumber"]; ok {
dividendsOrder.Region.RegionNumber = regionNumber.(string)
}
if regionName, ok := data["regionName"]; ok {
dividendsOrder.Region.RegionName = regionName.(string)
}
if customerName, ok := data["customerName"]; ok {
dividendsOrder.CustomerName = customerName.(string)
}
return nil
}