|
...
|
...
|
@@ -51,7 +51,7 @@ func (dao OrderBaseDao) DeliveryCodeExist(code string, companyId int64, notId .. |
|
|
|
//orderType 订单类型
|
|
|
|
//partnerOrCode 合伙人姓名或订单号或发货单号
|
|
|
|
func (dao OrderBaseDao) OrderBonusListByCondition(companyId int64, orderType int, partnerOrCode string,
|
|
|
|
partnerCategory int, limit, offset int) ([]models.OrderBase, int, error) {
|
|
|
|
partnerCategory int, createTime [2]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)
|
|
...
|
...
|
@@ -63,6 +63,15 @@ func (dao OrderBaseDao) OrderBonusListByCondition(companyId int64, orderType int |
|
|
|
if partnerCategory > 0 {
|
|
|
|
query = query.Where(`order_base.partner_category@>'{"id":?}'`, partnerCategory)
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(createTime[0]) > 0 {
|
|
|
|
query = query.Where(`order_base.create_time>=?`, createTime[0])
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(createTime[1]) > 0 {
|
|
|
|
query = query.Where(`order_base.create_time<=?`, createTime[1])
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(partnerOrCode) > 0 {
|
|
|
|
query = query.Join("LEFT JOIN partner_info as p ON order_base.partner_id=p.id").
|
|
|
|
WhereGroup(func(q *orm.Query) (*orm.Query, error) {
|
|
...
|
...
|
@@ -101,6 +110,7 @@ type CustomOrderBonusForExcel struct { |
|
|
|
//@param orderType 订单类型
|
|
|
|
//@param partnerOrCode 合伙人姓名或订单号或发货单号
|
|
|
|
//@param partnerCategory 合伙人类型id
|
|
|
|
//@param createTime 订单的创建时间范围"[开始时间,结束时间]" 时间格式"2006-01-02 15:04:05+07"
|
|
|
|
//@return result 查询结果数据
|
|
|
|
func (dao OrderBaseDao) OrderBonusListForExcel(companyId int64, orderType int, partnerOrCode string,
|
|
|
|
partnerCategory int) (result []CustomOrderBonusForExcel, err error) {
|
|
...
|
...
|
@@ -168,8 +178,9 @@ func (dao OrderBaseDao) OrderBonusListForExcel(companyId int64, orderType int, p |
|
|
|
//@param partnerOrCode 合伙人姓名或订单号或发货单号
|
|
|
|
//@param partnerCategory 合伙人类型id
|
|
|
|
//@param updateTime 订单更新时间范围"[开始时间,结束时间]",时间格式"2006-01-02 15:04:05+07"
|
|
|
|
//@param createTime 订单的创建时间范围"[开始时间,结束时间]" 时间格式"2006-01-02 15:04:05+07"
|
|
|
|
func (dao OrderBaseDao) OrderListByCondition(companyId int64, orderType int, partnerOrCode string,
|
|
|
|
updateTime [2]string, partnerCategory int, limit, offset int) ([]models.OrderBase, int, error) {
|
|
|
|
updateTime [2]string, createTime [2]string, partnerCategory int, 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)
|
|
...
|
...
|
@@ -187,6 +198,13 @@ func (dao OrderBaseDao) OrderListByCondition(companyId int64, orderType int, par |
|
|
|
if len(updateTime[1]) > 0 {
|
|
|
|
query = query.Where(`order_base.update_time<=?`, updateTime[1])
|
|
|
|
}
|
|
|
|
if len(createTime[0]) > 0 {
|
|
|
|
query = query.Where(`order_base.create_time>=?`, createTime[0])
|
|
|
|
}
|
|
|
|
if len(createTime[1]) > 0 {
|
|
|
|
query = query.Where(`order_base.create_time<=?`, createTime[1])
|
|
|
|
}
|
|
|
|
|
|
|
|
if len(partnerOrCode) > 0 {
|
|
|
|
query = query.Join("LEFT JOIN partner_info as p ON order_base.partner_id=p.id").
|
|
|
|
WhereGroup(func(q *orm.Query) (*orm.Query, error) {
|
...
|
...
|
|