...
|
...
|
@@ -53,7 +53,7 @@ func (repository *DividendsReturnedOrderRepository) Save(dividendsReturnedOrder |
|
|
updateFields := sqlbuilder.RemoveSqlFields(sqlBuildFields, "dividendsReturnedOrder_id")
|
|
|
updateFieldsSnippet := sqlbuilder.SqlUpdateFieldsSnippet(updateFields)
|
|
|
tx := repository.transactionContext.PgTx
|
|
|
if dividendsReturnedOrder.Identify() == nil {
|
|
|
if dividendsReturnedOrder.Identify() == nil { // 新增分红退货单
|
|
|
dividendsReturnedOrderId, err := repository.nextIdentify()
|
|
|
if err != nil {
|
|
|
return dividendsReturnedOrder, err
|
...
|
...
|
@@ -137,7 +137,7 @@ func (repository *DividendsReturnedOrderRepository) Save(dividendsReturnedOrder |
|
|
if _, err := tx.Model(&orderGoodsModel).Insert(); err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
} else {
|
|
|
} else { // 编辑分红退货单
|
|
|
if _, err := tx.QueryOne(
|
|
|
pg.Scan(
|
|
|
÷ndsReturnedOrder.DividendsReturnedOrderId,
|
...
|
...
|
@@ -200,8 +200,10 @@ func (repository *DividendsReturnedOrderRepository) Save(dividendsReturnedOrder |
|
|
|
|
|
// 待更新分红退货单产品
|
|
|
var orderGoodsToUpdate []*domain.OrderGood
|
|
|
|
|
|
// 待添加分红退货单产品
|
|
|
var orderGoodsToAdd []*domain.OrderGood
|
|
|
|
|
|
for _, good := range dividendsReturnedOrder.Goods {
|
|
|
if good.OrderGoodId != 0 {
|
|
|
orderGoodsToUpdate = append(orderGoodsToUpdate, good)
|
...
|
...
|
@@ -305,7 +307,7 @@ func (repository *DividendsReturnedOrderRepository) Save(dividendsReturnedOrder |
|
|
}
|
|
|
}
|
|
|
if len(orderGoodModelsToDelete) > 0 {
|
|
|
if _, err := tx.Model(&orderGoodModelsToDelete).Delete(); err != nil {
|
|
|
if _, err := tx.Model(&orderGoodModelsToDelete).WherePK().Delete(); err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
}
|
...
|
...
|
|