|
@@ -56,6 +56,47 @@ public class TGuijiZennerGasPurchaseCenterInforServiceImpl implements ITGuijiZen
|
|
|
*/
|
|
|
public Long getTotal(String tableName, String paramStr)
|
|
|
{
|
|
|
+// Long total = Convert.toLong(CacheUtils.get("guiji-data-count", tableName + "," + paramStr));//cacheName, cacheKey
|
|
|
+ String cacheName = tableName + "," + paramStr;
|
|
|
+ Long total = mapper.getCache(cacheName);
|
|
|
+ if(total == null){
|
|
|
+ String msg = "21:17:55.281 [http-nio-8080-exec-27] INFO o.a.s.c.e.EhCacheManager - [getCache,158] - Cache with name 'guiji-data-count' does not yet exist. Creating now.";
|
|
|
+ Map map = new HashMap();
|
|
|
+ map.put("tableName", tableName);
|
|
|
+ total = mapper.getDataCount(map);
|
|
|
+ map.put("cacheName", cacheName);
|
|
|
+ map.put("total", total);
|
|
|
+ mapper.createCache(map);
|
|
|
+ System.out.println("分页功能 缓存创建成功:" + tableName);
|
|
|
+ }else {
|
|
|
+// total = Long.valueOf(cache.get("total").toString());
|
|
|
+ System.out.println("分页功能 根据缓存名称获取缓存:" + tableName);
|
|
|
+ new Thread() {
|
|
|
+ public void run() {
|
|
|
+ try{
|
|
|
+ Map map = new HashMap();
|
|
|
+ map.put("tableName", tableName);
|
|
|
+ Long total = mapper.getDataCount(map);
|
|
|
+ map.put("cacheName", cacheName);
|
|
|
+ map.put("total", total);
|
|
|
+ mapper.refreshCache(map);
|
|
|
+ System.out.println("分页功能 缓存刷新成功:" + tableName);
|
|
|
+ }catch (Exception e){
|
|
|
+ e.printStackTrace();
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }.start();
|
|
|
+ }
|
|
|
+ return total;
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取cache name
|
|
|
+ *
|
|
|
+ * @return 缓存名
|
|
|
+ */
|
|
|
+ public Long getTotal_abandon(String tableName, String paramStr)
|
|
|
+ {
|
|
|
Long total = Convert.toLong(CacheUtils.get("guiji-data-count", tableName + "," + paramStr));//cacheName, cacheKey
|
|
|
if(total == null){
|
|
|
Map map = new HashMap();
|