正在显示
14 个修改的文件
包含
318 行增加
和
33 行删除
@@ -33,7 +33,7 @@ func CreateAdminPermissionRepository(options map[string]interface{}) (domain.Adm | @@ -33,7 +33,7 @@ func CreateAdminPermissionRepository(options map[string]interface{}) (domain.Adm | ||
33 | return repository.NewAdminPermissionRepository(transactionContext) | 33 | return repository.NewAdminPermissionRepository(transactionContext) |
34 | } | 34 | } |
35 | 35 | ||
36 | -//CreatePartnerInfoRepository 合伙人信息 | 36 | +//CreateOrderPaymentRepository 分红单信息 |
37 | func CreateOrderPaymentRepository(options map[string]interface{}) (domain.OrderPaymentRepository, error) { | 37 | func CreateOrderPaymentRepository(options map[string]interface{}) (domain.OrderPaymentRepository, error) { |
38 | var transactionContext *transaction.TransactionContext | 38 | var transactionContext *transaction.TransactionContext |
39 | if value, ok := options["transactionContext"]; ok { | 39 | if value, ok := options["transactionContext"]; ok { |
@@ -41,3 +41,12 @@ func CreateOrderPaymentRepository(options map[string]interface{}) (domain.OrderP | @@ -41,3 +41,12 @@ func CreateOrderPaymentRepository(options map[string]interface{}) (domain.OrderP | ||
41 | } | 41 | } |
42 | return repository.NewOrderPaymentRepository(transactionContext) | 42 | return repository.NewOrderPaymentRepository(transactionContext) |
43 | } | 43 | } |
44 | + | ||
45 | +//CreateOrderRepository 订单信息 | ||
46 | +func CreateOrderRepository(options map[string]interface{}) (domain.OrderRepository, error) { | ||
47 | + var transactionContext *transaction.TransactionContext | ||
48 | + if value, ok := options["transactionContext"]; ok { | ||
49 | + transactionContext = value.(*transaction.TransactionContext) | ||
50 | + } | ||
51 | + return repository.NewOrderRepository(transactionContext) | ||
52 | +} |
1 | +package command |
1 | +package command |
pkg/application/order/query/get_order.go
0 → 100644
pkg/application/order/query/list_order.go
0 → 100644
pkg/application/order/service/order.go
0 → 100644
1 | +package service | ||
2 | + | ||
3 | +import ( | ||
4 | + "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/application/factory" | ||
5 | + "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/application/order/query" | ||
6 | + "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/domain" | ||
7 | + "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/lib" | ||
8 | +) | ||
9 | + | ||
10 | +//OrderService 管理员相关服务 | ||
11 | +type OrderService struct { | ||
12 | +} | ||
13 | + | ||
14 | +func NewOrderService(option map[string]interface{}) *OrderService { | ||
15 | + newAdminUserService := new(OrderService) | ||
16 | + return newAdminUserService | ||
17 | +} | ||
18 | + | ||
19 | +func (service OrderService) PageListOrder(listOrderQuery query.ListOrderQuery) ([]domain.Order, int, error) { | ||
20 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
21 | + if err != nil { | ||
22 | + return nil, 0, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error()) | ||
23 | + } | ||
24 | + var ( | ||
25 | + orderRepository domain.OrderRepository | ||
26 | + orders []domain.Order | ||
27 | + cnt int | ||
28 | + ) | ||
29 | + if value, err := factory.CreateOrderRepository(map[string]interface{}{ | ||
30 | + "transactionContext": transactionContext, | ||
31 | + }); err != nil { | ||
32 | + return nil, 0, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) | ||
33 | + } else { | ||
34 | + orderRepository = value | ||
35 | + } | ||
36 | + query := domain.OrderFindQuery{ | ||
37 | + PartnerId: listOrderQuery.PartnerId, | ||
38 | + OrderCode: listOrderQuery.OrderCode, | ||
39 | + Offset: listOrderQuery.Offset, | ||
40 | + Limit: listOrderQuery.Limit, | ||
41 | + } | ||
42 | + orders, err = orderRepository.Find(query) | ||
43 | + if err != nil { | ||
44 | + return nil, 0, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) | ||
45 | + } | ||
46 | + cnt, err = orderRepository.CountAll(query) | ||
47 | + if err != nil { | ||
48 | + return nil, 0, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) | ||
49 | + } | ||
50 | + return orders, cnt, nil | ||
51 | +} | ||
52 | + | ||
53 | +func (service OrderService) GetOrder(getOrderQuery query.GetOrderQuery) (*domain.Order, error) { | ||
54 | + //实际业务 | ||
55 | + transactionContext, err := factory.CreateTransactionContext(nil) | ||
56 | + if err != nil { | ||
57 | + return nil, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error()) | ||
58 | + } | ||
59 | + var ( | ||
60 | + orderRepository domain.OrderRepository | ||
61 | + order *domain.Order | ||
62 | + ) | ||
63 | + if value, err := factory.CreateOrderRepository(map[string]interface{}{ | ||
64 | + "transactionContext": transactionContext, | ||
65 | + }); err != nil { | ||
66 | + return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) | ||
67 | + } else { | ||
68 | + orderRepository = value | ||
69 | + } | ||
70 | + order, err = orderRepository.FindOne(domain.OrderFindOneQuery{ | ||
71 | + OrderId: getOrderQuery.OrderId, | ||
72 | + }) | ||
73 | + if err != nil { | ||
74 | + return nil, lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) | ||
75 | + } | ||
76 | + | ||
77 | + return order, nil | ||
78 | +} | ||
79 | + | ||
80 | +func (service OrderService) CreateOrde() error { | ||
81 | + return nil | ||
82 | +} |
@@ -135,6 +135,7 @@ func (PartnerInfoService *PartnerInfoService) UpdatePartnerInfo(updatePartnerInf | @@ -135,6 +135,7 @@ func (PartnerInfoService *PartnerInfoService) UpdatePartnerInfo(updatePartnerInf | ||
135 | partnerInfo.Salesman = updatePartnerInfoCommand.Salesman | 135 | partnerInfo.Salesman = updatePartnerInfoCommand.Salesman |
136 | partnerInfo.Status = updatePartnerInfoCommand.Status | 136 | partnerInfo.Status = updatePartnerInfoCommand.Status |
137 | partnerInfo.RegionInfo = updatePartnerInfoCommand.RegionInfo | 137 | partnerInfo.RegionInfo = updatePartnerInfoCommand.RegionInfo |
138 | + partnerInfo.CooperateTime = updatePartnerInfoCommand.CooperateTime | ||
138 | if _, err = partnerInfoRepository.Save(partnerInfo); err != nil { | 139 | if _, err = partnerInfoRepository.Save(partnerInfo); err != nil { |
139 | return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) | 140 | return lib.ThrowError(lib.INTERNAL_SERVER_ERROR, err.Error()) |
140 | } | 141 | } |
@@ -22,6 +22,21 @@ type AdminUser struct { | @@ -22,6 +22,21 @@ type AdminUser struct { | ||
22 | Permission []AdminPermissionBase `json:"permission"` | 22 | Permission []AdminPermissionBase `json:"permission"` |
23 | } | 23 | } |
24 | 24 | ||
25 | +//TODO | ||
26 | +func (adminUser *AdminUser) Update(data map[string]string) error { | ||
27 | + return nil | ||
28 | +} | ||
29 | + | ||
30 | +//TODO | ||
31 | +func (adminUser *AdminUser) ChangePassword(data string) error { | ||
32 | + return nil | ||
33 | +} | ||
34 | + | ||
35 | +//TODO | ||
36 | +func (admin *AdminUser) ChangeIsUsable(yesOrNo bool) error { | ||
37 | + return nil | ||
38 | +} | ||
39 | + | ||
25 | type AdminUserFindQuery struct { | 40 | type AdminUserFindQuery struct { |
26 | AccountLike string | 41 | AccountLike string |
27 | Offset int | 42 | Offset int |
@@ -38,35 +38,47 @@ type Order struct { | @@ -38,35 +38,47 @@ type Order struct { | ||
38 | //实际数量 | 38 | //实际数量 |
39 | OrderActualCount int `json:"orderActualCount"` | 39 | OrderActualCount int `json:"orderActualCount"` |
40 | //订单金额 | 40 | //订单金额 |
41 | - OrderAmount int `json:"orderAmount"` | 41 | + OrderAmount float64 `json:"orderAmount"` |
42 | //实际订单金额 | 42 | //实际订单金额 |
43 | - OrderActualAmount int `json:"orderActualAmount"` | 43 | + OrderActualAmount float64 `json:"orderActualAmount"` |
44 | //订单已支付分红金额(货款) | 44 | //订单已支付分红金额(货款) |
45 | - OrderPaymentAmount int `json:"orderPaymentAmount"` | 45 | + OrderPaymentAmount float64 `json:"orderPaymentAmount"` |
46 | //订单区域信息 | 46 | //订单区域信息 |
47 | OrderRegionInfo *RegionInfo `json:"orderRegionInfo"` | 47 | OrderRegionInfo *RegionInfo `json:"orderRegionInfo"` |
48 | //买家 | 48 | //买家 |
49 | Buyer *Buyer `json:"buyer"` | 49 | Buyer *Buyer `json:"buyer"` |
50 | - //合伙人id | ||
51 | - PartnerId int64 `json:"PartnerId"` | ||
52 | //合伙人数据 | 50 | //合伙人数据 |
53 | - PartnerInfo *PartnerInfo `json:"partnerInfo"` | 51 | + PartnerInfo *Partner `json:"partnerInfo"` |
54 | //合伙人分红百分比 | 52 | //合伙人分红百分比 |
55 | PartnerBonusPercent float64 `json:"partnerBonusPercent"` | 53 | PartnerBonusPercent float64 `json:"partnerBonusPercent"` |
56 | //业务员分红百分比 | 54 | //业务员分红百分比 |
57 | SalesmanBonusPercent float64 `json:"salesmanBonusPercent"` | 55 | SalesmanBonusPercent float64 `json:"salesmanBonusPercent"` |
58 | //最后查看得时间 | 56 | //最后查看得时间 |
59 | LastViewTime time.Time `json:"lastViewTime"` | 57 | LastViewTime time.Time `json:"lastViewTime"` |
58 | + //更新时间 | ||
59 | + UpdateAt time.Time `json:"updateAt"` | ||
60 | + CreateAt time.Time `json:"createAt"` | ||
60 | } | 61 | } |
61 | 62 | ||
62 | -// type PartnerFindOneQuery struct { | ||
63 | -// UserId int64 | ||
64 | -// AccountEqual string | ||
65 | -// } | 63 | +//TODO |
64 | +func (order Order) Update(data map[string]interface{}) error { | ||
65 | + return nil | ||
66 | +} | ||
67 | + | ||
68 | +type OrderFindOneQuery struct { | ||
69 | + OrderId int64 | ||
70 | +} | ||
71 | + | ||
72 | +type OrderFindQuery struct { | ||
73 | + PartnerId int64 | ||
74 | + OrderCode string | ||
75 | + Offset int | ||
76 | + Limit int | ||
77 | +} | ||
66 | 78 | ||
67 | type OrderRepository interface { | 79 | type OrderRepository interface { |
68 | - Save(*Order) error | ||
69 | - //FindOne(qureyOptions AdminUserFindOneQuery) (*AdminUser, error) | ||
70 | - // Find(queryOptions AdminUserFindQuery) ([]AdminUser, error) | ||
71 | - // CountAll(queryOption AdminUserFindQuery) (int, error) | 80 | + Save(order *Order) error |
81 | + FindOne(qureyOptions OrderFindOneQuery) (*Order, error) | ||
82 | + Find(queryOptions OrderFindQuery) ([]Order, error) | ||
83 | + CountAll(queryOption OrderFindQuery) (int, error) | ||
72 | } | 84 | } |
@@ -16,20 +16,13 @@ const ( | @@ -16,20 +16,13 @@ const ( | ||
16 | ) | 16 | ) |
17 | 17 | ||
18 | type PartnerInfo struct { | 18 | type PartnerInfo struct { |
19 | - Partner Partner | ||
20 | - // // 合伙人ID | ||
21 | - // Id int64 `json:"id"` | ||
22 | - // // 合伙人姓名 | ||
23 | - // PartnerName string `json:"partnerName"` | ||
24 | - // // 登录账号 | ||
25 | - // Account string `json:"account"` | 19 | + Partner Partner `json:"partner"` |
26 | // 合伙类别 (1.研发合伙人 2.业务合伙人 3.事业) | 20 | // 合伙类别 (1.研发合伙人 2.业务合伙人 3.事业) |
27 | PartnerCategory int `json:"partnerCategory"` | 21 | PartnerCategory int `json:"partnerCategory"` |
28 | // 登录密码 | 22 | // 登录密码 |
29 | Password string `json:"password"` | 23 | Password string `json:"password"` |
30 | // 状态(1:启用或者0:禁用) | 24 | // 状态(1:启用或者0:禁用) |
31 | Status int `json:"status"` | 25 | Status int `json:"status"` |
32 | - | ||
33 | //创建时间 | 26 | //创建时间 |
34 | CreateAt time.Time `json:"createAt"` | 27 | CreateAt time.Time `json:"createAt"` |
35 | //更新时间 | 28 | //更新时间 |
@@ -42,10 +35,26 @@ type PartnerInfo struct { | @@ -42,10 +35,26 @@ type PartnerInfo struct { | ||
42 | Salesman []Salesman `json:"salesman"` | 35 | Salesman []Salesman `json:"salesman"` |
43 | } | 36 | } |
44 | 37 | ||
38 | +//TODO | ||
39 | +func (partner *PartnerInfo) Update(data map[string]string) error { | ||
40 | + return nil | ||
41 | +} | ||
42 | + | ||
43 | +//TODO | ||
44 | +func (partner *PartnerInfo) ChangeStatus(yesOrNo bool) error { | ||
45 | + return nil | ||
46 | +} | ||
47 | + | ||
48 | +//TODO | ||
49 | +func (partner *PartnerInfo) ChangePassword(pwd string) error { | ||
50 | + return nil | ||
51 | +} | ||
52 | + | ||
45 | type PartnerFindOneQuery struct { | 53 | type PartnerFindOneQuery struct { |
46 | UserId int64 | 54 | UserId int64 |
47 | AccountEqual string | 55 | AccountEqual string |
48 | } | 56 | } |
57 | + | ||
49 | type PartnerFindQuery struct { | 58 | type PartnerFindQuery struct { |
50 | Offset int | 59 | Offset int |
51 | Limit int | 60 | Limit int |
1 | package models | 1 | package models |
2 | 2 | ||
3 | import ( | 3 | import ( |
4 | - "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/domain" | 4 | + "context" |
5 | "time" | 5 | "time" |
6 | + | ||
7 | + "github.com/go-pg/pg/v10" | ||
8 | + "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/domain" | ||
6 | ) | 9 | ) |
7 | 10 | ||
8 | type Order struct { | 11 | type Order struct { |
@@ -46,3 +49,18 @@ type Order struct { | @@ -46,3 +49,18 @@ type Order struct { | ||
46 | //上一次查看时间 已读情况 | 49 | //上一次查看时间 已读情况 |
47 | LastViewTime time.Time | 50 | LastViewTime time.Time |
48 | } | 51 | } |
52 | + | ||
53 | +var _ pg.BeforeUpdateHook = (*Order)(nil) | ||
54 | + | ||
55 | +func (or *Order) BeforeUpdate(ctx context.Context) (context.Context, error) { | ||
56 | + or.UpdateAt = time.Now() | ||
57 | + return ctx, nil | ||
58 | +} | ||
59 | + | ||
60 | +var _ pg.BeforeInsertHook = (*Order)(nil) | ||
61 | + | ||
62 | +func (or *Order) BeforeInsert(ctx context.Context) (context.Context, error) { | ||
63 | + or.CreateAt = time.Now() | ||
64 | + or.UpdateAt = time.Now() | ||
65 | + return ctx, nil | ||
66 | +} |
@@ -122,7 +122,7 @@ func (reponsitory AdminUserRepository) Find(queryOption domain.AdminUserFindQuer | @@ -122,7 +122,7 @@ func (reponsitory AdminUserRepository) Find(queryOption domain.AdminUserFindQuer | ||
122 | err error | 122 | err error |
123 | adminuserReturn = make([]domain.AdminUser, 0) | 123 | adminuserReturn = make([]domain.AdminUser, 0) |
124 | ) | 124 | ) |
125 | - query = query.Order("admin_user.id DESC ") | 125 | + query = query.Order("id DESC ") |
126 | err = query.Select() | 126 | err = query.Select() |
127 | if err != nil { | 127 | if err != nil { |
128 | return adminuserReturn, err | 128 | return adminuserReturn, err |
@@ -22,19 +22,137 @@ func NewOrderRepository(transactionContext *transaction.TransactionContext) (*Or | @@ -22,19 +22,137 @@ func NewOrderRepository(transactionContext *transaction.TransactionContext) (*Or | ||
22 | } | 22 | } |
23 | return &OrderRepository{transactionContext: transactionContext}, nil | 23 | return &OrderRepository{transactionContext: transactionContext}, nil |
24 | } | 24 | } |
25 | -func (reponsitory OrderRepository) transformPgModelToDomainModel(adminuserModel *models.Order) (domain.Order, error) { | ||
26 | - result := domain.Order{} | 25 | + |
26 | +func (reponsitory OrderRepository) transformPgModelToDomainModel(orderModel *models.Order) (domain.Order, error) { | ||
27 | + result := domain.Order{ | ||
28 | + Id: orderModel.Id, | ||
29 | + OrderType: orderModel.OrderType, | ||
30 | + OrderCode: orderModel.OrderCode, | ||
31 | + OrderName: orderModel.OrderName, | ||
32 | + OrderStatus: orderModel.OrderStatus, | ||
33 | + OrderCount: orderModel.OrderCount, | ||
34 | + OrderActualCount: orderModel.OrderActualCount, | ||
35 | + OrderAmount: orderModel.OrderAmount, | ||
36 | + OrderActualAmount: orderModel.OrderActualAmount, | ||
37 | + OrderPaymentAmount: orderModel.OrderPaymentAmount, | ||
38 | + OrderRegionInfo: orderModel.OrderRegionInfo, | ||
39 | + Buyer: orderModel.Buyer, | ||
40 | + PartnerInfo: &domain.Partner{ | ||
41 | + Id: orderModel.PartnerId, | ||
42 | + }, | ||
43 | + PartnerBonusPercent: orderModel.PartnerBonusPercent, | ||
44 | + SalesmanBonusPercent: orderModel.SalesmanBonusPercent, | ||
45 | + LastViewTime: orderModel.LastViewTime, | ||
46 | + UpdateAt: orderModel.UpdateAt, | ||
47 | + CreateAt: orderModel.CreateAt, | ||
48 | + } | ||
27 | return result, nil | 49 | return result, nil |
28 | } | 50 | } |
29 | 51 | ||
30 | func (repository OrderRepository) Save(orderInfo *domain.Order) error { | 52 | func (repository OrderRepository) Save(orderInfo *domain.Order) error { |
31 | - return nil | 53 | + var ( |
54 | + err error | ||
55 | + tx = repository.transactionContext.PgTx | ||
56 | + ) | ||
57 | + m := &models.Order{ | ||
58 | + Id: orderInfo.Id, | ||
59 | + OrderType: orderInfo.OrderType, | ||
60 | + OrderCode: orderInfo.OrderCode, | ||
61 | + OrderName: orderInfo.OrderName, | ||
62 | + OrderStatus: orderInfo.OrderStatus, | ||
63 | + OrderCount: orderInfo.OrderCount, | ||
64 | + OrderActualCount: orderInfo.OrderActualCount, | ||
65 | + OrderAmount: orderInfo.OrderAmount, | ||
66 | + OrderActualAmount: orderInfo.OrderActualAmount, | ||
67 | + OrderPaymentAmount: orderInfo.OrderPaymentAmount, | ||
68 | + OrderRegionInfo: orderInfo.OrderRegionInfo, | ||
69 | + Buyer: orderInfo.Buyer, | ||
70 | + PartnerId: orderInfo.PartnerInfo.Id, | ||
71 | + PartnerBonusPercent: orderInfo.PartnerBonusPercent, | ||
72 | + SalesmanBonusPercent: orderInfo.SalesmanBonusPercent, | ||
73 | + CreateAt: orderInfo.CreateAt, | ||
74 | + UpdateAt: orderInfo.UpdateAt, | ||
75 | + LastViewTime: orderInfo.LastViewTime, | ||
76 | + } | ||
77 | + if m.Id == 0 { | ||
78 | + err = tx.Insert(m) | ||
79 | + orderInfo.Id = m.Id | ||
80 | + } else { | ||
81 | + err = tx.Update(m) | ||
82 | + } | ||
83 | + return err | ||
32 | } | 84 | } |
33 | 85 | ||
34 | -func (repository OrderRepository) Find() (*domain.Order, error) { | ||
35 | - return nil, nil | 86 | +func (repository OrderRepository) Find(queryOption domain.OrderFindQuery) ([]domain.Order, error) { |
87 | + db := repository.transactionContext.PgDd | ||
88 | + orderModels := []models.Order{} | ||
89 | + query := db.Model(&orderModels) | ||
90 | + | ||
91 | + if queryOption.PartnerId > 0 { | ||
92 | + query = query.Where("order.partner_id=?", queryOption.PartnerId) | ||
93 | + } | ||
94 | + if len(queryOption.OrderCode) > 0 { | ||
95 | + query = query.Where("order.order_code like ?", "%"+queryOption.OrderCode+"%") | ||
96 | + } | ||
97 | + if queryOption.Offset > -1 { | ||
98 | + query = query.Offset(queryOption.Offset) | ||
99 | + } | ||
100 | + if queryOption.Limit > 0 { | ||
101 | + query = query.Limit(queryOption.Limit) | ||
102 | + } else { | ||
103 | + query = query.Limit(20) | ||
104 | + } | ||
105 | + var ( | ||
106 | + err error | ||
107 | + ordersReturn = make([]domain.Order, 0) | ||
108 | + ) | ||
109 | + query = query.Order("order.id DESC ") | ||
110 | + err = query.Select() | ||
111 | + if err != nil { | ||
112 | + return ordersReturn, err | ||
113 | + } | ||
114 | + for i := range orderModels { | ||
115 | + domainOrder, err := repository.transformPgModelToDomainModel(&orderModels[i]) | ||
116 | + if err != nil { | ||
117 | + return ordersReturn, err | ||
118 | + } | ||
119 | + ordersReturn = append(ordersReturn, domainOrder) | ||
120 | + } | ||
121 | + return ordersReturn, nil | ||
122 | +} | ||
123 | + | ||
124 | +func (repository OrderRepository) CountAll(queryOption domain.OrderFindQuery) (int, error) { | ||
125 | + db := repository.transactionContext.PgDd | ||
126 | + orderModels := []models.Order{} | ||
127 | + query := db.Model(&orderModels) | ||
128 | + if queryOption.PartnerId > 0 { | ||
129 | + query = query.Where("order.partner_id=?", queryOption.PartnerId) | ||
130 | + } | ||
131 | + if len(queryOption.OrderCode) > 0 { | ||
132 | + query = query.Where("order.order_code like ?", "%"+queryOption.OrderCode+"%") | ||
133 | + } | ||
134 | + var ( | ||
135 | + err error | ||
136 | + ) | ||
137 | + cnt, err := query.Count() | ||
138 | + if err != nil { | ||
139 | + return cnt, err | ||
140 | + } | ||
141 | + return 0, nil | ||
36 | } | 142 | } |
37 | 143 | ||
38 | -func (repository OrderRepository) FindOne() ([]domain.Order, error) { | ||
39 | - return nil, nil | 144 | +func (repository OrderRepository) FindOne(qureyOptions domain.OrderFindOneQuery) (*domain.Order, error) { |
145 | + var ( | ||
146 | + err error | ||
147 | + tx = repository.transactionContext.PgTx | ||
148 | + ) | ||
149 | + m := new(models.Order) | ||
150 | + err = tx.Model(m). | ||
151 | + Where("id=?", qureyOptions.OrderId). | ||
152 | + First() | ||
153 | + if err != nil { | ||
154 | + return nil, err | ||
155 | + } | ||
156 | + result, err := repository.transformPgModelToDomainModel(m) | ||
157 | + return &result, err | ||
40 | } | 158 | } |
@@ -114,7 +114,7 @@ func (repository *PartnerInfoRepository) Find(queryOption domain.PartnerFindQuer | @@ -114,7 +114,7 @@ func (repository *PartnerInfoRepository) Find(queryOption domain.PartnerFindQuer | ||
114 | err error | 114 | err error |
115 | partnerReturn = make([]domain.PartnerInfo, 0) | 115 | partnerReturn = make([]domain.PartnerInfo, 0) |
116 | ) | 116 | ) |
117 | - query = query.Order("partner_info.id DESC") | 117 | + query = query.Order("id DESC") |
118 | err = query.Select() | 118 | err = query.Select() |
119 | if err != nil { | 119 | if err != nil { |
120 | return partnerReturn, err | 120 | return partnerReturn, err |
-
请 注册 或 登录 后发表评论