Skip to content

Commit fac2554

Browse files
committed
增加getAll
1 parent c8417fe commit fac2554

File tree

2 files changed

+21
-0
lines changed

2 files changed

+21
-0
lines changed

hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-local/src/main/java/org/hswebframework/web/dictionary/simple/BoostDictDefineRepository.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
import java.util.ArrayList;
1515
import java.util.List;
16+
import java.util.stream.Collectors;
1617

1718
/**
1819
* @author zhouhao
@@ -41,4 +42,17 @@ public DictDefine getDefine(String id) {
4142
.build();
4243
}
4344

45+
@Override
46+
public List<DictDefine> getAllDefine() {
47+
List<DictDefine> all = dictionaryService.select()
48+
.stream()
49+
.map(dict -> DefaultDictDefine.builder()
50+
.id(dict.getId())
51+
.comments(dict.getDescribe())
52+
.items((List) new ArrayList<>(dict.getItems()))
53+
.build()).collect(Collectors.toList());
54+
55+
all.addAll(super.getAllDefine());
56+
return all;
57+
}
4458
}

hsweb-system/hsweb-system-dictionary/hsweb-system-dictionary-web/src/main/java/org/hswebframework/web/controller/dictionary/DictionaryController.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,13 @@ public DictionaryService getService() {
6363
return dictionaryService;
6464
}
6565

66+
@GetMapping("/define/all")
67+
@Authorize(merge = false)
68+
@ApiOperation("获取数据全部字典定义信息")
69+
public ResponseMessage<List<DictDefine>> getAllDefineById() {
70+
return ok(repository.getAllDefine());
71+
}
72+
6673

6774
@GetMapping("/define/{id:.+}")
6875
@Authorize(merge = false)

0 commit comments

Comments
 (0)