licailing 4 лет назад
Родитель
Сommit
c4993a35cd
1 измененных файлов с 10 добавлено и 1 удалено
  1. 10 1
      src/main/java/com/izouma/wenlvju/web/PerformanceApplyController.java

+ 10 - 1
src/main/java/com/izouma/wenlvju/web/PerformanceApplyController.java

@@ -1,9 +1,12 @@
 package com.izouma.wenlvju.web;
 
+import cn.hutool.core.util.ObjectUtil;
+import com.izouma.wenlvju.domain.ArtType;
 import com.izouma.wenlvju.domain.PerformanceApply;
 import com.izouma.wenlvju.dto.PageQuery;
 import com.izouma.wenlvju.enums.ApplyStatus;
 import com.izouma.wenlvju.exception.BusinessException;
+import com.izouma.wenlvju.repo.ArtTypeRepo;
 import com.izouma.wenlvju.repo.PerformanceApplyRepo;
 import com.izouma.wenlvju.service.PerformanceApplyService;
 import com.izouma.wenlvju.utils.ObjUtils;
@@ -25,6 +28,7 @@ import java.util.Map;
 public class PerformanceApplyController extends BaseController {
     private final PerformanceApplyService performanceApplyService;
     private final PerformanceApplyRepo    performanceApplyRepo;
+    private final ArtTypeRepo             artTypeRepo;
 
     //@PreAuthorize("hasRole('ADMIN')")
     @PostMapping("/save")
@@ -47,7 +51,12 @@ public class PerformanceApplyController extends BaseController {
 
     @GetMapping("/get/{id}")
     public PerformanceApply get(@PathVariable Long id) {
-        return performanceApplyRepo.findById(id).orElseThrow(new BusinessException("无记录"));
+        PerformanceApply apply = performanceApplyRepo.findById(id).orElseThrow(new BusinessException("无记录"));
+        if (ObjectUtil.isNotNull(apply.getArtTypeId())) {
+            ArtType artType = artTypeRepo.findById(apply.getArtTypeId()).orElseThrow(new BusinessException("无此专业"));
+            apply.setArtType(artType.getName());
+        }
+        return apply;
     }
 
     @PostMapping("/del/{id}")