xiongzhu hace 2 años
padre
commit
2cac6a0edf

+ 5 - 4
src/main/java/com/izouma/zhirongip/service/supply/PatentService.java

@@ -65,10 +65,11 @@ public class PatentService {
 
     public Patent get(Long id) {
         Patent patent = patentRepo.findById(id).orElseThrow(new BusinessException("无记录"));
-        patent.setIndustryName(settingRepo.findById(patent.getIndustryClass())
-                                          .orElseThrow(new BusinessException("无记录"))
-                                          .getName());
-
+        if(patent.getIndustryClass() != null) {
+            patent.setIndustryName(settingRepo.findById(patent.getIndustryClass())
+                                              .orElseThrow(new BusinessException("无记录"))
+                                              .getName());
+        }
         if (patent.getPatentTypeId() != null) {
             patent.setPatentType(settingRepo.findById(patent.getPatentTypeId())
                                             .orElseThrow(new BusinessException("无记录"))