增加getAll

This commit is contained in:
zhouhao
2018-07-06 18:13:28 +08:00
parent c8417fee22
commit fac2554099
2 changed files with 21 additions and 0 deletions

View File

@@ -13,6 +13,7 @@ import org.springframework.stereotype.Service;
import java.util.ArrayList;
import java.util.List;
import java.util.stream.Collectors;
/**
* @author zhouhao
@@ -41,4 +42,17 @@ public class BoostDictDefineRepository extends DefaultDictDefineRepository {
.build();
}
@Override
public List<DictDefine> getAllDefine() {
List<DictDefine> all = dictionaryService.select()
.stream()
.map(dict -> DefaultDictDefine.builder()
.id(dict.getId())
.comments(dict.getDescribe())
.items((List) new ArrayList<>(dict.getItems()))
.build()).collect(Collectors.toList());
all.addAll(super.getAllDefine());
return all;
}
}

View File

@@ -63,6 +63,13 @@ public class DictionaryController implements SimpleGenericEntityController<Dicti
return dictionaryService;
}
@GetMapping("/define/all")
@Authorize(merge = false)
@ApiOperation("获取数据全部字典定义信息")
public ResponseMessage<List<DictDefine>> getAllDefineById() {
return ok(repository.getAllDefine());
}
@GetMapping("/define/{id:.+}")
@Authorize(merge = false)