提交 2904737c authored 作者: zhoushaopan's avatar zhoushaopan

fix(配套设备库): 修改型号

修改型号
上级 0855e096
......@@ -6,6 +6,7 @@ import com.tykj.dev.device.matching.subject.domin.MatchingDeviceModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
@Service
......@@ -26,9 +27,15 @@ public class MatchingDeviceModelServiceImpl implements MatchingDeviceModelServic
@Override
public MatchingDeviceModel findByModelAndName(String model, String name) {
List<MatchingDeviceModel> byModelAndName = matchingDeviceModelDao.findByModelAndName(model, name);
if (byModelAndName.size() ==1){
return byModelAndName.get(0);
}else {
return byModelAndName.stream().filter(matchingDeviceModel -> !"0".equals(matchingDeviceModel.getStyle()))
.collect(Collectors.toList()).get(0);
}
return matchingDeviceModelDao.findByModelAndName(model,name).stream().filter(matchingDeviceModel -> !"0".equals(matchingDeviceModel.getStyle()))
.collect(Collectors.toList()).get(0);
}
@Override
......
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论