|
@ -64,7 +64,9 @@ func (this *Query) Where(where string) *Query { |
|
|
return this |
|
|
return this |
|
|
} |
|
|
} |
|
|
func (this *Query) Wheres(wheres []string) *Query { |
|
|
func (this *Query) Wheres(wheres []string) *Query { |
|
|
this.where = append(this.where, wheres...) |
|
|
|
|
|
|
|
|
if len(wheres) > 0 { |
|
|
|
|
|
this.where = append(this.where, wheres...) |
|
|
|
|
|
} |
|
|
return this |
|
|
return this |
|
|
} |
|
|
} |
|
|
func (this *Query) WhereOr(where string) *Query { |
|
|
func (this *Query) WhereOr(where string) *Query { |
|
@ -158,13 +160,13 @@ func (this *Query) QueryStmt() error { |
|
|
|
|
|
|
|
|
if this.page > 0 || this.page_size > 0 { |
|
|
if this.page > 0 || this.page_size > 0 { |
|
|
|
|
|
|
|
|
if this.page < 0 { |
|
|
|
|
|
this.page = 0 |
|
|
|
|
|
|
|
|
if this.page < 1 { |
|
|
|
|
|
this.page = 1 |
|
|
} |
|
|
} |
|
|
if this.page_size < 1 { |
|
|
if this.page_size < 1 { |
|
|
this.page_size = 10 |
|
|
this.page_size = 10 |
|
|
} |
|
|
} |
|
|
from := strconv.Itoa(this.page * this.page_size) |
|
|
|
|
|
|
|
|
from := strconv.Itoa((this.page - 1) * this.page_size) |
|
|
offset := strconv.Itoa(this.page_size) |
|
|
offset := strconv.Itoa(this.page_size) |
|
|
if from != "" && offset != "" { |
|
|
if from != "" && offset != "" { |
|
|
sql = helper.StringJoin(sql, " limit ", from, " , ", offset) |
|
|
sql = helper.StringJoin(sql, " limit ", from, " , ", offset) |
|
|