...
|
...
|
@@ -96,7 +96,7 @@ func (repository *DividendsReturnedOrderRepository) Save(dividendsReturnedOrder |
|
|
dividendsReturnedOrder.Org,
|
|
|
dividendsReturnedOrder.Company,
|
|
|
dividendsReturnedOrder.CreatedAt,
|
|
|
dividendsReturnedOrder.DeletedAt,
|
|
|
nil,
|
|
|
dividendsReturnedOrder.UpdatedAt,
|
|
|
dividendsReturnedOrder.Operator,
|
|
|
dividendsReturnedOrder.OperateTime,
|
...
|
...
|
@@ -162,7 +162,7 @@ func (repository *DividendsReturnedOrderRepository) Save(dividendsReturnedOrder |
|
|
dividendsReturnedOrder.Org,
|
|
|
dividendsReturnedOrder.Company,
|
|
|
dividendsReturnedOrder.CreatedAt,
|
|
|
dividendsReturnedOrder.DeletedAt,
|
|
|
nil,
|
|
|
dividendsReturnedOrder.UpdatedAt,
|
|
|
dividendsReturnedOrder.Operator,
|
|
|
dividendsReturnedOrder.OperateTime,
|
...
|
...
|
@@ -273,6 +273,28 @@ func (repository *DividendsReturnedOrderRepository) Remove(dividendsReturnedOrde |
|
|
return dividendsReturnedOrder, nil
|
|
|
}
|
|
|
|
|
|
func (repository *DividendsReturnedOrderRepository) BatchRemove(dividendsReturnedOrders []*domain.DividendsReturnedOrder) ([]*domain.DividendsReturnedOrder, error) {
|
|
|
tx := repository.transactionContext.PgTx
|
|
|
var dividendsReturnedOrderModels []*models.DividendsReturnedOrder
|
|
|
for _, dividendsReturnedOrder := range dividendsReturnedOrders {
|
|
|
dividendsReturnedOrderModels = append(dividendsReturnedOrderModels, &models.DividendsReturnedOrder{
|
|
|
DividendsReturnedOrderId: dividendsReturnedOrder.Identify().(int64),
|
|
|
})
|
|
|
}
|
|
|
if _, err := tx.Model(÷ndsReturnedOrderModels).WherePK().Delete(); err != nil {
|
|
|
return dividendsReturnedOrders, err
|
|
|
} else {
|
|
|
for _, dividendsReturnedOrder := range dividendsReturnedOrders {
|
|
|
// 删除退货单产品
|
|
|
var orderGoodModels []*models.OrderGood
|
|
|
if _, err := tx.Model(&orderGoodModels).Where("dividends_returned_order_number = ?", dividendsReturnedOrder.DividendsReturnedOrderNumber).Delete(); err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return dividendsReturnedOrders, nil
|
|
|
}
|
|
|
|
|
|
func (repository *DividendsReturnedOrderRepository) FindOne(queryOptions map[string]interface{}) (*domain.DividendsReturnedOrder, error) {
|
|
|
tx := repository.transactionContext.PgTx
|
|
|
dividendsReturnedOrderModel := new(models.DividendsReturnedOrder)
|
...
|
...
|
@@ -304,6 +326,9 @@ func (repository *DividendsReturnedOrderRepository) Find(queryOptions map[string |
|
|
var dividendsReturnedOrderModels []*models.DividendsReturnedOrder
|
|
|
dividendsReturnedOrders := make([]*domain.DividendsReturnedOrder, 0)
|
|
|
query := sqlbuilder.BuildQuery(tx.Model(÷ndsReturnedOrderModels), queryOptions)
|
|
|
if dividendsReturnedOrderIds, ok := queryOptions["dividendsReturnedOrderIds"]; ok && len(dividendsReturnedOrderIds.([]int64)) > 0 {
|
|
|
query.Where("dividends_returned_order_id IN (?)", pg.In(dividendsReturnedOrderIds.([]int64)))
|
|
|
}
|
|
|
offsetLimitFlag := true
|
|
|
if offsetLimit, ok := queryOptions["offsetLimit"]; ok {
|
|
|
offsetLimitFlag = offsetLimit.(bool)
|
...
|
...
|
|