|
@@ -2,7 +2,6 @@ package rest_gorm
|
|
|
|
|
|
import (
|
|
import (
|
|
"fmt"
|
|
"fmt"
|
|
- "log"
|
|
|
|
|
|
|
|
"git.ali33.ru/fcg-xvii/rest"
|
|
"git.ali33.ru/fcg-xvii/rest"
|
|
"gorm.io/gorm"
|
|
"gorm.io/gorm"
|
|
@@ -37,8 +36,7 @@ func (s *List) Result(pg *gorm.DB, fields rest.FieldNamesList, res any) (count i
|
|
err = rest.ErrorFiled(cond.Field, "Unexpected field")
|
|
err = rest.ErrorFiled(cond.Field, "Unexpected field")
|
|
return
|
|
return
|
|
}
|
|
}
|
|
- log.Println("CV", cond.Value)
|
|
|
|
- if cond.Value == nil {
|
|
|
|
|
|
+ if cond.Value != nil {
|
|
q := fmt.Sprintf("%s %s ?", CamelToSnake(cond.Field), cond.Operator)
|
|
q := fmt.Sprintf("%s %s ?", CamelToSnake(cond.Field), cond.Operator)
|
|
if i == 0 || cond.Logic == rest.LogicAND {
|
|
if i == 0 || cond.Logic == rest.LogicAND {
|
|
pg = pg.Where(q, cond.Value)
|
|
pg = pg.Where(q, cond.Value)
|