接入搜索功能

This commit is contained in:
2021-06-13 09:53:37 +08:00
parent 8b6dd5fdad
commit 9e595ab6e8
3 changed files with 122 additions and 30 deletions
+5 -4
View File
@@ -85,10 +85,10 @@ var {{table}}Ctr = Ctr{
"search": func(that *Context) {
columnStr, where := that.MakeCode.Search(that.RouterString[1], that.Req)
columnStr,leftJoin,where := that.MakeCode.Search(that.RouterString[1], that.Req,that.Db)
page:=ObjToInt(that.Req.FormValue("page"))
pageSize:=ObjToInt(that.Req.FormValue("pageSize"))
if page<1{
page=1
}
@@ -96,9 +96,10 @@ var {{table}}Ctr = Ctr{
if pageSize<=0{
pageSize=20
}
count:=that.Db.Count(that.RouterString[1], where)
count:=that.Db.Count(that.RouterString[1],leftJoin,where)
reData := that.Db.Page(page, pageSize).
PageSelect(that.RouterString[1], columnStr, where)
PageSelect(that.RouterString[1],leftJoin,columnStr, where)
for _, v := range reData {