lj-wsdj 2024-08-22 16:16:39 +08:00
parent d8653ccf8f
commit 6a5a48f8ed
2 changed files with 5 additions and 1 deletions

View File

@ -10,6 +10,9 @@ import (
func (s *SqlBuilder[T]) buildSql() string { func (s *SqlBuilder[T]) buildSql() string {
s.DeletePlaceholderSymbol() s.DeletePlaceholderSymbol()
if s.Driver == util.DriverOracle {
s.Sql = fmt.Sprintf("select t.*,rownum rn from (%s) t", s.Sql)
}
return s.Sql return s.Sql
} }

View File

@ -65,7 +65,8 @@ func TestOracle(t *testing.T) {
sqlb.InsertConditions("@c1", "area_dn like ?", "level1=1,level2=85226,level3=86918,level4=86919,level5=86986%") sqlb.InsertConditions("@c1", "area_dn like ?", "level1=1,level2=85226,level3=86918,level4=86919,level5=86986%")
sqlb.InsertConditions("@c2", "autoseq in (?)", ids) sqlb.InsertConditions("@c2", "autoseq in (?)", ids)
page := Page{PageIndex: 1, PageSize: 10} page := Page{PageIndex: 1, PageSize: 10}
err = sqlb.PaginateBySql(&data, &page) err = sqlb.FindBySql(&data)
fmt.Println(data)
page.Data = &data page.Data = &data
fmt.Println(err, page) fmt.Println(err, page)
} }