...
|
...
|
@@ -449,14 +449,31 @@ func (repository *DividendsOrderRepository) Remove(dividendsOrder *domain.Divide |
|
|
return dividendsOrder, err
|
|
|
} else {
|
|
|
// 删除订单产品
|
|
|
//var orderGoodModels []*models.OrderGood
|
|
|
//if _, err := tx.Model(&orderGoodModels).
|
|
|
// Where("company_id = ?", dividendsOrderModel.Company.CompanyId).
|
|
|
// Where("org_id = ?", dividendsOrderModel.Org.OrgId).
|
|
|
// Where("dividends_order_number = ?", dividendsOrder.DividendsOrderNumber).Delete(); err != nil {
|
|
|
// return nil, err
|
|
|
//}
|
|
|
|
|
|
// 删除订单产品
|
|
|
var orderGoodModels []*models.OrderGood
|
|
|
if _, err := tx.Model(&orderGoodModels).
|
|
|
Where("company_id = ?", dividendsOrderModel.Company.CompanyId).
|
|
|
Where("org_id = ?", dividendsOrderModel.Org.OrgId).
|
|
|
Where("dividends_order_number = ?", dividendsOrder.DividendsOrderNumber).Delete(); err != nil {
|
|
|
orderGoodQuery := tx.Model(&orderGoodModels)
|
|
|
if err := orderGoodQuery.
|
|
|
Where("company_id = ?", dividendsOrder.Company.CompanyId).
|
|
|
Where("org_id = ?", dividendsOrder.Org.OrgId).
|
|
|
Where("dividends_order_number = ?", dividendsOrder.DividendsOrderNumber).
|
|
|
Select(); err != nil {
|
|
|
return nil, err
|
|
|
} else {
|
|
|
if len(orderGoodModels) > 0 {
|
|
|
if _, err := tx.Model(&orderGoodModels).WherePK().Delete(); err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
return dividendsOrder, nil
|
|
|
}
|
|
|
|
...
|
...
|
|