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(){