///////////////////////////////////////////////////////////
// THIS FILE IS AUTO GENERATED by gormgen, DON'T EDIT IT //
//        ANY CHANGES DONE HERE WILL BE LOST             //
///////////////////////////////////////////////////////////

package ums_member_statistics_info

import (
	"fmt"
	"time"

	"github.com/pkg/errors"
	"gorm.io/gorm"

	"github.com/ChangSZ/mall-go/internal/repository/mysql"
)

func NewModel() *UmsMemberStatisticsInfo {
	return new(UmsMemberStatisticsInfo)
}

func NewQueryBuilder() *umsMemberStatisticsInfoQueryBuilder {
	return new(umsMemberStatisticsInfoQueryBuilder)
}

func (t *UmsMemberStatisticsInfo) Create(db *gorm.DB) (id int64, err error) {
	if err = db.Create(t).Error; err != nil {
		return 0, errors.Wrap(err, "create err")
	}
	return t.Id, nil
}

type umsMemberStatisticsInfoQueryBuilder struct {
	order []string
	where []struct {
		prefix string
		value  interface{}
	}
	limit  int
	offset int
}

func (qb *umsMemberStatisticsInfoQueryBuilder) buildQuery(db *gorm.DB) *gorm.DB {
	ret := db
	for _, where := range qb.where {
		ret = ret.Where(where.prefix, where.value)
	}
	for _, order := range qb.order {
		ret = ret.Order(order)
	}
	if qb.limit != 0 {
		ret = ret.Limit(qb.limit)
	}
	ret = ret.Offset(qb.offset)
	return ret
}

func (qb *umsMemberStatisticsInfoQueryBuilder) Updates(db *gorm.DB, m map[string]interface{}) (int64, error) {
	db = db.Model(&UmsMemberStatisticsInfo{})

	for _, where := range qb.where {
		db.Where(where.prefix, where.value)
	}

	ret := db.Updates(m)
	err := ret.Error
	if err != nil {
		return 0, errors.Wrap(err, "updates err")
	}
	return ret.RowsAffected, nil
}

func (qb *umsMemberStatisticsInfoQueryBuilder) Delete(db *gorm.DB) (int64, error) {
	for _, where := range qb.where {
		db = db.Where(where.prefix, where.value)
	}

	ret := db.Delete(&UmsMemberStatisticsInfo{})
	err := ret.Error
	if err != nil {
		return 0, errors.Wrap(err, "delete err")
	}
	return ret.RowsAffected, nil
}

func (qb *umsMemberStatisticsInfoQueryBuilder) Count(db *gorm.DB) (int64, error) {
	var c int64
	res := qb.buildQuery(db).Model(&UmsMemberStatisticsInfo{}).Count(&c)
	if res.Error != nil && res.Error == gorm.ErrRecordNotFound {
		return 0, nil
	}
	return c, res.Error
}

func (qb *umsMemberStatisticsInfoQueryBuilder) First(db *gorm.DB) (*UmsMemberStatisticsInfo, error) {
	ret := &UmsMemberStatisticsInfo{}
	res := qb.buildQuery(db).First(ret)
	if res.Error != nil && res.Error == gorm.ErrRecordNotFound {
		return nil, nil
	}
	return ret, res.Error
}

func (qb *umsMemberStatisticsInfoQueryBuilder) QueryOne(db *gorm.DB) (*UmsMemberStatisticsInfo, error) {
	qb.limit = 1
	ret, err := qb.QueryAll(db)
	if len(ret) > 0 {
		return ret[0], err
	}
	return nil, err
}

func (qb *umsMemberStatisticsInfoQueryBuilder) QueryAll(db *gorm.DB) ([]*UmsMemberStatisticsInfo, error) {
	var ret []*UmsMemberStatisticsInfo
	err := qb.buildQuery(db).Find(&ret).Error
	return ret, err
}

func (qb *umsMemberStatisticsInfoQueryBuilder) Limit(limit int) *umsMemberStatisticsInfoQueryBuilder {
	qb.limit = limit
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) Offset(offset int) *umsMemberStatisticsInfoQueryBuilder {
	qb.offset = offset
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereId(p mysql.Predicate, value int64) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "id", p),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereIdIn(value []int64) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "id", "IN"),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereIdNotIn(value []int64) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "id", "NOT IN"),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) OrderById(asc bool) *umsMemberStatisticsInfoQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "id "+order)
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereMemberId(p mysql.Predicate, value int64) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "member_id", p),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereMemberIdIn(value []int64) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "member_id", "IN"),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereMemberIdNotIn(value []int64) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "member_id", "NOT IN"),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) OrderByMemberId(asc bool) *umsMemberStatisticsInfoQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "member_id "+order)
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereConsumeAmount(p mysql.Predicate, value float64) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "consume_amount", p),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereConsumeAmountIn(value []float64) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "consume_amount", "IN"),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereConsumeAmountNotIn(value []float64) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "consume_amount", "NOT IN"),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) OrderByConsumeAmount(asc bool) *umsMemberStatisticsInfoQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "consume_amount "+order)
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereOrderCount(p mysql.Predicate, value int32) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "order_count", p),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereOrderCountIn(value []int32) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "order_count", "IN"),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereOrderCountNotIn(value []int32) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "order_count", "NOT IN"),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) OrderByOrderCount(asc bool) *umsMemberStatisticsInfoQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "order_count "+order)
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereCouponCount(p mysql.Predicate, value int32) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "coupon_count", p),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereCouponCountIn(value []int32) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "coupon_count", "IN"),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereCouponCountNotIn(value []int32) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "coupon_count", "NOT IN"),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) OrderByCouponCount(asc bool) *umsMemberStatisticsInfoQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "coupon_count "+order)
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereCommentCount(p mysql.Predicate, value int32) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "comment_count", p),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereCommentCountIn(value []int32) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "comment_count", "IN"),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereCommentCountNotIn(value []int32) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "comment_count", "NOT IN"),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) OrderByCommentCount(asc bool) *umsMemberStatisticsInfoQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "comment_count "+order)
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereReturnOrderCount(p mysql.Predicate, value int32) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "return_order_count", p),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereReturnOrderCountIn(value []int32) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "return_order_count", "IN"),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereReturnOrderCountNotIn(value []int32) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "return_order_count", "NOT IN"),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) OrderByReturnOrderCount(asc bool) *umsMemberStatisticsInfoQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "return_order_count "+order)
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereLoginCount(p mysql.Predicate, value int32) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "login_count", p),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereLoginCountIn(value []int32) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "login_count", "IN"),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereLoginCountNotIn(value []int32) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "login_count", "NOT IN"),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) OrderByLoginCount(asc bool) *umsMemberStatisticsInfoQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "login_count "+order)
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereAttendCount(p mysql.Predicate, value int32) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "attend_count", p),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereAttendCountIn(value []int32) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "attend_count", "IN"),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereAttendCountNotIn(value []int32) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "attend_count", "NOT IN"),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) OrderByAttendCount(asc bool) *umsMemberStatisticsInfoQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "attend_count "+order)
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereFansCount(p mysql.Predicate, value int32) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "fans_count", p),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereFansCountIn(value []int32) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "fans_count", "IN"),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereFansCountNotIn(value []int32) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "fans_count", "NOT IN"),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) OrderByFansCount(asc bool) *umsMemberStatisticsInfoQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "fans_count "+order)
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereCollectProductCount(p mysql.Predicate, value int32) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "collect_product_count", p),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereCollectProductCountIn(value []int32) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "collect_product_count", "IN"),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereCollectProductCountNotIn(value []int32) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "collect_product_count", "NOT IN"),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) OrderByCollectProductCount(asc bool) *umsMemberStatisticsInfoQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "collect_product_count "+order)
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereCollectSubjectCount(p mysql.Predicate, value int32) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "collect_subject_count", p),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereCollectSubjectCountIn(value []int32) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "collect_subject_count", "IN"),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereCollectSubjectCountNotIn(value []int32) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "collect_subject_count", "NOT IN"),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) OrderByCollectSubjectCount(asc bool) *umsMemberStatisticsInfoQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "collect_subject_count "+order)
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereCollectTopicCount(p mysql.Predicate, value int32) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "collect_topic_count", p),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereCollectTopicCountIn(value []int32) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "collect_topic_count", "IN"),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereCollectTopicCountNotIn(value []int32) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "collect_topic_count", "NOT IN"),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) OrderByCollectTopicCount(asc bool) *umsMemberStatisticsInfoQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "collect_topic_count "+order)
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereCollectCommentCount(p mysql.Predicate, value int32) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "collect_comment_count", p),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereCollectCommentCountIn(value []int32) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "collect_comment_count", "IN"),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereCollectCommentCountNotIn(value []int32) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "collect_comment_count", "NOT IN"),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) OrderByCollectCommentCount(asc bool) *umsMemberStatisticsInfoQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "collect_comment_count "+order)
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereInviteFriendCount(p mysql.Predicate, value int32) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "invite_friend_count", p),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereInviteFriendCountIn(value []int32) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "invite_friend_count", "IN"),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereInviteFriendCountNotIn(value []int32) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "invite_friend_count", "NOT IN"),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) OrderByInviteFriendCount(asc bool) *umsMemberStatisticsInfoQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "invite_friend_count "+order)
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereRecentOrderTime(p mysql.Predicate, value time.Time) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "recent_order_time", p),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereRecentOrderTimeIn(value []time.Time) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "recent_order_time", "IN"),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) WhereRecentOrderTimeNotIn(value []time.Time) *umsMemberStatisticsInfoQueryBuilder {
	qb.where = append(qb.where, struct {
		prefix string
		value  interface{}
	}{
		fmt.Sprintf("%v %v ?", "recent_order_time", "NOT IN"),
		value,
	})
	return qb
}

func (qb *umsMemberStatisticsInfoQueryBuilder) OrderByRecentOrderTime(asc bool) *umsMemberStatisticsInfoQueryBuilder {
	order := "DESC"
	if asc {
		order = "ASC"
	}

	qb.order = append(qb.order, "recent_order_time "+order)
	return qb
}
