diff --git a/builder2.go b/builder2.go index ba1d3cc..b51a596 100644 --- a/builder2.go +++ b/builder2.go @@ -255,19 +255,26 @@ func toWhereSql(where interface{}) (string, error) { whereSql = strings.Join(ws, fmt.Sprintf(" %s ", operator)) } } else { - for _, w := range expression { - if w.Type == gjson.String { - ws = append(ws, w.String()) - } else { - newExp, err := toWhereSql(w.Value()) - if err != nil { - return "", err - } - ws = append(ws, newExp) - } - whereSql = strings.Join(ws, " ") + // ["and",["a","=","1"],"or",["b",">","2"]] + //三段式 + if len(expression) == 3 { + ws = append(ws, expression[0].String(), expression[1].String(), expression[2].Raw) } + + // for _, w := range expression { + // if w.Type == gjson.String { + // ws = append(ws, w.String()) + // } else { + // newExp, err := toWhereSql(w.Value()) + // if err != nil { + // return "", err + // } + // ws = append(ws, newExp) + // } + + whereSql = strings.Join(ws, " ") + // } } } else if whereGjson.IsObject() { newValue := []interface{}{