|
|
@@ -157,3 +157,22 @@ func (u UserDb) UserCount() (int64, error) { |
|
|
|
} |
|
|
|
return count, nil |
|
|
|
} |
|
|
|
|
|
|
|
func (u UserDb) UserFindNotInByParamsByPage(page int, limit int, params map[string]interface{}) ([]model.User, int64, error) { |
|
|
|
var m []model.User |
|
|
|
var total int64 |
|
|
|
var err error |
|
|
|
if reflect.TypeOf(params["value"]).Kind() == reflect.Slice { |
|
|
|
//指定In查询 |
|
|
|
if total, err = u.Db.NotIn(zhios_order_relate_utils.AnyToString(params["key"]), params["value"]).Limit(limit, (page-1)*limit).FindAndCount(&m); err != nil { |
|
|
|
return nil, 0, zhios_order_relate_logx.Warn(err) |
|
|
|
} |
|
|
|
} else { |
|
|
|
var query = fmt.Sprintf("%s != ?", params["key"]) |
|
|
|
total, err = u.Db.Where(query, params["value"]).Limit(limit, (page-1)*limit).FindAndCount(&m) |
|
|
|
if err != nil { |
|
|
|
return nil, 0, zhios_order_relate_logx.Error(err) |
|
|
|
} |
|
|
|
} |
|
|
|
return m, total, nil |
|
|
|
} |