作者 陈志颖

fix:产品查询

... ... @@ -336,7 +336,7 @@ func (repository *DividendsOrderRepository) Remove(dividendsOrder *domain.Divide
var orderGoodModels []*models.OrderGood
if _, err := tx.Model(&orderGoodModels).
Where("company_id = ?", dividendsOrderModel.Company.CompanyId).
Where("org_id' = ?", dividendsOrderModel.Org.OrgId).
Where("org_id = ?", dividendsOrderModel.Org.OrgId).
Where("dividends_order_number = ?", dividendsOrder.DividendsOrderNumber).Delete(); err != nil {
return nil, err
}
... ... @@ -358,7 +358,10 @@ func (repository *DividendsOrderRepository) BatchRemove(dividendsOrders []*domai
for _, dividendsOrder := range dividendsOrders {
// 删除订单产品
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 = ?", dividendsOrder.Company.CompanyId).
Where("org_id = ?", dividendsOrder.Org.OrgId).
Where("dividends_order_number = ?", dividendsOrder.DividendsOrderNumber).Delete(); err != nil {
return nil, err
}
}
... ... @@ -371,7 +374,6 @@ func (repository *DividendsOrderRepository) FindOne(queryOptions map[string]inte
dividendsOrderModel := new(models.DividendsOrder)
query := sqlbuilder.BuildQuery(tx.Model(dividendsOrderModel), queryOptions)
query.SetWhereByQueryOption("dividends_order.dividends_order_id = ?", "dividendsOrderId")
//query.SetWhereByQueryOption("dividends_order.dividends_order_number = ?", "dividendsOrderNumber")
if dividendsOrderNumber, ok := queryOptions["dividendsOrderNumber"]; ok && dividendsOrderNumber != "" {
query.Where("dividends_order.dividends_order_number = ?", dividendsOrderNumber)
}
... ... @@ -390,7 +392,7 @@ func (repository *DividendsOrderRepository) FindOne(queryOptions map[string]inte
orderGoodModelQuery := tx.Model(&orderGoodModels)
if err := orderGoodModelQuery.
Where("company_id = ?", dividendsOrderModel.Company.CompanyId).
Where("org_id' = ?", dividendsOrderModel.Org.OrgId).
Where("org_id = ?", dividendsOrderModel.Org.OrgId).
Where("dividends_order_number = ?", dividendsOrderModel.DividendsOrderNumber).Select(); err != nil {
return nil, err
}
... ... @@ -441,7 +443,7 @@ func (repository *DividendsOrderRepository) Find(queryOptions map[string]interfa
orderGoodModelQuery := tx.Model(&orderGoodModels)
if err := orderGoodModelQuery.
Where("company_id = ?", dividendsOrderModel.Company.CompanyId).
Where("org_id' = ?", dividendsOrderModel.Org.OrgId).
Where("org_id = ?", dividendsOrderModel.Org.OrgId).
Where("dividends_order_number = ?", dividendsOrderModel.DividendsOrderNumber).
Select(); err != nil {
return 0, nil, err
... ...