Commit eb72e954 by 刘泽志

相同字段查询

parent 1b8d35cf
...@@ -263,7 +263,26 @@ public class DataFieldController { ...@@ -263,7 +263,26 @@ public class DataFieldController {
@GetMapping("/sameFieldCheck") @GetMapping("/sameFieldCheck")
@ApiOperation("相同字段检查") @ApiOperation("相同字段检查")
public AjaxResult sameFieldCheck(@RequestParam String templateId) { public AjaxResult sameFieldCheck(@RequestParam String templateId) {
return AjaxResult.success(); List<CreateFieldVO> fieldList = dataFieldService.getCreateFields(templateId);
if (CollectionUtils.isEmpty(fieldList)){
return AjaxResult.success(Collections.emptyList());
}
Map<String, Integer> map = new HashMap<>();
List<CreateFieldVO> list = new ArrayList<>();
for (CreateFieldVO field : fieldList){
if (map.containsKey(field.getFieldName())){
map.put(field.getFieldName(),map.get(field.getFieldName())+1);
}else {
map.put(field.getFieldName(),1);
}
}
map.forEach((key,value)->{
if (value > 1){
Optional<CreateFieldVO> first = fieldList.stream().filter(item -> StringUtils.equals(item.getFieldName(), key)).findFirst();
first.ifPresent(list::add);
}
});
return AjaxResult.success(list);
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment