dividends_order.go
2.3 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
package transform
import (
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/domain"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/pg/models"
)
func TransformToDividendsOrderDomainModelFromPgModels(dividendsOrderModel *models.DividendsOrder, goods []*models.OrderGood) (*domain.DividendsOrder, error) {
var orderGoods []*domain.OrderGood
for _, good := range goods {
orderGoods = append(orderGoods, &domain.OrderGood{
OrderGoodId: good.OrderGoodId,
OrderGoodAmount: good.OrderGoodAmount,
OrderGoodName: good.OrderGoodName,
OrderGoodPrice: good.OrderGoodPrice,
OrderGoodQuantity: good.OrderGoodQuantity,
DividendsOrderNumber: good.DividendsReturnedOrderNumber,
DividendsReturnedOrderNumber: good.DividendsOrderNumber,
CooperationContractNumber: good.CooperationContractNumber,
OrderGoodExpense: good.OrderGoodExpense,
CreatedAt: good.CreatedAt,
DeletedAt: good.DeletedAt,
UpdatedAt: good.UpdatedAt,
})
}
return &domain.DividendsOrder{
DividendsOrderId: dividendsOrderModel.DividendsOrderId,
DividendsOrderNumber: dividendsOrderModel.DividendsOrderNumber,
DividendsOriginalOrderNum: dividendsOrderModel.DividendsOriginalOrderNum,
DividendsOrderAmount: dividendsOrderModel.DividendsOrderAmount,
OrderSalesman: dividendsOrderModel.OrderSalesman,
OrderTime: dividendsOrderModel.OrderTime,
DividendTime: dividendsOrderModel.DividendTime,
DividendStatus: dividendsOrderModel.DividendStatus,
Region: dividendsOrderModel.Region,
CustomerName: dividendsOrderModel.CustomerName,
Org: dividendsOrderModel.Org,
Goods: orderGoods,
Company: dividendsOrderModel.Company,
CreatedAt: dividendsOrderModel.CreatedAt,
DeletedAt: dividendsOrderModel.DeletedAt,
UpdatedAt: dividendsOrderModel.UpdatedAt,
OperateTime: dividendsOrderModel.OperateTime,
Operator: dividendsOrderModel.Operator,
}, nil
}