From b69b2f375522f1a9cdf377345b1c041bc240b9cd Mon Sep 17 00:00:00 2001 From: Yutousama <583819556@qq.com> Date: Mon, 30 Mar 2020 17:36:59 +0800 Subject: [PATCH] =?UTF-8?q?=E6=88=98=E6=96=97=E6=95=B0=E6=8D=AE=E8=BF=9BRe?= =?UTF-8?q?dis=E7=BC=93=E5=AD=98=20=E4=BB=85=E4=BF=9D=E5=AD=98=E6=9C=80?= =?UTF-8?q?=E6=96=B0=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../yutou/jianrdb/Mapper/MapNodeService.java | 23 +++++++++++++++++-- 1 file changed, 21 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/yutou/jianrdb/Mapper/MapNodeService.java b/src/main/java/com/yutou/jianrdb/Mapper/MapNodeService.java index 09491a3..d14c7d2 100644 --- a/src/main/java/com/yutou/jianrdb/Mapper/MapNodeService.java +++ b/src/main/java/com/yutou/jianrdb/Mapper/MapNodeService.java @@ -1,10 +1,12 @@ package com.yutou.jianrdb.Mapper; +import com.alibaba.fastjson.JSONArray; import com.yutou.jianrdb.Bean.GameInfoLog; import com.yutou.jianrdb.Bean.MapNode; import com.yutou.jianrdb.Dao.MapNodeDao; import com.yutou.maptop.Bean.UserTeam; import com.yutou.mybatis.ZsShipType; +import com.yutou.utlis.RedisUtlis; import org.springframework.stereotype.Service; import javax.annotation.Resource; @@ -30,9 +32,26 @@ public class MapNodeService { public List selectMapByNode(String chapterName, String levelName) { return dao.selectMapByNode(chapterName, levelName); } - public List selectNodeByMid(int nodeId, int limit, int count) { - return dao.selectNodeByMid("%"+nodeId+"%", limit, count); + String tmp=RedisUtlis.get(nodeId+""); + List list; + + if(tmp==null){ + list=dao.selectNodeByMid("%"+nodeId+"%", limit, count); + tmp=JSONArray.toJSONString(list); + RedisUtlis.set(nodeId+"",tmp); + }else{ + list= JSONArray.parseArray(tmp,GameInfoLog.class); + new Thread(new Runnable() { + @Override + public void run() { + List tmpList=dao.selectNodeByMid("%"+nodeId+"%", limit, count); + String tmp=JSONArray.toJSONString(tmpList); + RedisUtlis.set(nodeId+"",tmp); + } + }).start(); + } + return list; } public List selectAllShipType(){