Update TagService.java

This commit is contained in:
anastasia shulga 2019-04-16 07:55:37 +00:00
parent 1f36e04cd3
commit dbd61ce80c

View File

@ -23,8 +23,16 @@ public class TagService {
return tags
.stream()
.map(tag -> {
return tag.getId() != null ? getExistById(tag) :
isExistByName(tag.getTagName()) != null ? isExistByName(tag.getTagName()) : create(tag);
if(tag.getId() != null){
return getExistById(tag);
}else {
Tag existTag = isExistByName(tag.getTagName());
if(existTag != null){
return existTag;
}else{
return create(tag);
}
}
}).collect(Collectors.toList());
}