正在显示
1 个修改的文件
包含
30 行增加
和
1 行删除
@@ -3,6 +3,7 @@ package repository | @@ -3,6 +3,7 @@ package repository | ||
3 | import ( | 3 | import ( |
4 | "fmt" | 4 | "fmt" |
5 | "github.com/go-pg/pg/v10" | 5 | "github.com/go-pg/pg/v10" |
6 | + "time" | ||
6 | 7 | ||
7 | "github.com/linmadan/egglib-go/persistent/pg/sqlbuilder" | 8 | "github.com/linmadan/egglib-go/persistent/pg/sqlbuilder" |
8 | pgTransaction "github.com/linmadan/egglib-go/transaction/pg" | 9 | pgTransaction "github.com/linmadan/egglib-go/transaction/pg" |
@@ -157,7 +158,35 @@ func (repository *DividendsEstimateRepository) Save(dividendsEstimate *domain.Di | @@ -157,7 +158,35 @@ func (repository *DividendsEstimateRepository) Save(dividendsEstimate *domain.Di | ||
157 | } | 158 | } |
158 | 159 | ||
159 | func (repository *DividendsEstimateRepository) UpdateMany(dividendsEstimates []*domain.DividendsEstimate) ([]*domain.DividendsEstimate, error) { | 160 | func (repository *DividendsEstimateRepository) UpdateMany(dividendsEstimates []*domain.DividendsEstimate) ([]*domain.DividendsEstimate, error) { |
160 | - panic("implement me") | 161 | + tx := repository.transactionContext.PgTx |
162 | + var dividendsEstimateModels []*models.DividendsEstimate | ||
163 | + for _, dividendsEstimate := range dividendsEstimates { | ||
164 | + dividendsEstimateModels = append(dividendsEstimateModels, &models.DividendsEstimate{ | ||
165 | + DividendsEstimateId: dividendsEstimate.DividendsEstimateId, | ||
166 | + DividendsAccountStatus: dividendsEstimate.DividendsAccountStatus, | ||
167 | + DividendsAmount: dividendsEstimate.DividendsAmount, | ||
168 | + DividendsEstimateOrderNumber: dividendsEstimate.DividendsEstimateOrderNumber, | ||
169 | + DividendsEstimateTime: dividendsEstimate.DividendsEstimateTime, | ||
170 | + DividendsParticipateType: dividendsEstimate.DividendsParticipateType, | ||
171 | + DividendsType: dividendsEstimate.DividendsType, | ||
172 | + OrderOrReturnedOrderNum: dividendsEstimate.OrderOrReturnedOrderNum, | ||
173 | + CooperationContractNumber: dividendsEstimate.CooperationContractNumber, | ||
174 | + DividendsUser: dividendsEstimate.DividendsUser, | ||
175 | + DividendsStage: dividendsEstimate.DividendsStage, | ||
176 | + Org: dividendsEstimate.Org, | ||
177 | + Company: dividendsEstimate.Company, | ||
178 | + Operator: dividendsEstimate.Operator, | ||
179 | + OperateTime: dividendsEstimate.OperateTime, | ||
180 | + IsCanceled: dividendsEstimate.IsCanceled, | ||
181 | + CreatedAt: dividendsEstimate.CreatedAt, | ||
182 | + DeletedAt: dividendsEstimate.DeletedAt, | ||
183 | + UpdatedAt: time.Now(), | ||
184 | + }) | ||
185 | + } | ||
186 | + if _, err := tx.Model(÷ndsEstimateModels).WherePK().Update(); err != nil { | ||
187 | + return nil, err | ||
188 | + } | ||
189 | + return dividendsEstimates, nil | ||
161 | } | 190 | } |
162 | 191 | ||
163 | func (repository *DividendsEstimateRepository) Remove(dividendsEstimate *domain.DividendsEstimate) (*domain.DividendsEstimate, error) { | 192 | func (repository *DividendsEstimateRepository) Remove(dividendsEstimate *domain.DividendsEstimate) (*domain.DividendsEstimate, error) { |
-
请 注册 或 登录 后发表评论