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