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/service/impl/TaskExamServiceImpl.java |   47 ++++++++++++++++++++---------------------------
 1 files changed, 20 insertions(+), 27 deletions(-)

diff --git a/src/main/java/com/ycl/jxkg/service/impl/TaskExamServiceImpl.java b/src/main/java/com/ycl/jxkg/service/impl/TaskExamServiceImpl.java
index 308de43..e4fbe0f 100644
--- a/src/main/java/com/ycl/jxkg/service/impl/TaskExamServiceImpl.java
+++ b/src/main/java/com/ycl/jxkg/service/impl/TaskExamServiceImpl.java
@@ -1,9 +1,10 @@
 package com.ycl.jxkg.service.impl;
 
-import com.ycl.jxkg.domain.ExamPaper;
-import com.ycl.jxkg.domain.TaskExam;
-import com.ycl.jxkg.domain.TextContent;
-import com.ycl.jxkg.domain.User;
+import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
+import com.ycl.jxkg.domain.entity.ExamPaper;
+import com.ycl.jxkg.domain.entity.TaskExam;
+import com.ycl.jxkg.domain.entity.TextContent;
+import com.ycl.jxkg.domain.entity.User;
 import com.ycl.jxkg.domain.task.TaskItemObject;
 import com.ycl.jxkg.mapper.ExamPaperMapper;
 import com.ycl.jxkg.mapper.TaskExamMapper;
@@ -12,13 +13,13 @@
 import com.ycl.jxkg.service.enums.ActionEnum;
 import com.ycl.jxkg.utils.DateTimeUtil;
 import com.ycl.jxkg.utils.JsonUtil;
-import com.ycl.jxkg.vo.admin.exam.ExamResponseVO;
-import com.ycl.jxkg.vo.admin.task.TaskPageRequestVO;
-import com.ycl.jxkg.vo.admin.task.TaskRequestVO;
+import com.ycl.jxkg.domain.vo.admin.exam.ExamResponseVO;
+import com.ycl.jxkg.domain.vo.admin.task.TaskPageRequestVO;
+import com.ycl.jxkg.domain.vo.admin.task.TaskRequestVO;
 import com.github.pagehelper.PageHelper;
 import com.github.pagehelper.PageInfo;
+import lombok.RequiredArgsConstructor;
 import org.springframework.beans.BeanUtils;
-import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
 import org.springframework.transaction.annotation.Transactional;
 
@@ -28,19 +29,12 @@
 import java.util.stream.Collectors;
 
 @Service
-public class TaskExamServiceImpl extends BaseServiceImpl<TaskExam> implements TaskExamService {
+@RequiredArgsConstructor
+public class TaskExamServiceImpl extends ServiceImpl<TaskExamMapper,TaskExam> implements TaskExamService {
 
     private final TaskExamMapper taskExamMapper;
     private final TextContentService textContentService;
     private final ExamPaperMapper examPaperMapper;
-
-    @Autowired
-    public TaskExamServiceImpl(TaskExamMapper taskExamMapper, TextContentService textContentService, ExamPaperMapper examPaperMapper) {
-        super(taskExamMapper);
-        this.taskExamMapper = taskExamMapper;
-        this.textContentService = textContentService;
-        this.examPaperMapper = examPaperMapper;
-    }
 
     @Override
     public PageInfo<TaskExam> page(TaskPageRequestVO requestVM) {
@@ -61,7 +55,6 @@
             taskExam.setCreateUser(user.getId());
             taskExam.setCreateUserName(user.getUserName());
             taskExam.setCreateTime(now);
-            taskExam.setDeleted(false);
 
             //淇濆瓨浠诲姟缁撴瀯
             TextContent textContent = textContentService.jsonConvertInsert(model.getPaperItems(), now, p -> {
@@ -70,17 +63,17 @@
                 taskItemObject.setExamPaperName(p.getName());
                 return taskItemObject;
             });
-            textContentService.insertByFilter(textContent);
+            textContentService.save(textContent);
             taskExam.setFrameTextContentId(textContent.getId());
-            taskExamMapper.insertSelective(taskExam);
+            taskExamMapper.insert(taskExam);
 
         } else {
-            TaskExam old = taskExamMapper.selectByPrimaryKey(model.getId());
+            TaskExam old = taskExamMapper.selectById(model.getId());
             if (Objects.isNull(old)) {
                 throw new RuntimeException("鏁版嵁涓嶅瓨鍦�");
             }
             BeanUtils.copyProperties(taskExam, old);
-            TextContent textContent = textContentService.selectById(taskExam.getFrameTextContentId());
+            TextContent textContent = textContentService.getById(taskExam.getFrameTextContentId());
             //娓呯┖璇曞嵎浠诲姟鐨勮瘯鍗稩d锛屽悗闈細缁熶竴璁剧疆
             List<Integer> paperIds = JsonUtil.toJsonListObject(textContent.getContent(), TaskItemObject.class)
                     .stream()
@@ -95,8 +88,8 @@
                 taskItemObject.setExamPaperName(p.getName());
                 return taskItemObject;
             });
-            textContentService.updateByIdFilter(textContent);
-            taskExamMapper.updateByPrimaryKeySelective(old);
+            textContentService.updateById(textContent);
+            taskExamMapper.updateById(old);
         }
 
         //鏇存柊璇曞嵎鐨則askId
@@ -107,12 +100,12 @@
 
     @Override
     public TaskRequestVO taskExamToVM(Integer id) {
-        TaskExam taskExam = taskExamMapper.selectByPrimaryKey(id);
+        TaskExam taskExam = taskExamMapper.selectById(id);
         TaskRequestVO vo = new TaskRequestVO();
         BeanUtils.copyProperties(taskExam, vo);
-        TextContent textContent = textContentService.selectById(taskExam.getFrameTextContentId());
+        TextContent textContent = textContentService.getById(taskExam.getFrameTextContentId());
         List<ExamResponseVO> examResponseVOS = JsonUtil.toJsonListObject(textContent.getContent(), TaskItemObject.class).stream().map(tk -> {
-            ExamPaper examPaper = examPaperMapper.selectByPrimaryKey(tk.getExamPaperId());
+            ExamPaper examPaper = examPaperMapper.selectById(tk.getExamPaperId());
             ExamResponseVO examResponseVO = new ExamResponseVO();
             BeanUtils.copyProperties(examPaper, examResponseVO);
             examResponseVO.setCreateTime(DateTimeUtil.dateFormat(examPaper.getCreateTime()));

--
Gitblit v1.8.0