From 029eaf0992ee50a14bd6565d35bda57e811e2dc8 Mon Sep 17 00:00:00 2001 From: wangshuai Date: Tue, 1 Sep 2020 09:56:04 +0800 Subject: [PATCH] 'commit' --- dsSupport/Utils/CacheUtil/DaoCache.go | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/dsSupport/Utils/CacheUtil/DaoCache.go b/dsSupport/Utils/CacheUtil/DaoCache.go index 982608f7..febece66 100644 --- a/dsSupport/Utils/CacheUtil/DaoCache.go +++ b/dsSupport/Utils/CacheUtil/DaoCache.go @@ -7,6 +7,7 @@ import ( "dsSupport/Utils/LogUtil" "dsSupport/Utils/RedisUtil" "fmt" + "github.com/go-redis/redis" "github.com/go-redis/redis/v7" "reflect" "regexp" @@ -144,9 +145,9 @@ func batchReadRedis(ids []string, prefix string) ([]map[string]interface{}, []st */ func count(baseSql string, pkField string, args []interface{}) (int32, error) { //替换掉分页代码,获取数据量总数 - reg := regexp.MustCompile(`SELECT ` + pkField + ` `) - //countSql := strings.Replace(baseSql, "SELECT "+pkField+" ", "SELECT count(*) as count ", -1) - countSql := reg.ReplaceAllString(baseSql, "SELECT count(*) as count ") + //reg := regexp.MustCompile(`SELECT ` + pkField + ` `) + countSql := strings.Replace(baseSql, "SELECT "+pkField+" ", "SELECT count(*) as count ", -1) + //countSql := reg.ReplaceAllString(baseSql, "SELECT count(*) as count ") fmt.Println("countSql==", countSql) var count int32 //去掉最后的limit+offset