作者 唐旭辉

更新

... ... @@ -736,7 +736,7 @@ func (service OrderInfoService) PageListOrderBonus(listOrderQuery query.ListOrde
}); err != nil {
return nil, cnt, lib.ThrowError(lib.TRANSACTION_ERROR, err.Error())
}
ordersM, cnt, err = orderBaseDao.OrderListByCondition(
ordersM, cnt, err = orderBaseDao.OrderBonusListByCondition(
listOrderQuery.CompanyId,
listOrderQuery.OrderType,
listOrderQuery.PartnerOrCode,
... ...
... ... @@ -5,6 +5,7 @@ import (
"github.com/go-pg/pg/v10/orm"
"gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/domain"
"gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/infrastructure/pg/models"
"gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/infrastructure/pg/transaction"
)
... ... @@ -45,15 +46,17 @@ func (dao OrderBaseDao) DeliveryCodeExist(code string, companyId int64, notId ..
return ok, err
}
//OrderListByCondition 根据条件获取订单列表
//OrderListByCondition 根据条件获取订单分红列表
//orderType 订单类型
//partnerOrCode 合伙人姓名或订单号或发货单号
func (dao OrderBaseDao) OrderListByCondition(companyId int64, orderType int, partnerOrCode string, limit, offset int) ([]models.OrderBase, int, error) {
func (dao OrderBaseDao) OrderBonusListByCondition(companyId int64, orderType int, partnerOrCode string, limit, offset int) ([]models.OrderBase, int, error) {
tx := dao.transactionContext.GetDB()
var orders []models.OrderBase
query := tx.Model(&orders).Where("order_base.company_id=?", companyId)
if orderType > 0 {
query = query.Where("order_base.order_type=?", orderType)
} else {
query = query.Where("order_base.order_type<>?", domain.OrderIntention)
}
if len(partnerOrCode) > 0 {
query = query.Join("LEFT JOIN partner_info as p ON order_base.partner_id=p.id").
... ...