作者 yangfu

账期结算修改

... ... @@ -32,6 +32,10 @@ type SearchCreditAccountQuery struct {
UserId int64 `cname:"用户ID" json:"userId"`
// 用户基础数据id
UserBaseId int64 `cname:"用户基础数据ID" json:"userBaseId"`
// 账期创建-开始时间
BeginTime time.Time `json:"beginTime"`
// 账期创建-结束时间
EndTime time.Time `json:"endTime"`
}
func (searchCreditAccountQuery *SearchCreditAccountQuery) Valid(validation *validation.Validation) {
... ...
... ... @@ -4,6 +4,7 @@ import (
"fmt"
"github.com/go-pg/pg/v10"
"gitlab.fjmaimaimai.com/allied-creation/allied-creation-cooperation/pkg/infrastructure/utils"
"time"
"github.com/linmadan/egglib-go/persistent/pg/sqlbuilder"
pgTransaction "github.com/linmadan/egglib-go/transaction/pg"
... ... @@ -220,6 +221,12 @@ func (repository *CreditAccountRepository) Find(queryOptions map[string]interfac
newOrgIds := utils.SliceItoa(orgIds.([]int64))
query.Where("org->>'orgId' in (?)", pg.In(newOrgIds))
}
if v, ok := queryOptions["beginTime"]; ok && !(v.(time.Time).IsZero()) {
query.Where(`created_at>? `, queryOptions["beginTime"])
}
if v, ok := queryOptions["endTime"]; ok && !(v.(time.Time).IsZero()) {
query.Where(`created_at<? `, queryOptions["endTime"])
}
offsetLimitFlag := true
if offsetLimit, ok := queryOptions["offsetLimit"]; ok {
offsetLimitFlag = offsetLimit.(bool)
... ...