|
@@ -5,6 +5,7 @@ import ( |
|
@@ -5,6 +5,7 @@ import ( |
5
|
|
5
|
|
6
|
"github.com/go-pg/pg/v10/orm"
|
6
|
"github.com/go-pg/pg/v10/orm"
|
7
|
|
7
|
|
|
|
8
|
+ "gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/domain"
|
8
|
"gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/infrastructure/pg/models"
|
9
|
"gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/infrastructure/pg/models"
|
9
|
"gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/infrastructure/pg/transaction"
|
10
|
"gitlab.fjmaimaimai.com/mmm-go/partnermg/pkg/infrastructure/pg/transaction"
|
10
|
)
|
11
|
)
|
|
@@ -45,15 +46,17 @@ func (dao OrderBaseDao) DeliveryCodeExist(code string, companyId int64, notId .. |
|
@@ -45,15 +46,17 @@ func (dao OrderBaseDao) DeliveryCodeExist(code string, companyId int64, notId .. |
45
|
return ok, err
|
46
|
return ok, err
|
46
|
}
|
47
|
}
|
47
|
|
48
|
|
48
|
-//OrderListByCondition 根据条件获取订单列表
|
49
|
+//OrderListByCondition 根据条件获取订单分红列表
|
49
|
//orderType 订单类型
|
50
|
//orderType 订单类型
|
50
|
//partnerOrCode 合伙人姓名或订单号或发货单号
|
51
|
//partnerOrCode 合伙人姓名或订单号或发货单号
|
51
|
-func (dao OrderBaseDao) OrderListByCondition(companyId int64, orderType int, partnerOrCode string, limit, offset int) ([]models.OrderBase, int, error) {
|
52
|
+func (dao OrderBaseDao) OrderBonusListByCondition(companyId int64, orderType int, partnerOrCode string, limit, offset int) ([]models.OrderBase, int, error) {
|
52
|
tx := dao.transactionContext.GetDB()
|
53
|
tx := dao.transactionContext.GetDB()
|
53
|
var orders []models.OrderBase
|
54
|
var orders []models.OrderBase
|
54
|
query := tx.Model(&orders).Where("order_base.company_id=?", companyId)
|
55
|
query := tx.Model(&orders).Where("order_base.company_id=?", companyId)
|
55
|
if orderType > 0 {
|
56
|
if orderType > 0 {
|
56
|
query = query.Where("order_base.order_type=?", orderType)
|
57
|
query = query.Where("order_base.order_type=?", orderType)
|
|
|
58
|
+ } else {
|
|
|
59
|
+ query = query.Where("order_base.order_type<>?", domain.OrderIntention)
|
57
|
}
|
60
|
}
|
58
|
if len(partnerOrCode) > 0 {
|
61
|
if len(partnerOrCode) > 0 {
|
59
|
query = query.Join("LEFT JOIN partner_info as p ON order_base.partner_id=p.id").
|
62
|
query = query.Join("LEFT JOIN partner_info as p ON order_base.partner_id=p.id").
|