...
|
...
|
@@ -88,13 +88,13 @@ func (repository OrderRepository) Find(queryOption domain.OrderFindQuery) ([]dom |
|
|
orderModels := []models.Order{}
|
|
|
query := db.Model(&orderModels)
|
|
|
if queryOption.PartnerId > 0 {
|
|
|
query = query.Where("order.partner_id=?", queryOption.PartnerId)
|
|
|
query = query.Where("partner_id=?", queryOption.PartnerId)
|
|
|
}
|
|
|
if len(queryOption.OrderCode) > 0 {
|
|
|
query = query.Where("order.order_code like ?", "%"+queryOption.OrderCode+"%")
|
|
|
query = query.Where("order_code like ?", "%"+queryOption.OrderCode+"%")
|
|
|
}
|
|
|
if queryOption.OrderType > 0 {
|
|
|
query = query.Where("order.order_type=?", queryOption.OrderType)
|
|
|
query = query.Where("order_type=?", queryOption.OrderType)
|
|
|
}
|
|
|
if queryOption.Offset > -1 {
|
|
|
query = query.Offset(queryOption.Offset)
|
...
|
...
|
@@ -108,7 +108,7 @@ func (repository OrderRepository) Find(queryOption domain.OrderFindQuery) ([]dom |
|
|
err error
|
|
|
ordersReturn = make([]domain.Order, 0)
|
|
|
)
|
|
|
query = query.Order("order.id DESC ")
|
|
|
query = query.Order("order.id DESC")
|
|
|
err = query.Select()
|
|
|
if err != nil {
|
|
|
return ordersReturn, err
|
...
|
...
|
@@ -128,10 +128,13 @@ func (repository OrderRepository) CountAll(queryOption domain.OrderFindQuery) (i |
|
|
orderModels := []models.Order{}
|
|
|
query := db.Model(&orderModels)
|
|
|
if queryOption.PartnerId > 0 {
|
|
|
query = query.Where("order.partner_id=?", queryOption.PartnerId)
|
|
|
query = query.Where("partner_id=?", queryOption.PartnerId)
|
|
|
}
|
|
|
if len(queryOption.OrderCode) > 0 {
|
|
|
query = query.Where("order.order_code like ?", "%"+queryOption.OrderCode+"%")
|
|
|
query = query.Where("order_code like ?", "%"+queryOption.OrderCode+"%")
|
|
|
}
|
|
|
if queryOption.OrderType > 0 {
|
|
|
query = query.Where("order_type=?", queryOption.OrderType)
|
|
|
}
|
|
|
var (
|
|
|
err error
|
...
|
...
|
@@ -140,7 +143,7 @@ func (repository OrderRepository) CountAll(queryOption domain.OrderFindQuery) (i |
|
|
if err != nil {
|
|
|
return cnt, err
|
|
|
}
|
|
|
return 0, nil
|
|
|
return cnt, nil
|
|
|
}
|
|
|
|
|
|
func (repository OrderRepository) FindOne(qureyOptions domain.OrderFindOneQuery) (*domain.Order, error) {
|
...
|
...
|
|