...
|
...
|
@@ -2,12 +2,11 @@ package repository |
|
|
|
|
|
import (
|
|
|
"fmt"
|
|
|
"time"
|
|
|
|
|
|
"github.com/go-pg/pg"
|
|
|
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
|
|
|
"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/domain"
|
|
|
"gitlab.fjmaimaimai.com/linmadan/mmm-worth/pkg/infrastructure/pg/models"
|
|
|
"time"
|
|
|
)
|
|
|
|
|
|
type ExchangeCashActivityRepository struct {
|
...
|
...
|
@@ -88,8 +87,16 @@ func (repository *ExchangeCashActivityRepository) Find(queryOptions map[string]i |
|
|
if exchangeCashActivityNameMatch, ok := queryOptions["exchangeCashActivityNameMatch"]; ok && (exchangeCashActivityNameMatch != "") {
|
|
|
query = query.Where(`exchange_cash_activity.activity_name LIKE ?`, fmt.Sprintf("%%%s%%", exchangeCashActivityNameMatch.(string)))
|
|
|
}
|
|
|
if deadline, ok := queryOptions["exchangeCashActivityDeadline"]; ok && !deadline.(time.Time).IsZero() {
|
|
|
query = query.Where(`exchange_cash_activity.deadline < ?`, deadline)
|
|
|
|
|
|
//if deadline, ok := queryOptions["deadline"]; ok && !deadline.(time.Time).IsZero() {
|
|
|
// query = query.Where(`exchange_cash_activity.deadline > ?`, deadline)
|
|
|
//}
|
|
|
|
|
|
if deadlineStr, ok := queryOptions["deadline"]; ok && (deadlineStr.(string) != "") {
|
|
|
var layout string = "2006-01-02"
|
|
|
deadline, _:= time.Parse(layout, deadlineStr.(string))
|
|
|
var t = time.Date(deadline.Year(), deadline.Month(), deadline.Day(), 0, 0, 0, 0, time.Local)
|
|
|
query = query.Where(`exchange_cash_activity.deadline > ?`, t)
|
|
|
}
|
|
|
if offset, ok := queryOptions["offset"]; ok {
|
|
|
offset := offset.(int)
|
...
|
...
|
|