作者 yangfu

Merge branch 'dev' of http://gitlab.fjmaimaimai.com/allied-creation/allied-creat…

…ion-cooperation into dev
... ... @@ -449,12 +449,29 @@ 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
... ... @@ -473,12 +490,29 @@ func (repository *DividendsOrderRepository) BatchRemove(dividendsOrders []*domai
} else {
for _, dividendsOrder := range dividendsOrders {
// 删除订单产品
//var orderGoodModels []*models.OrderGood
//if _, err := tx.Model(&orderGoodModels).
// Where("company_id = ?", dividendsOrder.Company.CompanyId).
// Where("org_id = ?", dividendsOrder.Org.OrgId).
// Where("dividends_order_number = ?", dividendsOrder.DividendsOrderNumber).WherePK().Delete(); err != nil {
// return nil, err
//}
// 删除订单产品
var orderGoodModels []*models.OrderGood
if _, err := tx.Model(&orderGoodModels).
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).WherePK().Delete(); err != nil {
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
}
}
}
}
}
... ...
... ... @@ -447,12 +447,29 @@ func (repository *DividendsReturnedOrderRepository) Remove(dividendsReturnedOrde
return dividendsReturnedOrder, err
} else {
// 删除分红退货单产品
//var orderGoodModels []*models.OrderGood
//if _, err := tx.Model(&orderGoodModels).
// Where("company_id = ?", dividendsReturnedOrder.Company.CompanyId).
// Where("org_id = ?", dividendsReturnedOrder.Org.OrgId).
// Where("dividends_returned_order_number = ?", dividendsReturnedOrder.DividendsReturnedOrderNumber).Delete(); err != nil {
// return nil, err
//}
// 删除分红退货单产品
var orderGoodModels []*models.OrderGood
if _, err := tx.Model(&orderGoodModels).
orderGoodQuery := tx.Model(&orderGoodModels)
if err := orderGoodQuery.
Where("company_id = ?", dividendsReturnedOrder.Company.CompanyId).
Where("org_id = ?", dividendsReturnedOrder.Org.OrgId).
Where("dividends_returned_order_number = ?", dividendsReturnedOrder.DividendsReturnedOrderNumber).Delete(); err != nil {
Where("dividends_returned_order_number = ?", dividendsReturnedOrder.DividendsReturnedOrderNumber).
Select(); err != nil {
return nil, err
} else {
if len(orderGoodModels) > 0 {
if _, err := tx.Model(&orderGoodModels).WherePK().Delete(); err != nil {
return nil, err
}
}
}
}
return dividendsReturnedOrder, nil
... ... @@ -471,13 +488,30 @@ func (repository *DividendsReturnedOrderRepository) BatchRemove(dividendsReturne
} else {
for _, dividendsReturnedOrder := range dividendsReturnedOrders {
// 删除退货单产品
//var orderGoodModels []*models.OrderGood
//if _, err := tx.Model(&orderGoodModels).
// Where("company_id = ?", dividendsReturnedOrder.Company.CompanyId).
// Where("org_id = ?", dividendsReturnedOrder.Org.OrgId).
// Where("dividends_returned_order_number = ?", dividendsReturnedOrder.DividendsReturnedOrderNumber).
// Delete(); err != nil {
// return nil, err
//}
// 删除分红退货单产品
var orderGoodModels []*models.OrderGood
if _, err := tx.Model(&orderGoodModels).
orderGoodQuery := tx.Model(&orderGoodModels)
if err := orderGoodQuery.
Where("company_id = ?", dividendsReturnedOrder.Company.CompanyId).
Where("org_id = ?", dividendsReturnedOrder.Org.OrgId).
Where("dividends_returned_order_number = ?", dividendsReturnedOrder.DividendsReturnedOrderNumber).
Delete(); err != nil {
Select(); err != nil {
return nil, err
} else {
if len(orderGoodModels) > 0 {
if _, err := tx.Model(&orderGoodModels).WherePK().Delete(); err != nil {
return nil, err
}
}
}
}
}
... ...