|
@@ -367,7 +367,24 @@ func (m *Mysql) Count(tableName string, query map[string]interface{}) int64 {
|
|
|
fields := []string{}
|
|
|
values := []interface{}{}
|
|
|
for k, v := range query {
|
|
|
- if v == "$isNull" {
|
|
|
+ rt := reflect.TypeOf(v)
|
|
|
+ rv := reflect.ValueOf(v)
|
|
|
+ if rt.Kind() == reflect.Map {
|
|
|
+ for _, rv_k := range rv.MapKeys() {
|
|
|
+ if rv_k.String() == "ne" {
|
|
|
+ fields = append(fields, fmt.Sprintf("%s!=?", k))
|
|
|
+ values = append(values, rv.MapIndex(rv_k).Interface())
|
|
|
+ }
|
|
|
+ if rv_k.String() == "notin" {
|
|
|
+ if len(rv.MapIndex(rv_k).Interface().([]interface{})) > 0 {
|
|
|
+ for _, v := range rv.MapIndex(rv_k).Interface().([]interface{}) {
|
|
|
+ fields = append(fields, fmt.Sprintf("%s!=?", k))
|
|
|
+ values = append(values, v)
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ } else if v == "$isNull" {
|
|
|
fields = append(fields, fmt.Sprintf("%s is null", k))
|
|
|
} else if v == "$isNotNull" {
|
|
|
fields = append(fields, fmt.Sprintf("%s is not null", k))
|