OCT 1. 修正字典加载问题

This commit is contained in:
黄昕 2024-02-07 10:33:11 +08:00
parent 0ff040bb7a
commit 96a914a380
2 changed files with 14 additions and 17 deletions

View File

@ -1,5 +1,6 @@
package com.cmhi.cf.configure; package com.cmhi.cf.configure;
import com.cmhi.cf.common.CommonStatus;
import com.cmhi.cf.database.common.mapper.DictTypeMapper; import com.cmhi.cf.database.common.mapper.DictTypeMapper;
import com.houkunlin.system.dict.starter.bean.DictTypeVo; import com.houkunlin.system.dict.starter.bean.DictTypeVo;
import com.houkunlin.system.dict.starter.provider.DictProvider; import com.houkunlin.system.dict.starter.provider.DictProvider;
@ -27,7 +28,7 @@ public class DictProviderConfigure implements DictProvider {
dictTypeMapper.selectAllWithRelations().forEach(k -> { dictTypeMapper.selectAllWithRelations().forEach(k -> {
DictTypeVo.DictTypeBuilder builder = DictTypeVo.newBuilder(k.getDictType(), k.getDictName(), k.getRemark()); DictTypeVo.DictTypeBuilder builder = DictTypeVo.newBuilder(k.getDictType(), k.getDictName(), k.getRemark());
k.getDictDataList() k.getDictDataList()
.stream().filter(m -> "0".equals(m.getStatus())) .stream().filter(m -> m.getStatus().equals(CommonStatus.NORMAL.getValue()))
.forEach(v -> builder.add(v.getDictValue(), v.getDictLabel(), v.getDictSort())); .forEach(v -> builder.add(v.getDictValue(), v.getDictLabel(), v.getDictSort()));
dictItems.add(builder.build()); dictItems.add(builder.build());
}); });

View File

@ -53,13 +53,11 @@ public class DictionaryServiceImpl implements DictionaryService {
SystemDictStarter.getBean(SystemDictProvider.class).dictTypeIterator().forEachRemaining(k -> { SystemDictStarter.getBean(SystemDictProvider.class).dictTypeIterator().forEachRemaining(k -> {
if (dictType.contains(k.getType())) { if (dictType.contains(k.getType())) {
List<DictDetails> children = new ArrayList<>(); List<DictDetails> children = new ArrayList<>();
k.getChildren().forEach(m -> { k.getChildren().forEach(m -> children.add(DictDetails.builder()
children.add(DictDetails.builder() .title(m.getTitle())
.title(m.getTitle()) .value((Integer) m.getValue())
.value((Integer) m.getValue()) .disabled(false)
.disabled(false) .build()));
.build());
});
sysDictList.add(DictContent.builder() sysDictList.add(DictContent.builder()
.dictName(k.getType()) .dictName(k.getType())
.children(children) .children(children)
@ -174,15 +172,13 @@ public class DictionaryServiceImpl implements DictionaryService {
ret.forEach(k -> { ret.forEach(k -> {
List<DictDetails> children = new ArrayList<>(); List<DictDetails> children = new ArrayList<>();
k.getDictDataList().forEach(m -> { k.getDictDataList().forEach(m -> children.add(DictDetails.builder()
children.add(DictDetails.builder() .id(m.getId())
.id(m.getId()) .title(m.getDictLabel())
.title(m.getDictLabel()) .value(m.getDictValue())
.value(m.getDictValue()) .sorted(m.getDictSort())
.sorted(m.getDictSort()) .disabled(m.getStatus() != 0)
.disabled(m.getStatus() != 0) .build()));
.build());
});
resp.add(DictContent.builder() resp.add(DictContent.builder()
.dictId(k.getId()) .dictId(k.getId())