| | |
| | | package com.ruoyi.system.service.impl; |
| | | |
| | | import com.alibaba.fastjson2.JSON; |
| | | import com.alibaba.fastjson2.TypeReference; |
| | | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; |
| | | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; |
| | | import com.ruoyi.common.constant.CacheConstants; |
| | |
| | | SysOperateTypeWholeNameBO nameBO = this.operateTypeWholeNameCacheById(sysOperateType.getId()); |
| | | map.put(sysOperateType.getId(),nameBO); |
| | | } |
| | | SpringUtils.getBean(RedisCache.class).setCacheObject(CacheConstants.SYS_OPERATE_TYPE_NAME_KEY, map); |
| | | String info = JSON.toJSONString(map); |
| | | SpringUtils.getBean(RedisCache.class).setCacheObject(CacheConstants.SYS_OPERATE_TYPE_NAME_KEY, info); |
| | | } |
| | | } |
| | | |
| | |
| | | |
| | | @Override |
| | | public SysOperateTypeWholeNameBO getOperateTypeWholeNameById(Long id) { |
| | | Map<Long, SysOperateTypeWholeNameBO> map = redisCache.getCacheObject(CacheConstants.SYS_OPERATE_TYPE_NAME_KEY); |
| | | String info = redisCache.getCacheObject(CacheConstants.SYS_OPERATE_TYPE_NAME_KEY); |
| | | Map<Long, SysOperateTypeWholeNameBO> map = JSON.parseObject(info, new TypeReference<Map<Long, SysOperateTypeWholeNameBO>>() {}); |
| | | if (map != null){ |
| | | return map.get(id); |
| | | } |