// 需要自定义redis序列化,防止序列化异常。 String countyTree = (String) redisUtil.get("countyTree"); if (StrUtil.isBlank(countyTree)) { LambdaQueryWrapper<DictArea> wrapper = new LambdaQueryWrapper<>(); wrapper.eq(DictArea::getParentId, "-1").ne(DictArea::getId, "3206"); List<DictArea> dictAreas = dictAreaMapper.selectList(wrapper); List<CountyVo> countyList = new ArrayList<>(); recursion(dictAreas, countyList); // 放入redis缓存中 redisUtil.set("countyTree", JSONObject.toJSON(countyList).toString()); return countyList; } return JSONObject.parseArray(countyTree, CountyVo.class);
redis放入list对象
最新推荐文章于 2024-07-06 03:26:14 发布