完善
This commit is contained in:
parent
244fd5d60d
commit
865e2e5725
|
@ -4,8 +4,10 @@ import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github/fthvgb1/wp-go/db"
|
"github/fthvgb1/wp-go/db"
|
||||||
"github/fthvgb1/wp-go/helper"
|
"github/fthvgb1/wp-go/helper"
|
||||||
|
"math/rand"
|
||||||
"strconv"
|
"strconv"
|
||||||
"strings"
|
"strings"
|
||||||
|
"time"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Model interface {
|
type Model interface {
|
||||||
|
@ -141,8 +143,9 @@ func SimplePagination[T Model](where ParseWhere, fields, group string, page, pag
|
||||||
sq := fmt.Sprintf(tpx, rr.Table(), j, w)
|
sq := fmt.Sprintf(tpx, rr.Table(), j, w)
|
||||||
err = db.Db.Get(&n, sq, args...)
|
err = db.Db.Get(&n, sq, args...)
|
||||||
} else {
|
} else {
|
||||||
tpx := "select count(*) n from (select %s from %s %s %s %s ) tx"
|
tpx := "select count(*) n from (select %s from %s %s %s %s ) %s"
|
||||||
sq := fmt.Sprintf(tpx, group, rr.Table(), j, w, groupBy)
|
rand.Seed(int64(time.Now().Nanosecond()))
|
||||||
|
sq := fmt.Sprintf(tpx, group, rr.Table(), j, w, groupBy, fmt.Sprintf("table%d", rand.Int()))
|
||||||
err = db.Db.Get(&n, sq, args...)
|
err = db.Db.Get(&n, sq, args...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user