From 8546b3d285af4235a0ef615a0c6e89486ae2c806 Mon Sep 17 00:00:00 2001
From: fuliqi <fuliqi@qq.com>
Date: 星期四, 17 十月 2024 21:01:37 +0800
Subject: [PATCH] 达梦不支持value改为values

---
 src/main/java/com/ycl/jxkg/controller/student/EducationController.java |   41 ++++++++++++++++++++---------------------
 1 files changed, 20 insertions(+), 21 deletions(-)

diff --git a/src/main/java/com/ycl/jxkg/controller/student/EducationController.java b/src/main/java/com/ycl/jxkg/controller/student/EducationController.java
index 13e8cd6..e94ee93 100644
--- a/src/main/java/com/ycl/jxkg/controller/student/EducationController.java
+++ b/src/main/java/com/ycl/jxkg/controller/student/EducationController.java
@@ -2,46 +2,45 @@
 
 
 import com.ycl.jxkg.base.BaseApiController;
-import com.ycl.jxkg.base.RestResponse;
-import com.ycl.jxkg.domain.Subject;
-import com.ycl.jxkg.domain.User;
+import com.ycl.jxkg.base.Result;
+import com.ycl.jxkg.domain.entity.Subject;
+import com.ycl.jxkg.domain.entity.User;
 import com.ycl.jxkg.service.SubjectService;
-import com.ycl.jxkg.viewmodel.student.education.SubjectEditRequestVM;
-import com.ycl.jxkg.viewmodel.student.education.SubjectVM;
-import org.springframework.beans.factory.annotation.Autowired;
+import com.ycl.jxkg.domain.vo.student.education.SubjectEditRequestVO;
+import com.ycl.jxkg.domain.vo.student.education.SubjectVO;
+import lombok.RequiredArgsConstructor;
+import org.springframework.beans.BeanUtils;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.List;
 import java.util.stream.Collectors;
 
+@RequiredArgsConstructor
 @RestController("StudentEducationController")
 @RequestMapping(value = "/api/student/education")
 public class EducationController extends BaseApiController {
 
     private final SubjectService subjectService;
 
-    @Autowired
-    public EducationController(SubjectService subjectService) {
-        this.subjectService = subjectService;
-    }
-
     @RequestMapping(value = "/subject/list", method = RequestMethod.POST)
-    public RestResponse<List<SubjectVM>> list() {
+    public Result<List<SubjectVO>> list() {
         User user = getCurrentUser();
         List<Subject> subjects = subjectService.getSubjectByLevel(user.getUserLevel());
-        List<SubjectVM> subjectVMS = subjects.stream().map(d -> {
-            SubjectVM subjectVM = modelMapper.map(d, SubjectVM.class);
-            subjectVM.setId(String.valueOf(d.getId()));
-            return subjectVM;
+        List<SubjectVO> subjectVOS = subjects.stream().map(d -> {
+            SubjectVO subjectVO = new SubjectVO();
+            BeanUtils.copyProperties(d, subjectVO);
+            subjectVO.setId(String.valueOf(d.getId()));
+            return subjectVO;
         }).collect(Collectors.toList());
-        return RestResponse.ok(subjectVMS);
+        return Result.ok(subjectVOS);
     }
 
     @RequestMapping(value = "/subject/select/{id}", method = RequestMethod.POST)
-    public RestResponse<SubjectEditRequestVM> select(@PathVariable Integer id) {
-        Subject subject = subjectService.selectById(id);
-        SubjectEditRequestVM vm = modelMapper.map(subject, SubjectEditRequestVM.class);
-        return RestResponse.ok(vm);
+    public Result<SubjectEditRequestVO> select(@PathVariable Integer id) {
+        Subject subject = subjectService.getById(id);
+        SubjectEditRequestVO vo = new SubjectEditRequestVO();
+        BeanUtils.copyProperties(subject, vo);
+        return Result.ok(vo);
     }
 
 }

--
Gitblit v1.8.0