...
|
...
|
@@ -488,8 +488,20 @@ func (repository *DividendsReturnedOrderRepository) FindOne(queryOptions map[str |
|
|
tx := repository.transactionContext.PgTx
|
|
|
dividendsReturnedOrderModel := new(models.DividendsReturnedOrder)
|
|
|
query := sqlbuilder.BuildQuery(tx.Model(dividendsReturnedOrderModel), queryOptions)
|
|
|
query.SetWhereByQueryOption("dividends_returned_order.dividends_returned_order_id = ?", "dividendsReturnedOrderId")
|
|
|
query.SetWhereByQueryOption("dividends_returned_order.dividends_returned_order_number = ?", "dividendsReturnedOrderNumber")
|
|
|
if dividendsReturnedOrderId, ok := queryOptions["dividendsReturnedOrderId"]; ok && dividendsReturnedOrderId.(int64) != 0 {
|
|
|
query.Where("dividends_returned_order.dividends_returned_order_id = ?", dividendsReturnedOrderId)
|
|
|
}
|
|
|
//query.SetWhereByQueryOption("dividends_returned_order.dividends_returned_order_id = ?", "dividendsReturnedOrderId")
|
|
|
//query.SetWhereByQueryOption("dividends_returned_order.dividends_returned_order_number = ?", "dividendsReturnedOrderNumber")
|
|
|
if dividendsReturnedOrderNumber, ok := queryOptions["dividendsReturnedOrderNumber"]; ok && dividendsReturnedOrderNumber != "" {
|
|
|
query.Where("dividends_returned_order.dividends_returned_order_number = ?", dividendsReturnedOrderNumber)
|
|
|
}
|
|
|
if companyId, ok := queryOptions["companyId"]; ok && companyId.(int64) != 0 {
|
|
|
query.Where("company->>'companyId' = '?'", companyId)
|
|
|
}
|
|
|
if orgId, ok := queryOptions["orgId"]; ok && orgId.(int64) != 0 {
|
|
|
query.Where("org->>'orgId' = '?'", orgId)
|
|
|
}
|
|
|
if err := query.First(); err != nil {
|
|
|
if err.Error() == "pg: no rows in result set" {
|
|
|
return nil, fmt.Errorf("分红退货单不存在")
|
...
|
...
|
|