...
|
...
|
@@ -110,8 +110,8 @@ func (repository *DividendsOrderRepository) Save(dividendsOrder *domain.Dividend |
|
|
OrderGoodName: good.OrderGoodName,
|
|
|
OrderGoodPrice: good.OrderGoodPrice,
|
|
|
OrderGoodQuantity: good.OrderGoodQuantity,
|
|
|
DividendsOrderNumber: good.DividendsOrderNumber,
|
|
|
DividendsReturnedOrderNumber: good.DividendsReturnedOrderNumber,
|
|
|
DividendsOrderNumber: dividendsOrder.DividendsOrderNumber,
|
|
|
DividendsReturnedOrderNumber: "",
|
|
|
CooperationContractNumber: good.CooperationContractNumber,
|
|
|
CompanyId: good.CompanyId,
|
|
|
OrgId: good.OrgId,
|
...
|
...
|
@@ -334,7 +334,10 @@ func (repository *DividendsOrderRepository) Remove(dividendsOrder *domain.Divide |
|
|
} else {
|
|
|
// 删除订单产品
|
|
|
var orderGoodModels []*models.OrderGood
|
|
|
if _, err := tx.Model(&orderGoodModels).Where("dividends_order_number = ?", dividendsOrder.DividendsOrderNumber).Delete(); err != nil {
|
|
|
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
|
|
|
}
|
|
|
}
|
...
|
...
|
@@ -385,7 +388,10 @@ func (repository *DividendsOrderRepository) FindOne(queryOptions map[string]inte |
|
|
// 获取订单产品
|
|
|
var orderGoodModels []*models.OrderGood
|
|
|
orderGoodModelQuery := tx.Model(&orderGoodModels)
|
|
|
if err := orderGoodModelQuery.Where("dividends_order_number = ?", dividendsOrderModel.DividendsOrderNumber).Select(); err != nil {
|
|
|
if err := orderGoodModelQuery.
|
|
|
Where("company_id = ?", dividendsOrderModel.Company.CompanyId).
|
|
|
Where("org_id' = ?", dividendsOrderModel.Org.OrgId).
|
|
|
Where("dividends_order_number = ?", dividendsOrderModel.DividendsOrderNumber).Select(); err != nil {
|
|
|
return nil, err
|
|
|
}
|
|
|
// 聚合分红订单
|
...
|
...
|
@@ -434,8 +440,8 @@ func (repository *DividendsOrderRepository) Find(queryOptions map[string]interfa |
|
|
var orderGoodModels []*models.OrderGood
|
|
|
orderGoodModelQuery := tx.Model(&orderGoodModels)
|
|
|
if err := orderGoodModelQuery.
|
|
|
Where("company->>'companyId' = '?'", dividendsOrderModel.Company.CompanyId).
|
|
|
Where("org->>'orgId' = '?'", dividendsOrderModel.Org.OrgId).
|
|
|
Where("company_id = ?", dividendsOrderModel.Company.CompanyId).
|
|
|
Where("org_id' = ?", dividendsOrderModel.Org.OrgId).
|
|
|
Where("dividends_order_number = ?", dividendsOrderModel.DividendsOrderNumber).
|
|
|
Select(); err != nil {
|
|
|
return 0, nil, err
|
...
|
...
|
|