一、该问题的重现步骤是什么?
1. 有个列表的查询,需要用到字典数据,根据字典值取出它对应的名字,
2. 我按项目中Notice,通知公告的Notice'Wapper部分代码写了,但是取不到数据
3.我断点跟踪了一下,发现确实是取不出值,然后看到控制台打印的sql,从缓存中取不到话,是从系统字典表(blade_dict)取的数据,并没有查询业务字典表里的数据
//通知公告的代码
@Override
public NoticeVO entityVO(Notice notice) {
NoticeVO noticeVO = Objects.requireNonNull(BeanUtil.copy(notice, NoticeVO.class));
String dictValue = DictCache.getValue("notice", noticeVO.getCategory());
noticeVO.setCategoryName(dictValue);
return noticeVO;
}
//我写的代码
@Override
public StatisticsBatchInfoVO entityVO(StatisticsBatchInfo statisticsBatchInfo) {
StatisticsBatchInfoVO statisticsBatchInfoVO = Objects.requireNonNull(BeanUtil.copy(statisticsBatchInfo, StatisticsBatchInfoVO.class));
String dictValue = DictCache.getValue("commission_type", statisticsBatchInfoVO.getType());
statisticsBatchInfoVO.setName(dictValue);
return statisticsBatchInfoVO;
}
//部分sql。
2020-05-15 12:25:21.103 DEBUG 9548 --- [ XNIO-1 task-53] o.s.m.system.mapper.DictMapper.getValue : <== Total: 0
2020-05-15 12:25:21.105 DEBUG 9548 --- [ XNIO-1 task-53] o.s.m.system.mapper.DictMapper.getValue : ==> Preparing: select dict_value from blade_dict where code = ? and dict_key = ? and is_deleted = 0
2020-05-15 12:25:21.105 DEBUG 9548 --- [ XNIO-1 task-53] o.s.core.tenant.BladeTenantSqlParser : Original SQL: select
dict_value
from blade_dict where code = ? and dict_key = ? and is_deleted = 0
2020-05-15 12:25:21.106 DEBUG 9548 --- [ XNIO-1 task-53] o.s.core.tenant.BladeTenantSqlParser : parser sql: SELECT dict_value FROM blade_dict WHERE code = ? AND dict_key = ? AND is_deleted = 0
2020-05-15 12:25:21.106 DEBUG 9548 --- [ XNIO-1 task-53] o.s.m.system.mapper.DictMapper.getValue : ==> Preparing: SELECT dict_value FROM blade_dict WHERE code = ? AND dict_key = ? AND is_deleted = 0
2020-05-15 12:25:21.110 DEBUG 9548 --- [ XNIO-1 task-53] o.s.m.system.mapper.DictMapper.getValue : ==> Parameters: commission_type(String), 3(String)
二、你期待的结果是什么?实际看到的又是什么?
业务字典能从缓存中取出。。。
三、你正在使用的是什么产品,什么版本?在什么操作系统上?
Bladex-boot 2.4, win10
扫一扫访问 Blade技术社区 移动端