From 530fed8ec225453572d57b15c200ab062c335457 Mon Sep 17 00:00:00 2001 From: zhangqian <zhangqian@123.com> Date: 星期三, 01 十一月 2023 19:20:21 +0800 Subject: [PATCH] 公海member_id使用0 --- model/serviceFeeManage.go | 27 +++++++++++++++++++-------- 1 files changed, 19 insertions(+), 8 deletions(-) diff --git a/model/serviceFeeManage.go b/model/serviceFeeManage.go index 4ef85e8..f54d3e7 100644 --- a/model/serviceFeeManage.go +++ b/model/serviceFeeManage.go @@ -9,13 +9,13 @@ type ( ServiceFeeManage struct { - Id int `json:"id" gorm:"column:id;primaryKey;autoIncrement;not null"` - ClientId int `json:"client_id" gorm:"column:client_id;type:int(11);comment:瀹㈡埛ID"` - Client *Client `json:"client" gorm:"foreignKey:ClientId"` - MemberId int `json:"member_id" gorm:"column:member_id;type:int(11);comment:鍛樺伐ID"` - LatestDate *time.Time `json:"latest_date" gorm:"column:latest_date;type:datetime;comment:鏈�鏅氭湇鍔℃椂闂�"` - Remark string `json:"remark" gorm:"column:remark;type:varchar(255);comment:澶囨敞"` - File string `json:"file" gorm:"column:file;type:varchar(255);comment:鏂囦欢"` + Id int `json:"id" gorm:"column:id;primaryKey;autoIncrement;not null"` + ClientId int `json:"client_id" gorm:"column:client_id;type:int(11);comment:瀹㈡埛ID"` + Client *Client `json:"client" gorm:"foreignKey:ClientId"` + MemberId int `json:"member_id" gorm:"column:member_id;type:int(11);comment:鍛樺伐ID"` + LatestDate *CustomTime `json:"latest_date" gorm:"column:latest_date;type:datetime;comment:鏈�鏅氭湇鍔℃椂闂�"` + Remark string `json:"remark" gorm:"column:remark;type:varchar(255);comment:澶囨敞"` + File string `json:"file" gorm:"column:file;type:varchar(255);comment:鏂囦欢"` gorm.Model `json:"-"` } @@ -28,6 +28,7 @@ OrderBy string PageNum int PageSize int + MemberIds []int } ) @@ -53,6 +54,11 @@ if slf.ClientId != 0 { db.Where("client_id = ?", slf.ClientId) } + + if len(slf.MemberIds) > 0 { + db.Where("service_fee_manage.member_id in ?", slf.MemberIds) + } + switch slf.QueryClass { case constvar.ServiceFeeQueryClassExpireLessThen60Days: db = db.Where("latest_date > ? and latest_date < ?", time.Now(), time.Now().AddDate(0, 0, 60)) @@ -120,6 +126,11 @@ return slf } +func (slf *ServiceFeeManageSearch) SetMemberIds(ids []int) *ServiceFeeManageSearch { + slf.MemberIds = ids + return slf +} + func (slf *ServiceFeeManageSearch) SetKeywordType(keyword constvar.ServiceFeeKeywordType) *ServiceFeeManageSearch { slf.KeywordType = keyword return slf @@ -157,7 +168,7 @@ db = db.Limit(slf.PageSize).Offset((slf.PageNum - 1) * slf.PageSize) } - err := db.Preload("Client").Find(&records).Error + err := db.Preload("Client").Order("id desc").Find(&records).Error return records, total, err } -- Gitblit v1.8.0