xiangpei
2024-05-31 c9d04bc519b73f7fc4841c34e2f15fca9db7aad2
重构:service、mapper plus化,xml删除多余sql
71个文件已修改
2个文件已删除
3913 ■■■■ 已修改文件
src/main/java/com/ycl/jxkg/controller/admin/DashboardController.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/controller/admin/EducationController.java 17 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/controller/admin/ExamPaperAnswerController.java 13 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/controller/admin/ExamPaperController.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/controller/admin/MessageController.java 8 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/controller/admin/QuestionController.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/controller/admin/TaskController.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/controller/admin/UserController.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/controller/student/DashboardController.java 16 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/controller/student/EducationController.java 9 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/controller/student/ExamPaperAnswerController.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/controller/student/ExamPaperController.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/controller/student/QuestionAnswerController.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/controller/student/QuestionController.java 6 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/controller/student/UploadController.java 9 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/controller/student/UserController.java 17 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/controller/wx/student/DashboardController.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/controller/wx/student/ExamPaperAnswerController.java 15 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/controller/wx/student/ExamPaperController.java 11 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/controller/wx/student/UserController.java 18 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/listener/CalculateExamPaperAnswerListener.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/listener/UserLogListener.java 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/mapper/ExamPaperAnswerMapper.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/mapper/ExamPaperMapper.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/mapper/ExamPaperQuestionCustomerAnswerMapper.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/mapper/MessageMapper.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/mapper/MessageUserMapper.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/mapper/QuestionMapper.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/mapper/SubjectMapper.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/mapper/TaskExamCustomerAnswerMapper.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/mapper/TaskExamMapper.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/mapper/TextContentMapper.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/mapper/UserEventLogMapper.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/mapper/UserMapper.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/mapper/UserTokenMapper.java 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/service/BaseService.java 56 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/service/ExamPaperAnswerService.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/service/ExamPaperQuestionCustomerAnswerService.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/service/ExamPaperService.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/service/QuestionService.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/service/SubjectService.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/service/TaskExamCustomerAnswerService.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/service/TaskExamService.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/service/TextContentService.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/service/UserEventLogService.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/service/UserService.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/service/UserTokenService.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/service/impl/BaseServiceImpl.java 43 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/service/impl/ExamPaperAnswerServiceImpl.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/service/impl/ExamPaperQuestionCustomerAnswerServiceImpl.java 16 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/service/impl/ExamPaperServiceImpl.java 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/service/impl/MessageServiceImpl.java 10 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/service/impl/QuestionServiceImpl.java 28 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/service/impl/SubjectServiceImpl.java 23 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/service/impl/TaskExamCustomerAnswerImpl.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/service/impl/TaskExamServiceImpl.java 31 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/service/impl/TextContentServiceImpl.java 20 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/service/impl/UserEventLogServiceImpl.java 11 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/service/impl/UserServiceImpl.java 30 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/service/impl/UserTokenServiceImpl.java 23 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/ExamPaperAnswerMapper.xml 316 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/ExamPaperMapper.xml 435 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/ExamPaperQuestionCustomerAnswerMapper.xml 344 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/MessageMapper.xml 203 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/MessageUserMapper.xml 212 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/QuestionMapper.xml 283 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/SubjectMapper.xml 164 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/TaskExamCustomerAnswerMapper.xml 136 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/TaskExamMapper.xml 180 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/TextContentMapper.xml 77 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/UserEventLogMapper.xml 179 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/UserMapper.xml 542 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/resources/mapper/UserTokenMapper.xml 145 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
src/main/java/com/ycl/jxkg/controller/admin/DashboardController.java
@@ -5,6 +5,7 @@
import com.ycl.jxkg.service.*;
import com.ycl.jxkg.utils.DateTimeUtil;
import com.ycl.jxkg.vo.admin.dashboard.IndexVO;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
@@ -12,6 +13,7 @@
import java.util.List;
@RequiredArgsConstructor
@RestController("AdminDashboardController")
@RequestMapping(value = "/api/admin/dashboard")
public class DashboardController extends BaseApiController {
@@ -21,15 +23,6 @@
    private final ExamPaperAnswerService examPaperAnswerService;
    private final ExamPaperQuestionCustomerAnswerService examPaperQuestionCustomerAnswerService;
    private final UserEventLogService userEventLogService;
    @Autowired
    public DashboardController(ExamPaperService examPaperService, QuestionService questionService, ExamPaperAnswerService examPaperAnswerService, ExamPaperQuestionCustomerAnswerService examPaperQuestionCustomerAnswerService, UserEventLogService userEventLogService) {
        this.examPaperService = examPaperService;
        this.questionService = questionService;
        this.examPaperAnswerService = examPaperAnswerService;
        this.examPaperQuestionCustomerAnswerService = examPaperQuestionCustomerAnswerService;
        this.userEventLogService = userEventLogService;
    }
    @RequestMapping(value = "/index", method = RequestMethod.POST)
    public Result<IndexVO> Index() {
src/main/java/com/ycl/jxkg/controller/admin/EducationController.java
@@ -10,6 +10,7 @@
import com.ycl.jxkg.vo.admin.education.SubjectPageRequestVO;
import com.ycl.jxkg.vo.admin.education.SubjectResponseVO;
import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -17,16 +18,12 @@
import javax.validation.Valid;
import java.util.List;
@RequiredArgsConstructor
@RestController("AdminEducationController")
@RequestMapping(value = "/api/admin/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 Result<List<Subject>> list() {
@@ -51,16 +48,16 @@
        BeanUtils.copyProperties(model, subject);
        if (model.getId() == null) {
            subject.setDeleted(false);
            subjectService.insertByFilter(subject);
            subjectService.save(subject);
        } else {
            subjectService.updateByIdFilter(subject);
            subjectService.updateById(subject);
        }
        return Result.ok();
    }
    @RequestMapping(value = "/subject/select/{id}", method = RequestMethod.POST)
    public Result<SubjectEditRequestVO> select(@PathVariable Integer id) {
        Subject subject = subjectService.selectById(id);
        Subject subject = subjectService.getById(id);
        SubjectEditRequestVO vo = new SubjectEditRequestVO();
        BeanUtils.copyProperties(subject, vo);
        return Result.ok(vo);
@@ -68,9 +65,9 @@
    @RequestMapping(value = "/subject/delete/{id}", method = RequestMethod.POST)
    public Result delete(@PathVariable Integer id) {
        Subject subject = subjectService.selectById(id);
        Subject subject = subjectService.getById(id);
        subject.setDeleted(true);
        subjectService.updateByIdFilter(subject);
        subjectService.updateById(subject);
        return Result.ok();
    }
}
src/main/java/com/ycl/jxkg/controller/admin/ExamPaperAnswerController.java
@@ -12,10 +12,12 @@
import com.ycl.jxkg.vo.student.exampaper.ExamPaperAnswerPageResponseVO;
import com.ycl.jxkg.vo.admin.paper.ExamPaperAnswerPageRequestVO;
import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RequiredArgsConstructor
@RestController("AdminExamPaperAnswerController")
@RequestMapping(value = "/api/admin/examPaperAnswer")
public class ExamPaperAnswerController extends BaseApiController {
@@ -24,13 +26,6 @@
    private final SubjectService subjectService;
    private final UserService userService;
    @Autowired
    public ExamPaperAnswerController(ExamPaperAnswerService examPaperAnswerService, SubjectService subjectService, UserService userService) {
        this.examPaperAnswerService = examPaperAnswerService;
        this.subjectService = subjectService;
        this.userService = userService;
    }
    @RequestMapping(value = "/page", method = RequestMethod.POST)
    public Result<PageInfo<ExamPaperAnswerPageResponseVO>> pageJudgeList(@RequestBody ExamPaperAnswerPageRequestVO model) {
@@ -38,14 +33,14 @@
        PageInfo<ExamPaperAnswerPageResponseVO> page = PageInfoHelper.copyMap(pageInfo, e -> {
            ExamPaperAnswerPageResponseVO vo = new ExamPaperAnswerPageResponseVO();
            BeanUtils.copyProperties(e, vo);
            Subject subject = subjectService.selectById(vo.getSubjectId());
            Subject subject = subjectService.getById(vo.getSubjectId());
            vo.setDoTime(ExamUtil.secondToVM(e.getDoTime()));
            vo.setSystemScore(ExamUtil.scoreToVM(e.getSystemScore()));
            vo.setUserScore(ExamUtil.scoreToVM(e.getUserScore()));
            vo.setPaperScore(ExamUtil.scoreToVM(e.getPaperScore()));
            vo.setSubjectName(subject.getName());
            vo.setCreateTime(DateTimeUtil.dateFormat(e.getCreateTime()));
            User user = userService.selectById(e.getCreateUser());
            User user = userService.getById(e.getCreateUser());
            vo.setUserName(user.getUserName());
            return vo;
        });
src/main/java/com/ycl/jxkg/controller/admin/ExamPaperController.java
@@ -10,22 +10,19 @@
import com.ycl.jxkg.vo.admin.exam.ExamPaperEditRequestVO;
import com.ycl.jxkg.vo.admin.exam.ExamResponseVO;
import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
@RequiredArgsConstructor
@RestController("AdminExamPaperController")
@RequestMapping(value = "/api/admin/exam/paper")
public class ExamPaperController extends BaseApiController {
    private final ExamPaperService examPaperService;
    @Autowired
    public ExamPaperController(ExamPaperService examPaperService) {
        this.examPaperService = examPaperService;
    }
    @RequestMapping(value = "/page", method = RequestMethod.POST)
    public Result<PageInfo<ExamResponseVO>> pageList(@RequestBody ExamPaperPageRequestVO model) {
@@ -70,9 +67,9 @@
    @RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
    public Result delete(@PathVariable Integer id) {
        ExamPaper examPaper = examPaperService.selectById(id);
        ExamPaper examPaper = examPaperService.getById(id);
        examPaper.setDeleted(true);
        examPaperService.updateByIdFilter(examPaper);
        examPaperService.updateById(examPaper);
        return Result.ok();
    }
}
src/main/java/com/ycl/jxkg/controller/admin/MessageController.java
@@ -14,6 +14,7 @@
import com.ycl.jxkg.vo.admin.message.MessageResponseVO;
import com.ycl.jxkg.vo.admin.message.MessageSendVO;
import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
@@ -26,18 +27,13 @@
import java.util.List;
import java.util.stream.Collectors;
@RequiredArgsConstructor
@RestController("AdminMessageController")
@RequestMapping(value = "/api/admin/message")
public class MessageController extends BaseApiController {
    private final MessageService messageService;
    private final UserService userService;
    @Autowired
    public MessageController(MessageService messageService, UserService userService) {
        this.messageService = messageService;
        this.userService = userService;
    }
    @RequestMapping(value = "/page", method = RequestMethod.POST)
    public Result<PageInfo<MessageResponseVO>> pageList(@RequestBody MessagePageRequestVO model) {
src/main/java/com/ycl/jxkg/controller/admin/QuestionController.java
@@ -14,6 +14,7 @@
import com.ycl.jxkg.vo.admin.question.QuestionPageRequestVO;
import com.ycl.jxkg.vo.admin.question.QuestionResponseVO;
import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -21,18 +22,13 @@
import javax.validation.Valid;
@RequiredArgsConstructor
@RestController("AdminQuestionController")
@RequestMapping(value = "/api/admin/question")
public class QuestionController extends BaseApiController {
    private final QuestionService questionService;
    private final TextContentService textContentService;
    @Autowired
    public QuestionController(QuestionService questionService, TextContentService textContentService) {
        this.questionService = questionService;
        this.textContentService = textContentService;
    }
    @RequestMapping(value = "/page", method = RequestMethod.POST)
    public Result<PageInfo<QuestionResponseVO>> pageList(@RequestBody QuestionPageRequestVO model) {
@@ -42,7 +38,7 @@
            BeanUtils.copyProperties(q, vo);
            vo.setCreateTime(DateTimeUtil.dateFormat(q.getCreateTime()));
            vo.setScore(ExamUtil.scoreToVM(q.getScore()));
            TextContent textContent = textContentService.selectById(q.getInfoTextContentId());
            TextContent textContent = textContentService.getById(q.getInfoTextContentId());
            QuestionObject questionObject = JsonUtil.toJsonObject(textContent.getContent(), QuestionObject.class);
            String clearHtml = HtmlUtil.clear(questionObject.getTitleContent());
            vo.setShortTitle(clearHtml);
@@ -76,9 +72,9 @@
    @RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
    public Result delete(@PathVariable Integer id) {
        Question question = questionService.selectById(id);
        Question question = questionService.getById(id);
        question.setDeleted(true);
        questionService.updateByIdFilter(question);
        questionService.updateById(question);
        return Result.ok();
    }
src/main/java/com/ycl/jxkg/controller/admin/TaskController.java
@@ -11,22 +11,19 @@
import com.ycl.jxkg.vo.admin.task.TaskPageResponseVO;
import com.ycl.jxkg.vo.admin.task.TaskRequestVO;
import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.validation.Valid;
@RequiredArgsConstructor
@RestController("AdminTaskController")
@RequestMapping(value = "/api/admin/task")
public class TaskController extends BaseApiController {
    private final TaskExamService taskExamService;
    @Autowired
    public TaskController(TaskExamService taskExamService) {
        this.taskExamService = taskExamService;
    }
    @RequestMapping(value = "/page", method = RequestMethod.POST)
    public Result<PageInfo<TaskPageResponseVO>> pageList(@RequestBody TaskPageRequestVO model) {
@@ -57,9 +54,9 @@
    @RequestMapping(value = "/delete/{id}", method = RequestMethod.POST)
    public Result delete(@PathVariable Integer id) {
        TaskExam taskExam = taskExamService.selectById(id);
        TaskExam taskExam = taskExamService.getById(id);
        taskExam.setDeleted(true);
        taskExamService.updateByIdFilter(taskExam);
        taskExamService.updateById(taskExam);
        return Result.ok();
    }
}
src/main/java/com/ycl/jxkg/controller/admin/UserController.java
@@ -14,6 +14,7 @@
import com.ycl.jxkg.utils.PageInfoHelper;
import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -24,7 +25,7 @@
import java.util.List;
import java.util.UUID;
@RequiredArgsConstructor
@RestController("AdminUserController")
@RequestMapping(value = "/api/admin/user")
public class UserController extends BaseApiController {
@@ -32,14 +33,6 @@
    private final UserService userService;
    private final UserEventLogService userEventLogService;
    private final AuthenticationService authenticationService;
    @Autowired
    public UserController(UserService userService, UserEventLogService userEventLogService, AuthenticationService authenticationService) {
        this.userService = userService;
        this.userEventLogService = userEventLogService;
        this.authenticationService = authenticationService;
    }
    @RequestMapping(value = "/page/list", method = RequestMethod.POST)
    public Result<PageInfo<UserResponseVO>> pageList(@RequestBody UserPageRequestVO model) {
@@ -101,14 +94,14 @@
            user.setCreateTime(new Date());
            user.setLastActiveTime(new Date());
            user.setDeleted(false);
            userService.insertByFilter(user);
            userService.insertUser(user);
        } else {
            if (!StringUtils.isBlank(model.getPassword())) {
                String encodePwd = authenticationService.pwdEncode(model.getPassword());
                user.setPassword(encodePwd);
            }
            user.setModifyTime(new Date());
            userService.updateByIdFilter(user);
            userService.updateById(user);
        }
        return Result.ok(user);
    }
@@ -116,10 +109,10 @@
    @RequestMapping(value = "/update", method = RequestMethod.POST)
    public Result update(@RequestBody @Valid UserUpdateVO model) {
        User user = userService.selectById(getCurrentUser().getId());
        User user = userService.getById(getCurrentUser().getId());
        BeanUtils.copyProperties(model, user);
        user.setModifyTime(new Date());
        userService.updateByIdFilter(user);
        userService.updateById(user);
        return Result.ok();
    }
@@ -131,7 +124,7 @@
        Integer newStatus = userStatusEnum == UserStatusEnum.Enable ? UserStatusEnum.Disable.getCode() : UserStatusEnum.Enable.getCode();
        user.setStatus(newStatus);
        user.setModifyTime(new Date());
        userService.updateByIdFilter(user);
        userService.updateById(user);
        return Result.ok(newStatus);
    }
@@ -140,7 +133,7 @@
    public Result delete(@PathVariable Integer id) {
        User user = userService.getUserById(id);
        user.setDeleted(true);
        userService.updateByIdFilter(user);
        userService.updateById(user);
        return Result.ok();
    }
src/main/java/com/ycl/jxkg/controller/student/DashboardController.java
@@ -13,6 +13,7 @@
import com.ycl.jxkg.utils.DateTimeUtil;
import com.ycl.jxkg.utils.JsonUtil;
import com.ycl.jxkg.vo.student.dashboard.*;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
@@ -24,6 +25,7 @@
import java.util.List;
import java.util.stream.Collectors;
@RequiredArgsConstructor
@RestController("StudentDashboardController")
@RequestMapping(value = "/api/student/dashboard")
public class DashboardController extends BaseApiController {
@@ -34,16 +36,6 @@
    private final TaskExamService taskExamService;
    private final TaskExamCustomerAnswerService taskExamCustomerAnswerService;
    private final TextContentService textContentService;
    @Autowired
    public DashboardController(UserService userService, ExamPaperService examPaperService, QuestionService questionService, TaskExamService taskExamService, TaskExamCustomerAnswerService taskExamCustomerAnswerService, TextContentService textContentService) {
        this.userService = userService;
        this.examPaperService = examPaperService;
        this.questionService = questionService;
        this.taskExamService = taskExamService;
        this.taskExamCustomerAnswerService = taskExamCustomerAnswerService;
        this.textContentService = textContentService;
    }
    @RequestMapping(value = "/index", method = RequestMethod.POST)
    public Result<IndexVO> index() {
@@ -97,12 +89,12 @@
    private List<TaskItemPaperVO> getTaskItemPaperVm(Integer tFrameId, TaskExamCustomerAnswer taskExamCustomerAnswers) {
        TextContent textContent = textContentService.selectById(tFrameId);
        TextContent textContent = textContentService.getById(tFrameId);
        List<TaskItemObject> paperItems = JsonUtil.toJsonListObject(textContent.getContent(), TaskItemObject.class);
        List<TaskItemAnswerObject> answerPaperItems = null;
        if (null != taskExamCustomerAnswers) {
            TextContent answerTextContent = textContentService.selectById(taskExamCustomerAnswers.getTextContentId());
            TextContent answerTextContent = textContentService.getById(taskExamCustomerAnswers.getTextContentId());
            answerPaperItems = JsonUtil.toJsonListObject(answerTextContent.getContent(), TaskItemAnswerObject.class);
        }
src/main/java/com/ycl/jxkg/controller/student/EducationController.java
@@ -8,6 +8,7 @@
import com.ycl.jxkg.service.SubjectService;
import com.ycl.jxkg.vo.student.education.SubjectEditRequestVO;
import com.ycl.jxkg.vo.student.education.SubjectVO;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@@ -15,16 +16,12 @@
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 Result<List<SubjectVO>> list() {
@@ -41,7 +38,7 @@
    @RequestMapping(value = "/subject/select/{id}", method = RequestMethod.POST)
    public Result<SubjectEditRequestVO> select(@PathVariable Integer id) {
        Subject subject = subjectService.selectById(id);
        Subject subject = subjectService.getById(id);
        SubjectEditRequestVO vo = new SubjectEditRequestVO();
        BeanUtils.copyProperties(subject, vo);
        return Result.ok(vo);
src/main/java/com/ycl/jxkg/controller/student/ExamPaperAnswerController.java
@@ -18,6 +18,7 @@
import com.ycl.jxkg.vo.student.exampaper.ExamPaperAnswerPageResponseVO;
import com.ycl.jxkg.vo.student.exampaper.ExamPaperAnswerPageVO;
import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
@@ -26,6 +27,7 @@
import javax.validation.Valid;
import java.util.Date;
@RequiredArgsConstructor
@RestController("StudentExamPaperAnswerController")
@RequestMapping(value = "/api/student/exampaper/answer")
public class ExamPaperAnswerController extends BaseApiController {
@@ -35,14 +37,6 @@
    private final SubjectService subjectService;
    private final ApplicationEventPublisher eventPublisher;
    @Autowired
    public ExamPaperAnswerController(ExamPaperAnswerService examPaperAnswerService, ExamPaperService examPaperService, SubjectService subjectService, ApplicationEventPublisher eventPublisher) {
        this.examPaperAnswerService = examPaperAnswerService;
        this.examPaperService = examPaperService;
        this.subjectService = subjectService;
        this.eventPublisher = eventPublisher;
    }
    @RequestMapping(value = "/pageList", method = RequestMethod.POST)
    public Result<PageInfo<ExamPaperAnswerPageResponseVO>> pageList(@RequestBody @Valid ExamPaperAnswerPageVO model) {
@@ -51,7 +45,7 @@
        PageInfo<ExamPaperAnswerPageResponseVO> page = PageInfoHelper.copyMap(pageInfo, e -> {
            ExamPaperAnswerPageResponseVO vo = new ExamPaperAnswerPageResponseVO();
            BeanUtils.copyProperties(e, vo);
            Subject subject = subjectService.selectById(vo.getSubjectId());
            Subject subject = subjectService.getById(vo.getSubjectId());
            vo.setDoTime(ExamUtil.secondToVM(e.getDoTime()));
            vo.setSystemScore(ExamUtil.scoreToVM(e.getSystemScore()));
            vo.setUserScore(ExamUtil.scoreToVM(e.getUserScore()));
@@ -92,7 +86,7 @@
            return Result.fail(2, "有未批改题目");
        }
        ExamPaperAnswer examPaperAnswer = examPaperAnswerService.selectById(examPaperSubmitVO.getId());
        ExamPaperAnswer examPaperAnswer = examPaperAnswerService.getById(examPaperSubmitVO.getId());
        ExamPaperAnswerStatusEnum examPaperAnswerStatusEnum = ExamPaperAnswerStatusEnum.fromCode(examPaperAnswer.getStatus());
        if (examPaperAnswerStatusEnum == ExamPaperAnswerStatusEnum.Complete) {
            return Result.fail(3, "试卷已完成");
@@ -108,7 +102,7 @@
    @RequestMapping(value = "/read/{id}", method = RequestMethod.POST)
    public Result<ExamPaperReadVO> read(@PathVariable Integer id) {
        ExamPaperAnswer examPaperAnswer = examPaperAnswerService.selectById(id);
        ExamPaperAnswer examPaperAnswer = examPaperAnswerService.getById(id);
        ExamPaperReadVO vm = new ExamPaperReadVO();
        ExamPaperEditRequestVO paper = examPaperService.examPaperToVM(examPaperAnswer.getExamPaperId());
        ExamPaperSubmitVO answer = examPaperAnswerService.examPaperAnswerToVM(examPaperAnswer.getId());
src/main/java/com/ycl/jxkg/controller/student/ExamPaperController.java
@@ -11,6 +11,7 @@
import com.ycl.jxkg.vo.student.exam.ExamPaperPageResponseVO;
import com.ycl.jxkg.vo.student.exam.ExamPaperPageVO;
import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
@@ -18,6 +19,7 @@
import javax.validation.Valid;
@RequiredArgsConstructor
@RestController("StudentExamPaperController")
@RequestMapping(value = "/api/student/exam/paper")
public class ExamPaperController extends BaseApiController {
@@ -25,14 +27,6 @@
    private final ExamPaperService examPaperService;
    private final ExamPaperAnswerService examPaperAnswerService;
    private final ApplicationEventPublisher eventPublisher;
    @Autowired
    public ExamPaperController(ExamPaperService examPaperService, ExamPaperAnswerService examPaperAnswerService, ApplicationEventPublisher eventPublisher) {
        this.examPaperService = examPaperService;
        this.examPaperAnswerService = examPaperAnswerService;
        this.eventPublisher = eventPublisher;
    }
    @RequestMapping(value = "/select/{id}", method = RequestMethod.POST)
    public Result<ExamPaperEditRequestVO> select(@PathVariable Integer id) {
src/main/java/com/ycl/jxkg/controller/student/QuestionAnswerController.java
@@ -20,10 +20,12 @@
import com.ycl.jxkg.vo.student.question.answer.QuestionPageStudentRequestVO;
import com.ycl.jxkg.vo.student.question.answer.QuestionPageStudentResponseVO;
import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RequiredArgsConstructor
@RestController("StudentQuestionAnswerController")
@RequestMapping(value = "/api/student/question/answer")
public class QuestionAnswerController extends BaseApiController {
@@ -33,24 +35,16 @@
    private final TextContentService textContentService;
    private final SubjectService subjectService;
    @Autowired
    public QuestionAnswerController(ExamPaperQuestionCustomerAnswerService examPaperQuestionCustomerAnswerService, QuestionService questionService, TextContentService textContentService, SubjectService subjectService) {
        this.examPaperQuestionCustomerAnswerService = examPaperQuestionCustomerAnswerService;
        this.questionService = questionService;
        this.textContentService = textContentService;
        this.subjectService = subjectService;
    }
    @RequestMapping(value = "/page", method = RequestMethod.POST)
    public Result<PageInfo<QuestionPageStudentResponseVO>> pageList(@RequestBody QuestionPageStudentRequestVO model) {
        model.setCreateUser(getCurrentUser().getId());
        PageInfo<ExamPaperQuestionCustomerAnswer> pageInfo = examPaperQuestionCustomerAnswerService.studentPage(model);
        PageInfo<QuestionPageStudentResponseVO> page = PageInfoHelper.copyMap(pageInfo, q -> {
            Subject subject = subjectService.selectById(q.getSubjectId());
            Subject subject = subjectService.getById(q.getSubjectId());
            QuestionPageStudentResponseVO vo = new QuestionPageStudentResponseVO();
            BeanUtils.copyProperties(q, vo);
            vo.setCreateTime(DateTimeUtil.dateFormat(q.getCreateTime()));
            TextContent textContent = textContentService.selectById(q.getQuestionTextContentId());
            TextContent textContent = textContentService.getById(q.getQuestionTextContentId());
            QuestionObject questionObject = JsonUtil.toJsonObject(textContent.getContent(), QuestionObject.class);
            String clearHtml = HtmlUtil.clear(questionObject.getTitleContent());
            vo.setShortTitle(clearHtml);
@@ -64,7 +58,7 @@
    @RequestMapping(value = "/select/{id}", method = RequestMethod.POST)
    public Result<QuestionAnswerVO> select(@PathVariable Integer id) {
        QuestionAnswerVO vm = new QuestionAnswerVO();
        ExamPaperQuestionCustomerAnswer examPaperQuestionCustomerAnswer = examPaperQuestionCustomerAnswerService.selectById(id);
        ExamPaperQuestionCustomerAnswer examPaperQuestionCustomerAnswer = examPaperQuestionCustomerAnswerService.getById(id);
        ExamPaperSubmitItemVO questionAnswerVM = examPaperQuestionCustomerAnswerService.examPaperQuestionCustomerAnswerToVM(examPaperQuestionCustomerAnswer);
        QuestionEditRequestVO questionVM = questionService.getQuestionEditRequestVM(examPaperQuestionCustomerAnswer.getQuestionId());
        vm.setQuestionVM(questionVM);
src/main/java/com/ycl/jxkg/controller/student/QuestionController.java
@@ -2,17 +2,15 @@
import com.ycl.jxkg.base.BaseApiController;
import com.ycl.jxkg.service.QuestionService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@RequiredArgsConstructor
@RestController("StudentQuestionController")
@RequestMapping(value = "/api/student/question")
public class QuestionController extends BaseApiController {
    private final QuestionService questionService;
    @Autowired
    public QuestionController(QuestionService questionService) {
        this.questionService = questionService;
    }
}
src/main/java/com/ycl/jxkg/controller/student/UploadController.java
@@ -5,6 +5,7 @@
import com.ycl.jxkg.base.Result;
import com.ycl.jxkg.service.FileUpload;
import com.ycl.jxkg.service.UserService;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
@@ -16,19 +17,13 @@
import java.io.IOException;
import java.io.InputStream;
@RequiredArgsConstructor
@RequestMapping("/api/student/upload")
@RestController("StudentUploadController")
public class UploadController extends BaseApiController {
    private final FileUpload fileUpload;
    private final UserService userService;
    @Autowired
    public UploadController(FileUpload fileUpload, UserService userService) {
        this.fileUpload = fileUpload;
        this.userService = userService;
    }
    @RequestMapping("/image")
src/main/java/com/ycl/jxkg/controller/student/UserController.java
@@ -17,6 +17,7 @@
import com.ycl.jxkg.utils.PageInfoHelper;
import com.ycl.jxkg.vo.student.user.*;
import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -29,6 +30,7 @@
import java.util.UUID;
import java.util.stream.Collectors;
@RequiredArgsConstructor
@RestController("StudentUserController")
@RequestMapping(value = "/api/student/user")
public class UserController extends BaseApiController {
@@ -38,15 +40,6 @@
    private final MessageService messageService;
    private final AuthenticationService authenticationService;
    private final ApplicationEventPublisher eventPublisher;
    @Autowired
    public UserController(UserService userService, UserEventLogService userEventLogService, MessageService messageService, AuthenticationService authenticationService, ApplicationEventPublisher eventPublisher) {
        this.userService = userService;
        this.userEventLogService = userEventLogService;
        this.messageService = messageService;
        this.authenticationService = authenticationService;
        this.eventPublisher = eventPublisher;
    }
    @RequestMapping(value = "/current", method = RequestMethod.POST)
    public Result<UserResponseVO> current() {
@@ -72,7 +65,7 @@
        user.setLastActiveTime(new Date());
        user.setCreateTime(new Date());
        user.setDeleted(false);
        userService.insertByFilter(user);
        userService.insertUser(user);
        UserEventLog userEventLog = new UserEventLog(user.getId(), user.getUserName(), user.getRealName(), new Date());
        userEventLog.setContent("欢迎 " + user.getUserName() + " 注册来到学之思开源考试系统");
        eventPublisher.publishEvent(new UserEvent(userEventLog));
@@ -85,10 +78,10 @@
        if (StringUtils.isBlank(model.getBirthDay())) {
            model.setBirthDay(null);
        }
        User user = userService.selectById(getCurrentUser().getId());
        User user = userService.getById(getCurrentUser().getId());
        BeanUtils.copyProperties(model, user);
        user.setModifyTime(new Date());
        userService.updateByIdFilter(user);
        userService.updateUser(user);
        UserEventLog userEventLog = new UserEventLog(user.getId(), user.getUserName(), user.getRealName(), new Date());
        userEventLog.setContent(user.getUserName() + " 更新了个人资料");
        eventPublisher.publishEvent(new UserEvent(userEventLog));
src/main/java/com/ycl/jxkg/controller/wx/student/DashboardController.java
@@ -16,6 +16,7 @@
import com.ycl.jxkg.utils.DateTimeUtil;
import com.ycl.jxkg.utils.JsonUtil;
import com.ycl.jxkg.vo.student.dashboard.*;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@@ -28,7 +29,7 @@
import java.util.List;
import java.util.stream.Collectors;
@RequiredArgsConstructor
@Controller("WXStudentDashboardController")
@RequestMapping(value = "/api/wx/student/dashboard")
@ResponseBody
@@ -38,14 +39,6 @@
    private final TextContentService textContentService;
    private final TaskExamService taskExamService;
    private final TaskExamCustomerAnswerService taskExamCustomerAnswerService;
    @Autowired
    public DashboardController(ExamPaperService examPaperService, TextContentService textContentService, TaskExamService taskExamService, TaskExamCustomerAnswerService taskExamCustomerAnswerService) {
        this.examPaperService = examPaperService;
        this.textContentService = textContentService;
        this.taskExamService = taskExamService;
        this.taskExamCustomerAnswerService = taskExamCustomerAnswerService;
    }
    @RequestMapping(value = "/index", method = RequestMethod.POST)
    public Result<IndexVO> index() {
@@ -98,12 +91,12 @@
    private List<TaskItemPaperVO> getTaskItemPaperVm(Integer tFrameId, TaskExamCustomerAnswer taskExamCustomerAnswers) {
        TextContent textContent = textContentService.selectById(tFrameId);
        TextContent textContent = textContentService.getById(tFrameId);
        List<TaskItemObject> paperItems = JsonUtil.toJsonListObject(textContent.getContent(), TaskItemObject.class);
        List<TaskItemAnswerObject> answerPaperItems = null;
        if (null != taskExamCustomerAnswers) {
            TextContent answerTextContent = textContentService.selectById(taskExamCustomerAnswers.getTextContentId());
            TextContent answerTextContent = textContentService.getById(taskExamCustomerAnswers.getTextContentId());
            answerPaperItems = JsonUtil.toJsonListObject(answerTextContent.getContent(), TaskItemAnswerObject.class);
        }
src/main/java/com/ycl/jxkg/controller/wx/student/ExamPaperAnswerController.java
@@ -19,6 +19,7 @@
import com.ycl.jxkg.vo.student.exam.ExamPaperReadVO;
import com.ycl.jxkg.vo.student.exam.ExamPaperSubmitItemVO;
import com.ycl.jxkg.vo.student.exam.ExamPaperSubmitVO;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
@@ -30,7 +31,7 @@
import java.util.*;
import java.util.stream.Collectors;
@RequiredArgsConstructor
@Controller("WXStudentExamPaperAnswerController")
@RequestMapping(value = "/api/wx/student/exampaper/answer")
@ResponseBody
@@ -41,14 +42,6 @@
    private final ApplicationEventPublisher eventPublisher;
    private final ExamPaperService examPaperService;
    @Autowired
    public ExamPaperAnswerController(ExamPaperAnswerService examPaperAnswerService, SubjectService subjectService, ApplicationEventPublisher eventPublisher, ExamPaperService examPaperService) {
        this.examPaperAnswerService = examPaperAnswerService;
        this.subjectService = subjectService;
        this.eventPublisher = eventPublisher;
        this.examPaperService = examPaperService;
    }
    @RequestMapping(value = "/pageList", method = RequestMethod.POST)
    public Result<PageInfo<ExamPaperAnswerPageResponseVO>> pageList(@Valid ExamPaperAnswerPageVO model) {
        model.setCreateUser(getCurrentUser().getId());
@@ -56,7 +49,7 @@
        PageInfo<ExamPaperAnswerPageResponseVO> page = PageInfoHelper.copyMap(pageInfo, e -> {
            ExamPaperAnswerPageResponseVO vo = new ExamPaperAnswerPageResponseVO();
            BeanUtils.copyProperties(e, vo);
            Subject subject = subjectService.selectById(vo.getSubjectId());
            Subject subject = subjectService.getById(vo.getSubjectId());
            vo.setDoTime(ExamUtil.secondToVM(e.getDoTime()));
            vo.setSystemScore(ExamUtil.scoreToVM(e.getSystemScore()));
            vo.setUserScore(ExamUtil.scoreToVM(e.getUserScore()));
@@ -127,7 +120,7 @@
    @PostMapping(value = "/read/{id}")
    public Result<ExamPaperReadVO> read(@PathVariable Integer id) {
        ExamPaperReadVO vm = new ExamPaperReadVO();
        ExamPaperAnswer examPaperAnswer = examPaperAnswerService.selectById(id);
        ExamPaperAnswer examPaperAnswer = examPaperAnswerService.getById(id);
        ExamPaperEditRequestVO paper = examPaperService.examPaperToVM(examPaperAnswer.getExamPaperId());
        ExamPaperSubmitVO answer = examPaperAnswerService.examPaperAnswerToVM(examPaperAnswer.getId());
        vm.setPaper(paper);
src/main/java/com/ycl/jxkg/controller/wx/student/ExamPaperController.java
@@ -12,6 +12,7 @@
import com.ycl.jxkg.vo.student.exam.ExamPaperPageResponseVO;
import com.ycl.jxkg.vo.student.exam.ExamPaperPageVO;
import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
@@ -19,7 +20,7 @@
import javax.validation.Valid;
@RequiredArgsConstructor
@Controller("WXStudentExamController")
@RequestMapping(value = "/api/wx/student/exampaper")
@ResponseBody
@@ -27,12 +28,6 @@
    private final ExamPaperService examPaperService;
    private final SubjectService subjectService;
    @Autowired
    public ExamPaperController(ExamPaperService examPaperService, SubjectService subjectService) {
        this.examPaperService = examPaperService;
        this.subjectService = subjectService;
    }
    @RequestMapping(value = "/select/{id}", method = RequestMethod.POST)
@@ -49,7 +44,7 @@
        PageInfo<ExamPaperPageResponseVO> page = PageInfoHelper.copyMap(pageInfo, e -> {
            ExamPaperPageResponseVO vo = new ExamPaperPageResponseVO();
            BeanUtils.copyProperties(e, vo);
            Subject subject = subjectService.selectById(vo.getSubjectId());
            Subject subject = subjectService.getById(vo.getSubjectId());
            vo.setSubjectName(subject.getName());
            vo.setCreateTime(DateTimeUtil.dateFormat(e.getCreateTime()));
            return vo;
src/main/java/com/ycl/jxkg/controller/wx/student/UserController.java
@@ -17,6 +17,7 @@
import com.ycl.jxkg.utils.PageInfoHelper;
import com.ycl.jxkg.vo.student.user.*;
import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import org.apache.commons.lang3.StringUtils;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
@@ -30,7 +31,7 @@
import java.util.UUID;
import java.util.stream.Collectors;
@RequiredArgsConstructor
@Controller("WXStudentUserController")
@RequestMapping(value = "/api/wx/student/user")
@ResponseBody
@@ -41,15 +42,6 @@
    private final MessageService messageService;
    private final AuthenticationService authenticationService;
    private final ApplicationEventPublisher eventPublisher;
    @Autowired
    public UserController(UserService userService, UserEventLogService userEventLogService, MessageService messageService, AuthenticationService authenticationService, ApplicationEventPublisher eventPublisher) {
        this.userService = userService;
        this.userEventLogService = userEventLogService;
        this.messageService = messageService;
        this.authenticationService = authenticationService;
        this.eventPublisher = eventPublisher;
    }
    @RequestMapping(value = "/current", method = RequestMethod.POST)
    public Result<UserResponseVO> current() {
@@ -75,7 +67,7 @@
        user.setLastActiveTime(new Date());
        user.setCreateTime(new Date());
        user.setDeleted(false);
        userService.insertByFilter(user);
        userService.insertUser(user);
        UserEventLog userEventLog = new UserEventLog(user.getId(), user.getUserName(), user.getRealName(), new Date());
        userEventLog.setContent("欢迎 " + user.getUserName() + " 注册来到学之思开源考试系统");
        eventPublisher.publishEvent(new UserEvent(userEventLog));
@@ -87,10 +79,10 @@
        if (StringUtils.isBlank(model.getBirthDay())) {
            model.setBirthDay(null);
        }
        User user = userService.selectById(getCurrentUser().getId());
        User user = userService.getById(getCurrentUser().getId());
        BeanUtils.copyProperties(model, user);
        user.setModifyTime(new Date());
        userService.updateByIdFilter(user);
        userService.updateUser(user);
        UserEventLog userEventLog = new UserEventLog(user.getId(), user.getUserName(), user.getRealName(), new Date());
        userEventLog.setContent(user.getUserName() + " 更新了个人资料");
        eventPublisher.publishEvent(new UserEvent(userEventLog));
src/main/java/com/ycl/jxkg/listener/CalculateExamPaperAnswerListener.java
@@ -57,12 +57,12 @@
        ExamPaperAnswer examPaperAnswer = examPaperAnswerInfo.getExamPaperAnswer();
        List<ExamPaperQuestionCustomerAnswer> examPaperQuestionCustomerAnswers = examPaperAnswerInfo.getExamPaperQuestionCustomerAnswers();
        examPaperAnswerService.insertByFilter(examPaperAnswer);
        examPaperAnswerService.save(examPaperAnswer);
        examPaperQuestionCustomerAnswers.stream().filter(a -> QuestionTypeEnum.needSaveTextContent(a.getQuestionType())).forEach(d -> {
            TextContent textContent = new TextContent();
            textContent.setContent(d.getAnswer());
            textContent.setCreateTime(now);
            textContentService.insertByFilter(textContent);
            textContentService.save(textContent);
            d.setTextContentId(textContent.getId());
            d.setAnswer(null);
        });
src/main/java/com/ycl/jxkg/listener/UserLogListener.java
@@ -29,7 +29,7 @@
    @Override
    public void onApplicationEvent(UserEvent userEvent) {
        userEventLogService.insertByFilter(userEvent.getUserEventLog());
        userEventLogService.save(userEvent.getUserEventLog());
    }
}
src/main/java/com/ycl/jxkg/mapper/ExamPaperAnswerMapper.java
@@ -1,5 +1,6 @@
package com.ycl.jxkg.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ycl.jxkg.domain.ExamPaperAnswer;
import com.ycl.jxkg.domain.other.KeyValue;
import com.ycl.jxkg.vo.admin.paper.ExamPaperAnswerPageRequestVO;
src/main/java/com/ycl/jxkg/mapper/ExamPaperMapper.java
@@ -1,5 +1,6 @@
package com.ycl.jxkg.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ycl.jxkg.domain.ExamPaper;
import com.ycl.jxkg.domain.other.KeyValue;
import com.ycl.jxkg.vo.admin.exam.ExamPaperPageRequestVO;
src/main/java/com/ycl/jxkg/mapper/ExamPaperQuestionCustomerAnswerMapper.java
@@ -1,5 +1,6 @@
package com.ycl.jxkg.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ycl.jxkg.domain.ExamPaperQuestionCustomerAnswer;
import com.ycl.jxkg.domain.other.ExamPaperAnswerUpdate;
import com.ycl.jxkg.domain.other.KeyValue;
src/main/java/com/ycl/jxkg/mapper/MessageMapper.java
@@ -1,5 +1,6 @@
package com.ycl.jxkg.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ycl.jxkg.domain.Message;
import com.ycl.jxkg.vo.admin.message.MessagePageRequestVO;
import org.apache.ibatis.annotations.Mapper;
src/main/java/com/ycl/jxkg/mapper/MessageUserMapper.java
@@ -1,5 +1,6 @@
package com.ycl.jxkg.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ycl.jxkg.domain.MessageUser;
import com.ycl.jxkg.vo.student.user.MessageRequestVO;
import org.apache.ibatis.annotations.Mapper;
src/main/java/com/ycl/jxkg/mapper/QuestionMapper.java
@@ -1,5 +1,6 @@
package com.ycl.jxkg.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ycl.jxkg.domain.other.KeyValue;
import com.ycl.jxkg.domain.Question;
import com.ycl.jxkg.vo.admin.question.QuestionPageRequestVO;
src/main/java/com/ycl/jxkg/mapper/SubjectMapper.java
@@ -1,5 +1,6 @@
package com.ycl.jxkg.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ycl.jxkg.domain.Subject;
import com.ycl.jxkg.vo.admin.education.SubjectPageRequestVO;
import org.apache.ibatis.annotations.Mapper;
@@ -7,7 +8,7 @@
import java.util.List;
@Mapper
public interface SubjectMapper  extends BaseMapper<Subject> {
public interface SubjectMapper extends BaseMapper<Subject> {
    List<Subject> getSubjectByLevel(Integer level);
src/main/java/com/ycl/jxkg/mapper/TaskExamCustomerAnswerMapper.java
@@ -1,5 +1,6 @@
package com.ycl.jxkg.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ycl.jxkg.domain.TaskExamCustomerAnswer;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
src/main/java/com/ycl/jxkg/mapper/TaskExamMapper.java
@@ -1,5 +1,6 @@
package com.ycl.jxkg.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ycl.jxkg.domain.TaskExam;
import com.ycl.jxkg.vo.admin.task.TaskPageRequestVO;
import org.apache.ibatis.annotations.Mapper;
src/main/java/com/ycl/jxkg/mapper/TextContentMapper.java
@@ -1,5 +1,6 @@
package com.ycl.jxkg.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ycl.jxkg.domain.TextContent;
import org.apache.ibatis.annotations.Mapper;
src/main/java/com/ycl/jxkg/mapper/UserEventLogMapper.java
@@ -1,5 +1,6 @@
package com.ycl.jxkg.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ycl.jxkg.domain.UserEventLog;
import com.ycl.jxkg.domain.other.KeyValue;
import com.ycl.jxkg.vo.admin.user.UserEventPageRequestVO;
src/main/java/com/ycl/jxkg/mapper/UserMapper.java
@@ -1,5 +1,6 @@
package com.ycl.jxkg.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ycl.jxkg.domain.other.KeyValue;
import com.ycl.jxkg.domain.User;
import com.ycl.jxkg.vo.admin.user.UserPageRequestVO;
src/main/java/com/ycl/jxkg/mapper/UserTokenMapper.java
@@ -1,5 +1,6 @@
package com.ycl.jxkg.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ycl.jxkg.domain.UserToken;
import org.apache.ibatis.annotations.Mapper;
src/main/java/com/ycl/jxkg/service/BaseService.java
File was deleted
src/main/java/com/ycl/jxkg/service/ExamPaperAnswerService.java
@@ -1,5 +1,6 @@
package com.ycl.jxkg.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ycl.jxkg.domain.ExamPaperAnswer;
import com.ycl.jxkg.domain.ExamPaperAnswerInfo;
import com.ycl.jxkg.domain.User;
@@ -10,7 +11,7 @@
import java.util.List;
public interface ExamPaperAnswerService extends BaseService<ExamPaperAnswer> {
public interface ExamPaperAnswerService extends IService<ExamPaperAnswer> {
    /**
     * 学生考试记录分页
src/main/java/com/ycl/jxkg/service/ExamPaperQuestionCustomerAnswerService.java
@@ -1,5 +1,6 @@
package com.ycl.jxkg.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ycl.jxkg.domain.ExamPaperQuestionCustomerAnswer;
import com.ycl.jxkg.domain.other.ExamPaperAnswerUpdate;
import com.ycl.jxkg.vo.student.exam.ExamPaperSubmitItemVO;
@@ -8,7 +9,7 @@
import java.util.List;
public interface ExamPaperQuestionCustomerAnswerService extends BaseService<ExamPaperQuestionCustomerAnswer> {
public interface ExamPaperQuestionCustomerAnswerService extends IService<ExamPaperQuestionCustomerAnswer> {
    PageInfo<ExamPaperQuestionCustomerAnswer> studentPage(QuestionPageStudentRequestVO requestVM);
src/main/java/com/ycl/jxkg/service/ExamPaperService.java
@@ -1,5 +1,6 @@
package com.ycl.jxkg.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ycl.jxkg.domain.ExamPaper;
import com.ycl.jxkg.domain.User;
import com.ycl.jxkg.vo.admin.exam.ExamPaperEditRequestVO;
@@ -11,7 +12,7 @@
import java.util.List;
public interface ExamPaperService extends BaseService<ExamPaper> {
public interface ExamPaperService extends IService<ExamPaper> {
    PageInfo<ExamPaper> page(ExamPaperPageRequestVO requestVM);
src/main/java/com/ycl/jxkg/service/QuestionService.java
@@ -1,5 +1,6 @@
package com.ycl.jxkg.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ycl.jxkg.domain.Question;
import com.ycl.jxkg.vo.admin.question.QuestionEditRequestVO;
import com.ycl.jxkg.vo.admin.question.QuestionPageRequestVO;
@@ -7,7 +8,7 @@
import java.util.List;
public interface QuestionService extends BaseService<Question> {
public interface QuestionService extends IService<Question> {
    PageInfo<Question> page(QuestionPageRequestVO requestVM);
src/main/java/com/ycl/jxkg/service/SubjectService.java
@@ -1,12 +1,13 @@
package com.ycl.jxkg.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ycl.jxkg.domain.Subject;
import com.ycl.jxkg.vo.admin.education.SubjectPageRequestVO;
import com.github.pagehelper.PageInfo;
import java.util.List;
public interface SubjectService extends BaseService<Subject> {
public interface SubjectService extends IService<Subject> {
    List<Subject> getSubjectByLevel(Integer level);
src/main/java/com/ycl/jxkg/service/TaskExamCustomerAnswerService.java
@@ -1,5 +1,6 @@
package com.ycl.jxkg.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ycl.jxkg.domain.ExamPaper;
import com.ycl.jxkg.domain.ExamPaperAnswer;
import com.ycl.jxkg.domain.TaskExamCustomerAnswer;
@@ -7,7 +8,7 @@
import java.util.Date;
import java.util.List;
public interface TaskExamCustomerAnswerService extends BaseService<TaskExamCustomerAnswer> {
public interface TaskExamCustomerAnswerService extends IService<TaskExamCustomerAnswer> {
    void insertOrUpdate(ExamPaper examPaper, ExamPaperAnswer examPaperAnswer, Date now);
src/main/java/com/ycl/jxkg/service/TaskExamService.java
@@ -1,5 +1,6 @@
package com.ycl.jxkg.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ycl.jxkg.domain.TaskExam;
import com.ycl.jxkg.domain.User;
import com.ycl.jxkg.vo.admin.task.TaskPageRequestVO;
@@ -8,7 +9,7 @@
import java.util.List;
public interface TaskExamService extends BaseService<TaskExam> {
public interface TaskExamService extends IService<TaskExam> {
    PageInfo<TaskExam> page(TaskPageRequestVO requestVM);
src/main/java/com/ycl/jxkg/service/TextContentService.java
@@ -1,12 +1,13 @@
package com.ycl.jxkg.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ycl.jxkg.domain.TextContent;
import java.util.Date;
import java.util.List;
import java.util.function.Function;
public interface TextContentService extends BaseService<TextContent> {
public interface TextContentService extends IService<TextContent> {
    /**
     * 创建一个TextContent,将内容转化为json,回写到content中,不入库
src/main/java/com/ycl/jxkg/service/UserEventLogService.java
@@ -1,12 +1,13 @@
package com.ycl.jxkg.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ycl.jxkg.domain.UserEventLog;
import com.ycl.jxkg.vo.admin.user.UserEventPageRequestVO;
import com.github.pagehelper.PageInfo;
import java.util.List;
public interface UserEventLogService extends BaseService<UserEventLog> {
public interface UserEventLogService extends IService<UserEventLog> {
    List<UserEventLog> getUserEventLogByUserId(Integer id);
src/main/java/com/ycl/jxkg/service/UserService.java
@@ -1,5 +1,6 @@
package com.ycl.jxkg.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ycl.jxkg.domain.other.KeyValue;
import com.ycl.jxkg.domain.User;
import com.ycl.jxkg.vo.admin.user.UserPageRequestVO;
@@ -8,7 +9,7 @@
import java.util.List;
public interface UserService extends BaseService<User> {
public interface UserService extends IService<User> {
    /**
     * getUsers
src/main/java/com/ycl/jxkg/service/UserTokenService.java
@@ -1,9 +1,10 @@
package com.ycl.jxkg.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ycl.jxkg.domain.User;
import com.ycl.jxkg.domain.UserToken;
public interface UserTokenService extends BaseService<UserToken> {
public interface UserTokenService extends IService<UserToken> {
    /**
     * 微信token绑定
src/main/java/com/ycl/jxkg/service/impl/BaseServiceImpl.java
File was deleted
src/main/java/com/ycl/jxkg/service/impl/ExamPaperAnswerServiceImpl.java
@@ -1,5 +1,6 @@
package com.ycl.jxkg.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ycl.jxkg.domain.*;
import com.ycl.jxkg.domain.enums.ExamPaperAnswerStatusEnum;
import com.ycl.jxkg.domain.enums.ExamPaperTypeEnum;
@@ -24,6 +25,7 @@
import com.ycl.jxkg.vo.student.exampaper.ExamPaperAnswerPageVO;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -34,7 +36,8 @@
import java.util.stream.Collectors;
@Service
public class ExamPaperAnswerServiceImpl extends BaseServiceImpl<ExamPaperAnswer> implements ExamPaperAnswerService {
@RequiredArgsConstructor
public class ExamPaperAnswerServiceImpl extends ServiceImpl<ExamPaperAnswerMapper ,ExamPaperAnswer> implements ExamPaperAnswerService {
    private final ExamPaperAnswerMapper examPaperAnswerMapper;
    private final ExamPaperMapper examPaperMapper;
@@ -43,16 +46,6 @@
    private final ExamPaperQuestionCustomerAnswerService examPaperQuestionCustomerAnswerService;
    private final TaskExamCustomerAnswerMapper taskExamCustomerAnswerMapper;
    @Autowired
    public ExamPaperAnswerServiceImpl(ExamPaperAnswerMapper examPaperAnswerMapper, ExamPaperMapper examPaperMapper, TextContentService textContentService, QuestionMapper questionMapper, ExamPaperQuestionCustomerAnswerService examPaperQuestionCustomerAnswerService, TaskExamCustomerAnswerMapper taskExamCustomerAnswerMapper) {
        super(examPaperAnswerMapper);
        this.examPaperAnswerMapper = examPaperAnswerMapper;
        this.examPaperMapper = examPaperMapper;
        this.textContentService = textContentService;
        this.questionMapper = questionMapper;
        this.examPaperQuestionCustomerAnswerService = examPaperQuestionCustomerAnswerService;
        this.taskExamCustomerAnswerMapper = taskExamCustomerAnswerMapper;
    }
    @Override
    public PageInfo<ExamPaperAnswer> studentPage(ExamPaperAnswerPageVO requestVM) {
@@ -65,7 +58,7 @@
    public ExamPaperAnswerInfo calculateExamPaperAnswer(ExamPaperSubmitVO examPaperSubmitVO, User user) {
        ExamPaperAnswerInfo examPaperAnswerInfo = new ExamPaperAnswerInfo();
        Date now = new Date();
        ExamPaper examPaper = examPaperMapper.selectByPrimaryKey(examPaperSubmitVO.getId());
        ExamPaper examPaper = examPaperMapper.selectById(examPaperSubmitVO.getId());
        ExamPaperTypeEnum paperTypeEnum = ExamPaperTypeEnum.fromCode(examPaper.getPaperType());
        //任务试卷只能做一次
        if (paperTypeEnum == ExamPaperTypeEnum.Task) {
@@ -73,7 +66,7 @@
            if (null != examPaperAnswer)
                return null;
        }
        String frameTextContent = textContentService.selectById(examPaper.getFrameTextContentId()).getContent();
        String frameTextContent = textContentService.getById(examPaper.getFrameTextContentId()).getContent();
        List<ExamPaperTitleItemObject> examPaperTitleItemObjects = JsonUtil.toJsonListObject(frameTextContent, ExamPaperTitleItemObject.class);
        List<Integer> questionIds = examPaperTitleItemObjects.stream().flatMap(t -> t.getQuestionItems().stream().map(q -> q.getId())).collect(Collectors.toList());
        List<Question> questions = questionMapper.selectByIds(questionIds);
@@ -100,7 +93,7 @@
    @Override
    @Transactional
    public String judge(ExamPaperSubmitVO examPaperSubmitVO) {
        ExamPaperAnswer examPaperAnswer = examPaperAnswerMapper.selectByPrimaryKey(examPaperSubmitVO.getId());
        ExamPaperAnswer examPaperAnswer = examPaperAnswerMapper.selectById(examPaperSubmitVO.getId());
        List<ExamPaperSubmitItemVO> judgeItems = examPaperSubmitVO.getAnswerItems().stream().filter(d -> d.getDoRight() == null).collect(Collectors.toList());
        List<ExamPaperAnswerUpdate> examPaperAnswerUpdates = new ArrayList<>(judgeItems.size());
        Integer customerScore = examPaperAnswer.getUserScore();
@@ -120,24 +113,24 @@
        examPaperAnswer.setUserScore(customerScore);
        examPaperAnswer.setQuestionCorrect(questionCorrect);
        examPaperAnswer.setStatus(ExamPaperAnswerStatusEnum.Complete.getCode());
        examPaperAnswerMapper.updateByPrimaryKeySelective(examPaperAnswer);
        examPaperAnswerMapper.updateById(examPaperAnswer);
        examPaperQuestionCustomerAnswerService.updateScore(examPaperAnswerUpdates);
        ExamPaperTypeEnum examPaperTypeEnum = ExamPaperTypeEnum.fromCode(examPaperAnswer.getPaperType());
        switch (examPaperTypeEnum) {
            case Task:
                //任务试卷批改完成后,需要更新任务的状态
                ExamPaper examPaper = examPaperMapper.selectByPrimaryKey(examPaperAnswer.getExamPaperId());
                ExamPaper examPaper = examPaperMapper.selectById(examPaperAnswer.getExamPaperId());
                Integer taskId = examPaper.getTaskExamId();
                Integer userId = examPaperAnswer.getCreateUser();
                TaskExamCustomerAnswer taskExamCustomerAnswer = taskExamCustomerAnswerMapper.getByTUid(taskId, userId);
                TextContent textContent = textContentService.selectById(taskExamCustomerAnswer.getTextContentId());
                TextContent textContent = textContentService.getById(taskExamCustomerAnswer.getTextContentId());
                List<TaskItemAnswerObject> taskItemAnswerObjects = JsonUtil.toJsonListObject(textContent.getContent(), TaskItemAnswerObject.class);
                taskItemAnswerObjects.stream()
                        .filter(d -> d.getExamPaperAnswerId().equals(examPaperAnswer.getId()))
                        .findFirst().ifPresent(taskItemAnswerObject -> taskItemAnswerObject.setStatus(examPaperAnswer.getStatus()));
                textContentService.jsonConvertUpdate(textContent, taskItemAnswerObjects, null);
                textContentService.updateByIdFilter(textContent);
                textContentService.updateById(textContent);
                break;
            default:
                break;
@@ -148,7 +141,7 @@
    @Override
    public ExamPaperSubmitVO examPaperAnswerToVM(Integer id) {
        ExamPaperSubmitVO examPaperSubmitVO = new ExamPaperSubmitVO();
        ExamPaperAnswer examPaperAnswer = examPaperAnswerMapper.selectByPrimaryKey(id);
        ExamPaperAnswer examPaperAnswer = examPaperAnswerMapper.selectById(id);
        examPaperSubmitVO.setId(examPaperAnswer.getId());
        examPaperSubmitVO.setDoTime(examPaperAnswer.getDoTime());
        examPaperSubmitVO.setScore(ExamUtil.scoreToVM(examPaperAnswer.getUserScore()));
src/main/java/com/ycl/jxkg/service/impl/ExamPaperQuestionCustomerAnswerServiceImpl.java
@@ -1,5 +1,6 @@
package com.ycl.jxkg.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ycl.jxkg.domain.ExamPaperQuestionCustomerAnswer;
import com.ycl.jxkg.domain.other.ExamPaperAnswerUpdate;
import com.ycl.jxkg.domain.other.KeyValue;
@@ -15,6 +16,7 @@
import com.ycl.jxkg.vo.student.question.answer.QuestionPageStudentRequestVO;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -23,17 +25,11 @@
import java.util.stream.Collectors;
@Service
public class ExamPaperQuestionCustomerAnswerServiceImpl extends BaseServiceImpl<ExamPaperQuestionCustomerAnswer> implements ExamPaperQuestionCustomerAnswerService {
@RequiredArgsConstructor
public class ExamPaperQuestionCustomerAnswerServiceImpl extends ServiceImpl<ExamPaperQuestionCustomerAnswerMapper, ExamPaperQuestionCustomerAnswer> implements ExamPaperQuestionCustomerAnswerService {
    private final ExamPaperQuestionCustomerAnswerMapper examPaperQuestionCustomerAnswerMapper;
    private final TextContentService textContentService;
    @Autowired
    public ExamPaperQuestionCustomerAnswerServiceImpl(ExamPaperQuestionCustomerAnswerMapper examPaperQuestionCustomerAnswerMapper, TextContentService textContentService) {
        super(examPaperQuestionCustomerAnswerMapper);
        this.examPaperQuestionCustomerAnswerMapper = examPaperQuestionCustomerAnswerMapper;
        this.textContentService = textContentService;
    }
    @Override
@@ -97,13 +93,13 @@
                examPaperSubmitItemVO.setContentArray(ExamUtil.contentToArray(examPaperQuestionCustomerAnswer.getAnswer()));
                break;
            case GapFilling:
                TextContent textContent = textContentService.selectById(examPaperQuestionCustomerAnswer.getTextContentId());
                TextContent textContent = textContentService.getById(examPaperQuestionCustomerAnswer.getTextContentId());
                List<String> correctAnswer = JsonUtil.toJsonListObject(textContent.getContent(), String.class);
                examPaperSubmitItemVO.setContentArray(correctAnswer);
                break;
            default:
                if (QuestionTypeEnum.needSaveTextContent(examPaperQuestionCustomerAnswer.getQuestionType())) {
                    TextContent content = textContentService.selectById(examPaperQuestionCustomerAnswer.getTextContentId());
                    TextContent content = textContentService.getById(examPaperQuestionCustomerAnswer.getTextContentId());
                    examPaperSubmitItemVO.setContent(content.getContent());
                } else {
                    examPaperSubmitItemVO.setContent(examPaperQuestionCustomerAnswer.getAnswer());
src/main/java/com/ycl/jxkg/service/impl/ExamPaperServiceImpl.java
@@ -1,5 +1,7 @@
package com.ycl.jxkg.service.impl;
import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ycl.jxkg.domain.TextContent;
import com.ycl.jxkg.domain.enums.ExamPaperTypeEnum;
import com.ycl.jxkg.domain.exam.ExamPaperQuestionItemObject;
@@ -27,6 +29,7 @@
import com.ycl.jxkg.domain.ExamPaper;
import com.ycl.jxkg.domain.Question;
import com.ycl.jxkg.domain.User;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -36,26 +39,18 @@
import java.util.Date;
import java.util.List;
import java.util.concurrent.atomic.AtomicInteger;
import java.util.function.Function;
import java.util.stream.Collectors;
@Service
public class ExamPaperServiceImpl extends BaseServiceImpl<ExamPaper> implements ExamPaperService {
@RequiredArgsConstructor
public class ExamPaperServiceImpl extends ServiceImpl<ExamPaperMapper, ExamPaper> implements ExamPaperService {
    private final ExamPaperMapper examPaperMapper;
    private final QuestionMapper questionMapper;
    private final TextContentService textContentService;
    private final QuestionService questionService;
    private final SubjectService subjectService;
    @Autowired
    public ExamPaperServiceImpl(ExamPaperMapper examPaperMapper, QuestionMapper questionMapper, TextContentService textContentService, QuestionService questionService, SubjectService subjectService) {
        super(examPaperMapper);
        this.examPaperMapper = examPaperMapper;
        this.questionMapper = questionMapper;
        this.textContentService = textContentService;
        this.questionService = questionService;
        this.subjectService = subjectService;
    }
    @Override
@@ -92,31 +87,31 @@
            TextContent frameTextContent = new TextContent();
            frameTextContent.setContent(frameTextContentStr);
            frameTextContent.setCreateTime(now);
            textContentService.insertByFilter(frameTextContent);
            textContentService.save(frameTextContent);
            examPaper.setFrameTextContentId(frameTextContent.getId());
            examPaper.setCreateTime(now);
            examPaper.setCreateUser(user.getId());
            examPaper.setDeleted(false);
            examPaperFromVM(examPaperEditRequestVO, examPaper, titleItemsVM);
            examPaperMapper.insertSelective(examPaper);
            examPaperMapper.insert(examPaper);
        } else {
            examPaper = examPaperMapper.selectByPrimaryKey(examPaperEditRequestVO.getId());
            TextContent frameTextContent = textContentService.selectById(examPaper.getFrameTextContentId());
            examPaper = examPaperMapper.selectById(examPaperEditRequestVO.getId());
            TextContent frameTextContent = textContentService.getById(examPaper.getFrameTextContentId());
            frameTextContent.setContent(frameTextContentStr);
            textContentService.updateByIdFilter(frameTextContent);
            textContentService.updateById(frameTextContent);
            examPaperFromVM(examPaperEditRequestVO, examPaper, titleItemsVM);
            examPaperMapper.updateByPrimaryKeySelective(examPaper);
            examPaperMapper.updateById(examPaper);
        }
        return examPaper;
    }
    @Override
    public ExamPaperEditRequestVO examPaperToVM(Integer id) {
        ExamPaper examPaper = examPaperMapper.selectByPrimaryKey(id);
        ExamPaper examPaper = examPaperMapper.selectById(id);
        ExamPaperEditRequestVO vo = new ExamPaperEditRequestVO();
        BeanUtils.copyProperties(examPaper, vo);
        vo.setLevel(examPaper.getGradeLevel());
        TextContent frameTextContent = textContentService.selectById(examPaper.getFrameTextContentId());
        TextContent frameTextContent = textContentService.getById(examPaper.getFrameTextContentId());
        List<ExamPaperTitleItemObject> examPaperTitleItemObjects = JsonUtil.toJsonListObject(frameTextContent.getContent(), ExamPaperTitleItemObject.class);
        List<Integer> questionIds = examPaperTitleItemObjects.stream()
                .flatMap(t -> t.getQuestionItems().stream()
@@ -202,4 +197,6 @@
            return titleItem;
        }).collect(Collectors.toList());
    }
}
src/main/java/com/ycl/jxkg/service/impl/MessageServiceImpl.java
@@ -55,7 +55,7 @@
    @Override
    @Transactional
    public void sendMessage(Message message, List<MessageUser> messageUsers) {
        messageMapper.insertSelective(message);
        messageMapper.insert(message);
        messageUsers.forEach(d -> d.setMessageId(message.getId()));
        messageUserMapper.inserts(messageUsers);
    }
@@ -63,12 +63,12 @@
    @Override
    @Transactional
    public void read(Integer id) {
        MessageUser messageUser = messageUserMapper.selectByPrimaryKey(id);
        MessageUser messageUser = messageUserMapper.selectById(id);
        if (messageUser.getReaded())
            return;
        messageUser.setReaded(true);
        messageUser.setReadTime(new Date());
        messageUserMapper.updateByPrimaryKeySelective(messageUser);
        messageUserMapper.updateById(messageUser);
        messageMapper.readAdd(messageUser.getMessageId());
    }
@@ -79,8 +79,8 @@
    @Override
    public Message messageDetail(Integer id) {
        MessageUser messageUser = messageUserMapper.selectByPrimaryKey(id);
        return messageMapper.selectByPrimaryKey(messageUser.getMessageId());
        MessageUser messageUser = messageUserMapper.selectById(id);
        return messageMapper.selectById(messageUser.getMessageId());
    }
}
src/main/java/com/ycl/jxkg/service/impl/QuestionServiceImpl.java
@@ -1,5 +1,6 @@
package com.ycl.jxkg.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ycl.jxkg.domain.other.KeyValue;
import com.ycl.jxkg.domain.Question;
import com.ycl.jxkg.domain.TextContent;
@@ -19,6 +20,7 @@
import com.ycl.jxkg.vo.admin.question.QuestionPageRequestVO;
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;
@@ -29,19 +31,13 @@
import java.util.stream.Collectors;
@Service
public class QuestionServiceImpl extends BaseServiceImpl<Question> implements QuestionService {
@RequiredArgsConstructor
public class QuestionServiceImpl extends ServiceImpl<QuestionMapper, Question> implements QuestionService {
    private final QuestionMapper questionMapper;
    private final TextContentService textContentService;
    private final SubjectService subjectService;
    @Autowired
    public QuestionServiceImpl(QuestionMapper questionMapper, TextContentService textContentService, SubjectService subjectService) {
        super(questionMapper);
        this.textContentService = textContentService;
        this.questionMapper = questionMapper;
        this.subjectService = subjectService;
    }
    @Override
    public PageInfo<Question> page(QuestionPageRequestVO requestVM) {
@@ -61,7 +57,7 @@
        TextContent infoTextContent = new TextContent();
        infoTextContent.setCreateTime(now);
        setQuestionInfoFromVM(infoTextContent, model);
        textContentService.insertByFilter(infoTextContent);
        textContentService.save(infoTextContent);
        Question question = new Question();
        question.setSubjectId(model.getSubjectId());
@@ -75,7 +71,7 @@
        question.setInfoTextContentId(infoTextContent.getId());
        question.setCreateUser(userId);
        question.setDeleted(false);
        questionMapper.insertSelective(question);
        questionMapper.insert(question);
        return question;
    }
@@ -83,18 +79,18 @@
    @Transactional
    public Question updateFullQuestion(QuestionEditRequestVO model) {
        Integer gradeLevel = subjectService.levelBySubjectId(model.getSubjectId());
        Question question = questionMapper.selectByPrimaryKey(model.getId());
        Question question = questionMapper.selectById(model.getId());
        question.setSubjectId(model.getSubjectId());
        question.setGradeLevel(gradeLevel);
        question.setScore(ExamUtil.scoreFromVM(model.getScore()));
        question.setDifficult(model.getDifficult());
        question.setCorrectFromVM(model.getCorrect(), model.getCorrectArray());
        questionMapper.updateByPrimaryKeySelective(question);
        questionMapper.updateById(question);
        //题干、解析、选项等 更新
        TextContent infoTextContent = textContentService.selectById(question.getInfoTextContentId());
        TextContent infoTextContent = textContentService.getById(question.getInfoTextContentId());
        setQuestionInfoFromVM(infoTextContent, model);
        textContentService.updateByIdFilter(infoTextContent);
        textContentService.updateById(infoTextContent);
        return question;
    }
@@ -102,14 +98,14 @@
    @Override
    public QuestionEditRequestVO getQuestionEditRequestVM(Integer questionId) {
        //题目映射
        Question question = questionMapper.selectByPrimaryKey(questionId);
        Question question = questionMapper.selectById(questionId);
        return getQuestionEditRequestVM(question);
    }
    @Override
    public QuestionEditRequestVO getQuestionEditRequestVM(Question question) {
        //题目映射
        TextContent questionInfoTextContent = textContentService.selectById(question.getInfoTextContentId());
        TextContent questionInfoTextContent = textContentService.getById(question.getInfoTextContentId());
        QuestionObject questionObject = JsonUtil.toJsonObject(questionInfoTextContent.getContent(), QuestionObject.class);
        QuestionEditRequestVO questionEditRequestVO = new QuestionEditRequestVO();
        BeanUtils.copyProperties(question, questionEditRequestVO);
src/main/java/com/ycl/jxkg/service/impl/SubjectServiceImpl.java
@@ -1,36 +1,23 @@
package com.ycl.jxkg.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ycl.jxkg.domain.Subject;
import com.ycl.jxkg.mapper.SubjectMapper;
import com.ycl.jxkg.service.SubjectService;
import com.ycl.jxkg.vo.admin.education.SubjectPageRequestVO;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
@Service
public class SubjectServiceImpl extends BaseServiceImpl<Subject> implements SubjectService {
@RequiredArgsConstructor
public class SubjectServiceImpl extends ServiceImpl<SubjectMapper,Subject> implements SubjectService {
    private final SubjectMapper subjectMapper;
    @Autowired
    public SubjectServiceImpl(SubjectMapper subjectMapper) {
        super(subjectMapper);
        this.subjectMapper = subjectMapper;
    }
    @Override
    public Subject selectById(Integer id) {
        return super.selectById(id);
    }
    @Override
    public int updateByIdFilter(Subject record) {
        return super.updateByIdFilter(record);
    }
    @Override
    public List<Subject> getSubjectByLevel(Integer level) {
@@ -44,7 +31,7 @@
    @Override
    public Integer levelBySubjectId(Integer id) {
        return this.selectById(id).getLevel();
        return baseMapper.selectById(id).getLevel();
    }
    @Override
src/main/java/com/ycl/jxkg/service/impl/TaskExamCustomerAnswerImpl.java
@@ -1,5 +1,6 @@
package com.ycl.jxkg.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ycl.jxkg.domain.ExamPaper;
import com.ycl.jxkg.domain.ExamPaperAnswer;
import com.ycl.jxkg.domain.TaskExamCustomerAnswer;
@@ -9,6 +10,7 @@
import com.ycl.jxkg.service.TaskExamCustomerAnswerService;
import com.ycl.jxkg.service.TextContentService;
import com.ycl.jxkg.utils.JsonUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -17,17 +19,11 @@
import java.util.List;
@Service
public class TaskExamCustomerAnswerImpl extends BaseServiceImpl<TaskExamCustomerAnswer> implements TaskExamCustomerAnswerService {
@RequiredArgsConstructor
public class TaskExamCustomerAnswerImpl extends ServiceImpl<TaskExamCustomerAnswerMapper, TaskExamCustomerAnswer> implements TaskExamCustomerAnswerService {
    private final TaskExamCustomerAnswerMapper taskExamCustomerAnswerMapper;
    private final TextContentService textContentService;
    @Autowired
    public TaskExamCustomerAnswerImpl(TaskExamCustomerAnswerMapper taskExamCustomerAnswerMapper, TextContentService textContentService) {
        super(taskExamCustomerAnswerMapper);
        this.taskExamCustomerAnswerMapper = taskExamCustomerAnswerMapper;
        this.textContentService = textContentService;
    }
    @Override
    public void insertOrUpdate(ExamPaper examPaper, ExamPaperAnswer examPaperAnswer, Date now) {
@@ -45,11 +41,11 @@
            taskItemAnswerObject.setStatus(examPaperAnswer.getStatus());
            List<TaskItemAnswerObject> taskItemAnswerObjects = Arrays.asList(taskItemAnswerObject);
            TextContent textContent = textContentService.jsonConvertInsert(taskItemAnswerObjects, now, null);
            textContentService.insertByFilter(textContent);
            textContentService.save(textContent);
            taskExamCustomerAnswer.setTextContentId(textContent.getId());
            insertByFilter(taskExamCustomerAnswer);
            baseMapper.insert(taskExamCustomerAnswer);
        } else {
            TextContent textContent = textContentService.selectById(taskExamCustomerAnswer.getTextContentId());
            TextContent textContent = textContentService.getById(taskExamCustomerAnswer.getTextContentId());
            List<TaskItemAnswerObject> taskItemAnswerObjects = JsonUtil.toJsonListObject(textContent.getContent(), TaskItemAnswerObject.class);
            TaskItemAnswerObject taskItemAnswerObject = new TaskItemAnswerObject();
            taskItemAnswerObject.setExamPaperId(examPaperAnswer.getExamPaperId());
@@ -57,7 +53,7 @@
            taskItemAnswerObject.setStatus(examPaperAnswer.getStatus());
            taskItemAnswerObjects.add(taskItemAnswerObject);
            textContentService.jsonConvertUpdate(textContent, taskItemAnswerObjects, null);
            textContentService.updateByIdFilter(textContent);
            textContentService.updateById(textContent);
        }
    }
src/main/java/com/ycl/jxkg/service/impl/TaskExamServiceImpl.java
@@ -1,5 +1,6 @@
package com.ycl.jxkg.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ycl.jxkg.domain.ExamPaper;
import com.ycl.jxkg.domain.TaskExam;
import com.ycl.jxkg.domain.TextContent;
@@ -17,6 +18,7 @@
import com.ycl.jxkg.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;
@@ -28,19 +30,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) {
@@ -70,17 +65,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());
            //清空试卷任务的试卷Id,后面会统一设置
            List<Integer> paperIds = JsonUtil.toJsonListObject(textContent.getContent(), TaskItemObject.class)
                    .stream()
@@ -95,8 +90,8 @@
                taskItemObject.setExamPaperName(p.getName());
                return taskItemObject;
            });
            textContentService.updateByIdFilter(textContent);
            taskExamMapper.updateByPrimaryKeySelective(old);
            textContentService.updateById(textContent);
            taskExamMapper.updateById(old);
        }
        //更新试卷的taskId
@@ -107,12 +102,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()));
src/main/java/com/ycl/jxkg/service/impl/TextContentServiceImpl.java
@@ -1,9 +1,11 @@
package com.ycl.jxkg.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ycl.jxkg.domain.TextContent;
import com.ycl.jxkg.mapper.TextContentMapper;
import com.ycl.jxkg.service.TextContentService;
import com.ycl.jxkg.utils.JsonUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -13,29 +15,21 @@
import java.util.stream.Collectors;
@Service
public class TextContentServiceImpl extends BaseServiceImpl<TextContent> implements TextContentService {
@RequiredArgsConstructor
public class TextContentServiceImpl extends ServiceImpl<TextContentMapper, TextContent> implements TextContentService {
    private final TextContentMapper textContentMapper;
    @Autowired
    public TextContentServiceImpl(TextContentMapper textContentMapper) {
        super(textContentMapper);
        this.textContentMapper = textContentMapper;
    }
    @Override
    public TextContent selectById(Integer id) {
        return super.selectById(id);
        return baseMapper.selectById(id);
    }
    @Override
    public int insertByFilter(TextContent record) {
        return super.insertByFilter(record);
        return baseMapper.insert(record);
    }
    @Override
    public int updateByIdFilter(TextContent record) {
        return super.updateByIdFilter(record);
        return baseMapper.updateById(record);
    }
    @Override
src/main/java/com/ycl/jxkg/service/impl/UserEventLogServiceImpl.java
@@ -1,5 +1,6 @@
package com.ycl.jxkg.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ycl.jxkg.domain.UserEventLog;
import com.ycl.jxkg.domain.other.KeyValue;
import com.ycl.jxkg.mapper.UserEventLogMapper;
@@ -8,6 +9,7 @@
import com.ycl.jxkg.vo.admin.user.UserEventPageRequestVO;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -16,15 +18,10 @@
import java.util.stream.Collectors;
@Service
public class UserEventLogServiceImpl extends BaseServiceImpl<UserEventLog> implements UserEventLogService {
@RequiredArgsConstructor
public class UserEventLogServiceImpl extends ServiceImpl<UserEventLogMapper, UserEventLog> implements UserEventLogService {
    private final UserEventLogMapper userEventLogMapper;
    @Autowired
    public UserEventLogServiceImpl(UserEventLogMapper userEventLogMapper) {
        super(userEventLogMapper);
        this.userEventLogMapper = userEventLogMapper;
    }
    @Override
    public List<UserEventLog> getUserEventLogByUserId(Integer id) {
src/main/java/com/ycl/jxkg/service/impl/UserServiceImpl.java
@@ -1,5 +1,6 @@
package com.ycl.jxkg.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ycl.jxkg.domain.other.KeyValue;
import com.ycl.jxkg.exception.BusinessException;
import com.ycl.jxkg.domain.User;
@@ -9,6 +10,7 @@
import com.ycl.jxkg.vo.admin.user.UserPageRequestVO;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.ApplicationEventPublisher;
import org.springframework.stereotype.Service;
@@ -20,47 +22,31 @@
@Service
public class UserServiceImpl extends BaseServiceImpl<User> implements UserService {
@RequiredArgsConstructor
public class UserServiceImpl extends ServiceImpl<UserMapper, User> implements UserService {
    private final UserMapper userMapper;
    private final ApplicationEventPublisher eventPublisher;
    @Autowired
    public UserServiceImpl(UserMapper userMapper, ApplicationEventPublisher eventPublisher) {
        super(userMapper);
        this.userMapper = userMapper;
        this.eventPublisher = eventPublisher;
    }
    @Override
    public List<User> getUsers() {
        return userMapper.getAllUser();
    }
    @Override
    public User getUserById(Integer id) {
        return userMapper.getUserById(id);
    }
    @Override
    public User getUserByUserName(String username) {
        return userMapper.getUserByUserName(username);
    }
    @Override
    public int insertByFilter(User record) {
        return super.insertByFilter(record);
        return baseMapper.insert(record);
    }
    @Override
    public int updateByIdFilter(User record) {
        return super.updateByIdFilter(record);
    }
    @Override
    public int updateById(User record) {
        return super.updateById(record);
        return baseMapper.updateById(record);
    }
    @Override
@@ -100,7 +86,7 @@
    @Override
    public void insertUser(User user) {
        userMapper.insertSelective(user);
        userMapper.insert(user);
        eventPublisher.publishEvent(new OnRegistrationCompleteEvent(user));
    }
@@ -155,6 +141,6 @@
        User changePictureUser = new User();
        changePictureUser.setId(user.getId());
        changePictureUser.setImagePath(imagePath);
        userMapper.updateByPrimaryKeySelective(changePictureUser);
        userMapper.updateById(changePictureUser);
    }
}
src/main/java/com/ycl/jxkg/service/impl/UserTokenServiceImpl.java
@@ -1,5 +1,6 @@
package com.ycl.jxkg.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ycl.jxkg.config.property.SystemConfig;
import com.ycl.jxkg.domain.User;
import com.ycl.jxkg.domain.UserToken;
@@ -7,6 +8,7 @@
import com.ycl.jxkg.service.UserService;
import com.ycl.jxkg.service.UserTokenService;
import com.ycl.jxkg.utils.DateTimeUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
@@ -15,26 +17,19 @@
import java.util.UUID;
@Service
public class UserTokenServiceImpl extends BaseServiceImpl<UserToken> implements UserTokenService {
@RequiredArgsConstructor
public class UserTokenServiceImpl extends ServiceImpl<UserTokenMapper, UserToken> implements UserTokenService {
    private final UserTokenMapper userTokenMapper;
    private final UserService userService;
    private final SystemConfig systemConfig;
    @Autowired
    public UserTokenServiceImpl(UserTokenMapper userTokenMapper, UserService userService, SystemConfig systemConfig) {
        super(userTokenMapper);
        this.userTokenMapper = userTokenMapper;
        this.userService = userService;
        this.systemConfig = systemConfig;
    }
    @Override
    @Transactional
    public UserToken bind(User user) {
        user.setModifyTime(new Date());
        userService.updateByIdFilter(user);
        userService.updateById(user);
        return insertUserToken(user);
    }
@@ -64,18 +59,18 @@
        userToken.setCreateTime(startTime);
        userToken.setEndTime(endTime);
        userToken.setUserName(user.getUserName());
        userService.updateByIdFilter(user);
        userTokenMapper.insertSelective(userToken);
        userService.updateById(user);
        userTokenMapper.insert(userToken);
        return userToken;
    }
    @Override
    public void unBind(UserToken userToken) {
        User user = userService.selectById(userToken.getUserId());
        User user = userService.getById(userToken.getUserId());
        user.setModifyTime(new Date());
        user.setWxOpenId(null);
        userService.updateById(user);
        userTokenMapper.deleteByPrimaryKey(userToken.getId());
        userTokenMapper.deleteById(userToken.getId());
    }
}
src/main/resources/mapper/ExamPaperAnswerMapper.xml
@@ -1,266 +1,80 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ycl.jxkg.mapper.ExamPaperAnswerMapper">
  <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.ExamPaperAnswer">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="exam_paper_id" jdbcType="INTEGER" property="examPaperId" />
    <result column="paper_name" jdbcType="VARCHAR" property="paperName" />
    <result column="paper_type" jdbcType="INTEGER" property="paperType" />
    <result column="subject_id" jdbcType="INTEGER" property="subjectId" />
    <result column="system_score" jdbcType="INTEGER" property="systemScore" />
    <result column="user_score" jdbcType="INTEGER" property="userScore" />
    <result column="paper_score" jdbcType="INTEGER" property="paperScore" />
    <result column="question_correct" jdbcType="INTEGER" property="questionCorrect" />
    <result column="question_count" jdbcType="INTEGER" property="questionCount" />
    <result column="do_time" jdbcType="INTEGER" property="doTime" />
    <result column="status" jdbcType="INTEGER" property="status" />
    <result column="create_user" jdbcType="INTEGER" property="createUser" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="task_exam_id" jdbcType="INTEGER" property="taskExamId" />
  </resultMap>
  <sql id="Base_Column_List">
    id, exam_paper_id, paper_name, paper_type, subject_id, system_score, user_score,
    <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.ExamPaperAnswer">
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="exam_paper_id" jdbcType="INTEGER" property="examPaperId"/>
        <result column="paper_name" jdbcType="VARCHAR" property="paperName"/>
        <result column="paper_type" jdbcType="INTEGER" property="paperType"/>
        <result column="subject_id" jdbcType="INTEGER" property="subjectId"/>
        <result column="system_score" jdbcType="INTEGER" property="systemScore"/>
        <result column="user_score" jdbcType="INTEGER" property="userScore"/>
        <result column="paper_score" jdbcType="INTEGER" property="paperScore"/>
        <result column="question_correct" jdbcType="INTEGER" property="questionCorrect"/>
        <result column="question_count" jdbcType="INTEGER" property="questionCount"/>
        <result column="do_time" jdbcType="INTEGER" property="doTime"/>
        <result column="status" jdbcType="INTEGER" property="status"/>
        <result column="create_user" jdbcType="INTEGER" property="createUser"/>
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
        <result column="task_exam_id" jdbcType="INTEGER" property="taskExamId"/>
    </resultMap>
    <sql id="Base_Column_List">
        id
        , exam_paper_id, paper_name, paper_type, subject_id, system_score, user_score,
    paper_score, question_correct, question_count, do_time, status, create_user, create_time,
    task_exam_id
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from t_exam_paper_answer
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from t_exam_paper_answer
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.ycl.jxkg.domain.ExamPaperAnswer" useGeneratedKeys="true" keyProperty="id">
    insert into t_exam_paper_answer (id, exam_paper_id, paper_name,
      paper_type, subject_id, system_score,
      user_score, paper_score, question_correct,
      question_count, do_time, status,
      create_user, create_time, task_exam_id
      )
    values (#{id,jdbcType=INTEGER}, #{examPaperId,jdbcType=INTEGER}, #{paperName,jdbcType=VARCHAR},
      #{paperType,jdbcType=INTEGER}, #{subjectId,jdbcType=INTEGER}, #{systemScore,jdbcType=INTEGER},
      #{userScore,jdbcType=INTEGER}, #{paperScore,jdbcType=INTEGER}, #{questionCorrect,jdbcType=INTEGER},
      #{questionCount,jdbcType=INTEGER}, #{doTime,jdbcType=INTEGER}, #{status,jdbcType=INTEGER},
      #{createUser,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{taskExamId,jdbcType=INTEGER}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.ycl.jxkg.domain.ExamPaperAnswer" useGeneratedKeys="true" keyProperty="id">
    insert into t_exam_paper_answer
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="examPaperId != null">
        exam_paper_id,
      </if>
      <if test="paperName != null">
        paper_name,
      </if>
      <if test="paperType != null">
        paper_type,
      </if>
      <if test="subjectId != null">
        subject_id,
      </if>
      <if test="systemScore != null">
        system_score,
      </if>
      <if test="userScore != null">
        user_score,
      </if>
      <if test="paperScore != null">
        paper_score,
      </if>
      <if test="questionCorrect != null">
        question_correct,
      </if>
      <if test="questionCount != null">
        question_count,
      </if>
      <if test="doTime != null">
        do_time,
      </if>
      <if test="status != null">
        status,
      </if>
      <if test="createUser != null">
        create_user,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="taskExamId != null">
        task_exam_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="examPaperId != null">
        #{examPaperId,jdbcType=INTEGER},
      </if>
      <if test="paperName != null">
        #{paperName,jdbcType=VARCHAR},
      </if>
      <if test="paperType != null">
        #{paperType,jdbcType=INTEGER},
      </if>
      <if test="subjectId != null">
        #{subjectId,jdbcType=INTEGER},
      </if>
      <if test="systemScore != null">
        #{systemScore,jdbcType=INTEGER},
      </if>
      <if test="userScore != null">
        #{userScore,jdbcType=INTEGER},
      </if>
      <if test="paperScore != null">
        #{paperScore,jdbcType=INTEGER},
      </if>
      <if test="questionCorrect != null">
        #{questionCorrect,jdbcType=INTEGER},
      </if>
      <if test="questionCount != null">
        #{questionCount,jdbcType=INTEGER},
      </if>
      <if test="doTime != null">
        #{doTime,jdbcType=INTEGER},
      </if>
      <if test="status != null">
        #{status,jdbcType=INTEGER},
      </if>
      <if test="createUser != null">
        #{createUser,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="taskExamId != null">
        #{taskExamId,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.ycl.jxkg.domain.ExamPaperAnswer">
    update t_exam_paper_answer
    <set>
      <if test="examPaperId != null">
        exam_paper_id = #{examPaperId,jdbcType=INTEGER},
      </if>
      <if test="paperName != null">
        paper_name = #{paperName,jdbcType=VARCHAR},
      </if>
      <if test="paperType != null">
        paper_type = #{paperType,jdbcType=INTEGER},
      </if>
      <if test="subjectId != null">
        subject_id = #{subjectId,jdbcType=INTEGER},
      </if>
      <if test="systemScore != null">
        system_score = #{systemScore,jdbcType=INTEGER},
      </if>
      <if test="userScore != null">
        user_score = #{userScore,jdbcType=INTEGER},
      </if>
      <if test="paperScore != null">
        paper_score = #{paperScore,jdbcType=INTEGER},
      </if>
      <if test="questionCorrect != null">
        question_correct = #{questionCorrect,jdbcType=INTEGER},
      </if>
      <if test="questionCount != null">
        question_count = #{questionCount,jdbcType=INTEGER},
      </if>
      <if test="doTime != null">
        do_time = #{doTime,jdbcType=INTEGER},
      </if>
      <if test="status != null">
        status = #{status,jdbcType=INTEGER},
      </if>
      <if test="createUser != null">
        create_user = #{createUser,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="taskExamId != null">
        task_exam_id = #{taskExamId,jdbcType=INTEGER},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.ycl.jxkg.domain.ExamPaperAnswer">
    update t_exam_paper_answer
    set exam_paper_id = #{examPaperId,jdbcType=INTEGER},
      paper_name = #{paperName,jdbcType=VARCHAR},
      paper_type = #{paperType,jdbcType=INTEGER},
      subject_id = #{subjectId,jdbcType=INTEGER},
      system_score = #{systemScore,jdbcType=INTEGER},
      user_score = #{userScore,jdbcType=INTEGER},
      paper_score = #{paperScore,jdbcType=INTEGER},
      question_correct = #{questionCorrect,jdbcType=INTEGER},
      question_count = #{questionCount,jdbcType=INTEGER},
      do_time = #{doTime,jdbcType=INTEGER},
      status = #{status,jdbcType=INTEGER},
      create_user = #{createUser,jdbcType=INTEGER},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      task_exam_id = #{taskExamId,jdbcType=INTEGER}
    where id = #{id,jdbcType=INTEGER}
  </update>
    </sql>
    <select id="studentPage" resultMap="BaseResultMap"
            parameterType="com.ycl.jxkg.vo.student.exampaper.ExamPaperAnswerPageVO">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_exam_paper_answer
        <where>
            and create_user = #{createUser}
            <if test="subjectId != null">
                and subject_id = #{subjectId}
            </if>
        </where>
    </select>
    <select id="selectAllCount" resultType="java.lang.Integer">
        SELECT count(*)
        from t_exam_paper_answer
    </select>
  <select id="studentPage" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.vo.student.exampaper.ExamPaperAnswerPageVO">
    SELECT
    <include refid="Base_Column_List"/>
    FROM t_exam_paper_answer
    <where>
        and create_user = #{createUser}
     <if test="subjectId != null">
         and subject_id = #{subjectId}
     </if>
    </where>
  </select>
    <select id="selectCountByDate" resultType="com.ycl.jxkg.domain.other.KeyValue">
        SELECT create_time as name, COUNT(create_time) as value
        from
            (
            SELECT DATE_FORMAT(create_time, '%Y-%m-%d') as create_time from t_exam_paper_answer
            WHERE create_time between #{startTime} and #{endTime}
            ) a
        GROUP BY create_time
    </select>
  <select id="selectAllCount"  resultType="java.lang.Integer">
        SELECT count(*) from t_exam_paper_answer
  </select>
    <select id="getByPidUid" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from t_exam_paper_answer
        where exam_paper_id = #{pid} and create_user=#{uid}
        limit 1
    </select>
  <select id="selectCountByDate"  resultType="com.ycl.jxkg.domain.other.KeyValue">
        SELECT create_time as name,COUNT(create_time) as value from
                (
                  SELECT DATE_FORMAT(create_time,'%Y-%m-%d') as create_time from t_exam_paper_answer
                    WHERE  create_time  between  #{startTime}  and  #{endTime}
                ) a
        GROUP BY create_time
    </select>
  <select id="getByPidUid" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from t_exam_paper_answer
    where exam_paper_id = #{pid} and create_user=#{uid}
    limit 1
  </select>
  <select id="adminPage" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.vo.admin.paper.ExamPaperAnswerPageRequestVO">
    SELECT
    <include refid="Base_Column_List"/>
    FROM t_exam_paper_answer
    <where>
      <if test="subjectId != null">
        and subject_id = #{subjectId}
      </if>
    </where>
  </select>
    <select id="adminPage" resultMap="BaseResultMap"
            parameterType="com.ycl.jxkg.vo.admin.paper.ExamPaperAnswerPageRequestVO">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_exam_paper_answer
        <where>
            <if test="subjectId != null">
                and subject_id = #{subjectId}
            </if>
        </where>
    </select>
</mapper>
src/main/resources/mapper/ExamPaperMapper.xml
@@ -1,331 +1,136 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ycl.jxkg.mapper.ExamPaperMapper">
  <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.ExamPaper">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="subject_id" jdbcType="INTEGER" property="subjectId" />
    <result column="paper_type" jdbcType="INTEGER" property="paperType" />
    <result column="grade_level" jdbcType="INTEGER" property="gradeLevel" />
    <result column="score" jdbcType="INTEGER" property="score" />
    <result column="question_count" jdbcType="INTEGER" property="questionCount" />
    <result column="suggest_time" jdbcType="INTEGER" property="suggestTime" />
    <result column="limit_start_time" jdbcType="TIMESTAMP" property="limitStartTime" />
    <result column="limit_end_time" jdbcType="TIMESTAMP" property="limitEndTime" />
    <result column="frame_text_content_id" jdbcType="INTEGER" property="frameTextContentId" />
    <result column="create_user" jdbcType="INTEGER" property="createUser" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="deleted" jdbcType="BIT" property="deleted" />
    <result column="task_exam_id" jdbcType="INTEGER" property="taskExamId" />
  </resultMap>
  <sql id="Base_Column_List">
    id, name, subject_id, paper_type, grade_level, score, question_count, suggest_time,
    <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.ExamPaper">
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="name" jdbcType="VARCHAR" property="name"/>
        <result column="subject_id" jdbcType="INTEGER" property="subjectId"/>
        <result column="paper_type" jdbcType="INTEGER" property="paperType"/>
        <result column="grade_level" jdbcType="INTEGER" property="gradeLevel"/>
        <result column="score" jdbcType="INTEGER" property="score"/>
        <result column="question_count" jdbcType="INTEGER" property="questionCount"/>
        <result column="suggest_time" jdbcType="INTEGER" property="suggestTime"/>
        <result column="limit_start_time" jdbcType="TIMESTAMP" property="limitStartTime"/>
        <result column="limit_end_time" jdbcType="TIMESTAMP" property="limitEndTime"/>
        <result column="frame_text_content_id" jdbcType="INTEGER" property="frameTextContentId"/>
        <result column="create_user" jdbcType="INTEGER" property="createUser"/>
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
        <result column="deleted" jdbcType="BIT" property="deleted"/>
        <result column="task_exam_id" jdbcType="INTEGER" property="taskExamId"/>
    </resultMap>
    <sql id="Base_Column_List">
        id
        , name, subject_id, paper_type, grade_level, score, question_count, suggest_time,
    limit_start_time, limit_end_time, frame_text_content_id, create_user, create_time,
    deleted, task_exam_id
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from t_exam_paper
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from t_exam_paper
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.ycl.jxkg.domain.ExamPaper" useGeneratedKeys="true" keyProperty="id">
    insert into t_exam_paper (id, name, subject_id,
      paper_type, grade_level, score,
      question_count, suggest_time, limit_start_time,
      limit_end_time, frame_text_content_id, create_user,
      create_time, deleted, task_exam_id
      )
    values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{subjectId,jdbcType=INTEGER},
      #{paperType,jdbcType=INTEGER}, #{gradeLevel,jdbcType=INTEGER}, #{score,jdbcType=INTEGER},
      #{questionCount,jdbcType=INTEGER}, #{suggestTime,jdbcType=INTEGER}, #{limitStartTime,jdbcType=TIMESTAMP},
      #{limitEndTime,jdbcType=TIMESTAMP}, #{frameTextContentId,jdbcType=INTEGER}, #{createUser,jdbcType=INTEGER},
      #{createTime,jdbcType=TIMESTAMP}, #{deleted,jdbcType=BIT}, #{taskExamId,jdbcType=INTEGER}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.ycl.jxkg.domain.ExamPaper" useGeneratedKeys="true" keyProperty="id">
    insert into t_exam_paper
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="name != null">
        name,
      </if>
      <if test="subjectId != null">
        subject_id,
      </if>
      <if test="paperType != null">
        paper_type,
      </if>
      <if test="gradeLevel != null">
        grade_level,
      </if>
      <if test="score != null">
        score,
      </if>
      <if test="questionCount != null">
        question_count,
      </if>
      <if test="suggestTime != null">
        suggest_time,
      </if>
      <if test="limitStartTime != null">
        limit_start_time,
      </if>
      <if test="limitEndTime != null">
        limit_end_time,
      </if>
      <if test="frameTextContentId != null">
        frame_text_content_id,
      </if>
      <if test="createUser != null">
        create_user,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="deleted != null">
        deleted,
      </if>
      <if test="taskExamId != null">
        task_exam_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="subjectId != null">
        #{subjectId,jdbcType=INTEGER},
      </if>
      <if test="paperType != null">
        #{paperType,jdbcType=INTEGER},
      </if>
      <if test="gradeLevel != null">
        #{gradeLevel,jdbcType=INTEGER},
      </if>
      <if test="score != null">
        #{score,jdbcType=INTEGER},
      </if>
      <if test="questionCount != null">
        #{questionCount,jdbcType=INTEGER},
      </if>
      <if test="suggestTime != null">
        #{suggestTime,jdbcType=INTEGER},
      </if>
      <if test="limitStartTime != null">
        #{limitStartTime,jdbcType=TIMESTAMP},
      </if>
      <if test="limitEndTime != null">
        #{limitEndTime,jdbcType=TIMESTAMP},
      </if>
      <if test="frameTextContentId != null">
        #{frameTextContentId,jdbcType=INTEGER},
      </if>
      <if test="createUser != null">
        #{createUser,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="deleted != null">
        #{deleted,jdbcType=BIT},
      </if>
      <if test="taskExamId != null">
        #{taskExamId,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.ycl.jxkg.domain.ExamPaper">
    update t_exam_paper
    <set>
      <if test="name != null">
        name = #{name,jdbcType=VARCHAR},
      </if>
      <if test="subjectId != null">
        subject_id = #{subjectId,jdbcType=INTEGER},
      </if>
      <if test="paperType != null">
        paper_type = #{paperType,jdbcType=INTEGER},
      </if>
      <if test="gradeLevel != null">
        grade_level = #{gradeLevel,jdbcType=INTEGER},
      </if>
      <if test="score != null">
        score = #{score,jdbcType=INTEGER},
      </if>
      <if test="questionCount != null">
        question_count = #{questionCount,jdbcType=INTEGER},
      </if>
      <if test="suggestTime != null">
        suggest_time = #{suggestTime,jdbcType=INTEGER},
      </if>
      <if test="limitStartTime != null">
        limit_start_time = #{limitStartTime,jdbcType=TIMESTAMP},
      </if>
      <if test="limitEndTime != null">
        limit_end_time = #{limitEndTime,jdbcType=TIMESTAMP},
      </if>
      <if test="frameTextContentId != null">
        frame_text_content_id = #{frameTextContentId,jdbcType=INTEGER},
      </if>
      <if test="createUser != null">
        create_user = #{createUser,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="deleted != null">
        deleted = #{deleted,jdbcType=BIT},
      </if>
      <if test="taskExamId != null">
        task_exam_id = #{taskExamId,jdbcType=INTEGER},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.ycl.jxkg.domain.ExamPaper">
    update t_exam_paper
    set name = #{name,jdbcType=VARCHAR},
      subject_id = #{subjectId,jdbcType=INTEGER},
      paper_type = #{paperType,jdbcType=INTEGER},
      grade_level = #{gradeLevel,jdbcType=INTEGER},
      score = #{score,jdbcType=INTEGER},
      question_count = #{questionCount,jdbcType=INTEGER},
      suggest_time = #{suggestTime,jdbcType=INTEGER},
      limit_start_time = #{limitStartTime,jdbcType=TIMESTAMP},
      limit_end_time = #{limitEndTime,jdbcType=TIMESTAMP},
      frame_text_content_id = #{frameTextContentId,jdbcType=INTEGER},
      create_user = #{createUser,jdbcType=INTEGER},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      deleted = #{deleted,jdbcType=BIT},
      task_exam_id = #{taskExamId,jdbcType=INTEGER}
    where id = #{id,jdbcType=INTEGER}
  </update>
    </sql>
    <resultMap id="PaperInfoResultMap" type="com.ycl.jxkg.vo.student.dashboard.PaperInfo">
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="name" jdbcType="VARCHAR" property="name"/>
        <result column="limit_start_time" jdbcType="TIMESTAMP" property="limitStartTime"/>
        <result column="limit_end_time" jdbcType="TIMESTAMP" property="limitEndTime"/>
    </resultMap>
    <select id="page" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.vo.admin.exam.ExamPaperPageRequestVO">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_exam_paper
        <where>
            and deleted=0
            <if test="id != null ">
                and id= #{id}
            </if>
            <if test="level != null ">
                and grade_level= #{level}
            </if>
            <if test="subjectId != null ">
                and subject_id= #{subjectId}
            </if>
            <if test="paperType != null ">
                and paper_type= #{paperType}
            </if>
        </where>
    </select>
    <select id="taskExamPage" resultMap="BaseResultMap"
            parameterType="com.ycl.jxkg.vo.admin.exam.ExamPaperPageRequestVO">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_exam_paper
        <where>
            and deleted=0
            and task_exam_id is null
            and grade_level= #{level}
            and paper_type=#{paperType}
        </where>
    </select>
    <select id="studentPage" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.vo.student.exam.ExamPaperPageVO">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_exam_paper
        <where>
            and deleted=0
            <if test="subjectId != null ">
                and subject_id=#{subjectId}
            </if>
            <if test="levelId != null ">
                and grade_level=#{levelId}
            </if>
            and paper_type=#{paperType}
        </where>
    </select>
    <select id="indexPaper" resultMap="PaperInfoResultMap"
            parameterType="com.ycl.jxkg.vo.student.dashboard.PaperFilter">
        SELECT id,name,limit_start_time,limit_end_time
        FROM t_exam_paper
        <where>
            and deleted=0
            and paper_type= #{examPaperType}
            and grade_level=#{gradeLevel}
            <if test="examPaperType == 3 ">
            </if>
            <if test="examPaperType == 4 ">
                and #{dateTime} between limit_start_time and limit_end_time
            </if>
        </where>
        ORDER BY id desc limit 5
    </select>
    <select id="selectAllCount" resultType="java.lang.Integer">
        SELECT count(*)
        from t_exam_paper
        where deleted = 0
    </select>
    <select id="selectCountByDate" resultType="com.ycl.jxkg.domain.other.KeyValue">
        SELECT create_time as name, COUNT(create_time) as value
        from
            (
            SELECT DATE_FORMAT(create_time, '%Y-%m-%d') as create_time from t_exam_paper
            WHERE deleted=0 and create_time between #{startTime} and #{endTime}
            ) a
        GROUP BY create_time
    </select>
  <resultMap id="PaperInfoResultMap" type="com.ycl.jxkg.vo.student.dashboard.PaperInfo">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="limit_start_time" jdbcType="TIMESTAMP" property="limitStartTime" />
    <result column="limit_end_time" jdbcType="TIMESTAMP" property="limitEndTime" />
  </resultMap>
    <update id="updateTaskPaper">
        update t_exam_paper set task_exam_id = #{taskId} where id in
        <foreach item="id" collection="paperIds" open="(" separator=","
                 close=")">
            #{id}
        </foreach>
    </update>
  <select id="page" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.vo.admin.exam.ExamPaperPageRequestVO">
    SELECT
    <include refid="Base_Column_List"/>
    FROM t_exam_paper
    <where>
        and deleted=0
      <if test="id != null ">
        and id= #{id}
      </if>
      <if test="level != null ">
        and grade_level= #{level}
      </if>
      <if test="subjectId != null ">
        and subject_id= #{subjectId}
      </if>
      <if test="paperType != null ">
        and paper_type= #{paperType}
      </if>
    </where>
  </select>
  <select id="taskExamPage" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.vo.admin.exam.ExamPaperPageRequestVO">
    SELECT
    <include refid="Base_Column_List"/>
    FROM t_exam_paper
    <where>
      and deleted=0
      and task_exam_id is null
      and grade_level= #{level}
      and paper_type=#{paperType}
    </where>
  </select>
  <select id="studentPage" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.vo.student.exam.ExamPaperPageVO">
    SELECT
    <include refid="Base_Column_List"/>
    FROM t_exam_paper
    <where>
       and deleted=0
      <if test="subjectId != null ">
        and subject_id=#{subjectId}
      </if>
      <if test="levelId != null ">
        and grade_level=#{levelId}
      </if>
       and paper_type=#{paperType}
    </where>
  </select>
  <select id="indexPaper" resultMap="PaperInfoResultMap" parameterType="com.ycl.jxkg.vo.student.dashboard.PaperFilter">
    SELECT id,name,limit_start_time,limit_end_time
    FROM t_exam_paper
    <where>
      and deleted=0
      and paper_type= #{examPaperType}
      and grade_level=#{gradeLevel}
      <if test="examPaperType == 3 ">
      </if>
      <if test="examPaperType == 4 ">
        and  #{dateTime} between limit_start_time  and limit_end_time
      </if>
    </where>
    ORDER BY id  desc limit 5
  </select>
  <select id="selectAllCount"  resultType="java.lang.Integer">
        SELECT count(*) from t_exam_paper where deleted=0
    </select>
  <select id="selectCountByDate"  resultType="com.ycl.jxkg.domain.other.KeyValue">
        SELECT create_time as name,COUNT(create_time) as value from
                (
                  SELECT DATE_FORMAT(create_time,'%Y-%m-%d') as create_time from t_exam_paper
                    WHERE  deleted=0  and create_time  between  #{startTime}  and  #{endTime}
                ) a
        GROUP BY create_time
    </select>
  <update id="updateTaskPaper">
    update t_exam_paper set task_exam_id = #{taskId} where id in
    <foreach item="id" collection="paperIds" open="(" separator=","
             close=")">
      #{id}
    </foreach>
  </update>
  <update id="clearTaskPaper" parameterType="java.util.List">
    update t_exam_paper set task_exam_id = null where id in
    <foreach item="id" collection="paperIds" open="(" separator=","
             close=")">
      #{id}
    </foreach>
  </update>
    <update id="clearTaskPaper" parameterType="java.util.List">
        update t_exam_paper set task_exam_id = null where id in
        <foreach item="id" collection="paperIds" open="(" separator=","
                 close=")">
            #{id}
        </foreach>
    </update>
</mapper>
src/main/resources/mapper/ExamPaperQuestionCustomerAnswerMapper.xml
@@ -1,282 +1,94 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ycl.jxkg.mapper.ExamPaperQuestionCustomerAnswerMapper">
  <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.ExamPaperQuestionCustomerAnswer">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="question_id" jdbcType="INTEGER" property="questionId" />
    <result column="exam_paper_id" jdbcType="INTEGER" property="examPaperId" />
    <result column="exam_paper_answer_id" jdbcType="INTEGER" property="examPaperAnswerId" />
    <result column="question_type" jdbcType="INTEGER" property="questionType" />
    <result column="subject_id" jdbcType="INTEGER" property="subjectId" />
    <result column="customer_score" jdbcType="INTEGER" property="customerScore" />
    <result column="question_score" jdbcType="INTEGER" property="questionScore" />
    <result column="question_text_content_id" jdbcType="INTEGER" property="questionTextContentId" />
    <result column="answer" jdbcType="VARCHAR" property="answer" />
    <result column="text_content_id" jdbcType="INTEGER" property="textContentId" />
    <result column="do_right" jdbcType="BIT" property="doRight" />
    <result column="create_user" jdbcType="INTEGER" property="createUser" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="item_order" jdbcType="INTEGER" property="itemOrder" />
  </resultMap>
  <sql id="Base_Column_List">
    id, question_id, exam_paper_id, exam_paper_answer_id, question_type, subject_id,
    <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.ExamPaperQuestionCustomerAnswer">
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="question_id" jdbcType="INTEGER" property="questionId"/>
        <result column="exam_paper_id" jdbcType="INTEGER" property="examPaperId"/>
        <result column="exam_paper_answer_id" jdbcType="INTEGER" property="examPaperAnswerId"/>
        <result column="question_type" jdbcType="INTEGER" property="questionType"/>
        <result column="subject_id" jdbcType="INTEGER" property="subjectId"/>
        <result column="customer_score" jdbcType="INTEGER" property="customerScore"/>
        <result column="question_score" jdbcType="INTEGER" property="questionScore"/>
        <result column="question_text_content_id" jdbcType="INTEGER" property="questionTextContentId"/>
        <result column="answer" jdbcType="VARCHAR" property="answer"/>
        <result column="text_content_id" jdbcType="INTEGER" property="textContentId"/>
        <result column="do_right" jdbcType="BIT" property="doRight"/>
        <result column="create_user" jdbcType="INTEGER" property="createUser"/>
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
        <result column="item_order" jdbcType="INTEGER" property="itemOrder"/>
    </resultMap>
    <sql id="Base_Column_List">
        id
        , question_id, exam_paper_id, exam_paper_answer_id, question_type, subject_id,
    customer_score, question_score, question_text_content_id, answer, text_content_id,
    do_right, create_user, create_time, item_order
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from t_exam_paper_question_customer_answer
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from t_exam_paper_question_customer_answer
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.ycl.jxkg.domain.ExamPaperQuestionCustomerAnswer" useGeneratedKeys="true" keyProperty="id">
    insert into t_exam_paper_question_customer_answer (id, question_id, exam_paper_id,
      exam_paper_answer_id, question_type, subject_id,
      customer_score, question_score, question_text_content_id,
      answer, text_content_id, do_right,
      create_user, create_time, item_order
      )
    values (#{id,jdbcType=INTEGER}, #{questionId,jdbcType=INTEGER}, #{examPaperId,jdbcType=INTEGER},
      #{examPaperAnswerId,jdbcType=INTEGER}, #{questionType,jdbcType=INTEGER}, #{subjectId,jdbcType=INTEGER},
      #{customerScore,jdbcType=INTEGER}, #{questionScore,jdbcType=INTEGER}, #{questionTextContentId,jdbcType=INTEGER},
      #{answer,jdbcType=VARCHAR}, #{textContentId,jdbcType=INTEGER}, #{doRight,jdbcType=BIT},
      #{createUser,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{itemOrder,jdbcType=INTEGER}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.ycl.jxkg.domain.ExamPaperQuestionCustomerAnswer" useGeneratedKeys="true" keyProperty="id">
    insert into t_exam_paper_question_customer_answer
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="questionId != null">
        question_id,
      </if>
      <if test="examPaperId != null">
        exam_paper_id,
      </if>
      <if test="examPaperAnswerId != null">
        exam_paper_answer_id,
      </if>
      <if test="questionType != null">
        question_type,
      </if>
      <if test="subjectId != null">
        subject_id,
      </if>
      <if test="customerScore != null">
        customer_score,
      </if>
      <if test="questionScore != null">
        question_score,
      </if>
      <if test="questionTextContentId != null">
        question_text_content_id,
      </if>
      <if test="answer != null">
        answer,
      </if>
      <if test="textContentId != null">
        text_content_id,
      </if>
      <if test="doRight != null">
        do_right,
      </if>
      <if test="createUser != null">
        create_user,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="itemOrder != null">
        item_order,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="questionId != null">
        #{questionId,jdbcType=INTEGER},
      </if>
      <if test="examPaperId != null">
        #{examPaperId,jdbcType=INTEGER},
      </if>
      <if test="examPaperAnswerId != null">
        #{examPaperAnswerId,jdbcType=INTEGER},
      </if>
      <if test="questionType != null">
        #{questionType,jdbcType=INTEGER},
      </if>
      <if test="subjectId != null">
        #{subjectId,jdbcType=INTEGER},
      </if>
      <if test="customerScore != null">
        #{customerScore,jdbcType=INTEGER},
      </if>
      <if test="questionScore != null">
        #{questionScore,jdbcType=INTEGER},
      </if>
      <if test="questionTextContentId != null">
        #{questionTextContentId,jdbcType=INTEGER},
      </if>
      <if test="answer != null">
        #{answer,jdbcType=VARCHAR},
      </if>
      <if test="textContentId != null">
        #{textContentId,jdbcType=INTEGER},
      </if>
      <if test="doRight != null">
        #{doRight,jdbcType=BIT},
      </if>
      <if test="createUser != null">
        #{createUser,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="itemOrder != null">
        #{itemOrder,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.ycl.jxkg.domain.ExamPaperQuestionCustomerAnswer">
    update t_exam_paper_question_customer_answer
    <set>
      <if test="questionId != null">
        question_id = #{questionId,jdbcType=INTEGER},
      </if>
      <if test="examPaperId != null">
        exam_paper_id = #{examPaperId,jdbcType=INTEGER},
      </if>
      <if test="examPaperAnswerId != null">
        exam_paper_answer_id = #{examPaperAnswerId,jdbcType=INTEGER},
      </if>
      <if test="questionType != null">
        question_type = #{questionType,jdbcType=INTEGER},
      </if>
      <if test="subjectId != null">
        subject_id = #{subjectId,jdbcType=INTEGER},
      </if>
      <if test="customerScore != null">
        customer_score = #{customerScore,jdbcType=INTEGER},
      </if>
      <if test="questionScore != null">
        question_score = #{questionScore,jdbcType=INTEGER},
      </if>
      <if test="questionTextContentId != null">
        question_text_content_id = #{questionTextContentId,jdbcType=INTEGER},
      </if>
      <if test="answer != null">
        answer = #{answer,jdbcType=VARCHAR},
      </if>
      <if test="textContentId != null">
        text_content_id = #{textContentId,jdbcType=INTEGER},
      </if>
      <if test="doRight != null">
        do_right = #{doRight,jdbcType=BIT},
      </if>
      <if test="createUser != null">
        create_user = #{createUser,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="itemOrder != null">
        item_order = #{itemOrder,jdbcType=INTEGER},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.ycl.jxkg.domain.ExamPaperQuestionCustomerAnswer">
    update t_exam_paper_question_customer_answer
    set question_id = #{questionId,jdbcType=INTEGER},
      exam_paper_id = #{examPaperId,jdbcType=INTEGER},
      exam_paper_answer_id = #{examPaperAnswerId,jdbcType=INTEGER},
      question_type = #{questionType,jdbcType=INTEGER},
      subject_id = #{subjectId,jdbcType=INTEGER},
      customer_score = #{customerScore,jdbcType=INTEGER},
      question_score = #{questionScore,jdbcType=INTEGER},
      question_text_content_id = #{questionTextContentId,jdbcType=INTEGER},
      answer = #{answer,jdbcType=VARCHAR},
      text_content_id = #{textContentId,jdbcType=INTEGER},
      do_right = #{doRight,jdbcType=BIT},
      create_user = #{createUser,jdbcType=INTEGER},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      item_order = #{itemOrder,jdbcType=INTEGER}
    where id = #{id,jdbcType=INTEGER}
  </update>
    </sql>
    <select id="selectListByPaperAnswerId" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from t_exam_paper_question_customer_answer
        where exam_paper_answer_id = #{id,jdbcType=INTEGER}
        order by item_order
    </select>
    <select id="studentPage" resultMap="BaseResultMap"
            parameterType="com.ycl.jxkg.vo.student.question.answer.QuestionPageStudentRequestVO">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_exam_paper_question_customer_answer
        <where>
            and do_right=FALSE
            and create_user=#{createUser}
        </where>
    </select>
    <insert id="insertList" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
        insert into t_exam_paper_question_customer_answer ( question_id, question_score,
        subject_id, create_time, create_user,
        text_content_id, exam_paper_id, question_type,
        answer, customer_score, exam_paper_answer_id ,
        do_right,question_text_content_id,item_order)
        values
        <foreach collection="list" item="item" index="index"
                 separator=",">
            ( #{item.questionId,jdbcType=INTEGER}, #{item.questionScore,jdbcType=INTEGER},
            #{item.subjectId,jdbcType=INTEGER}, #{item.createTime,jdbcType=TIMESTAMP},
            #{item.createUser,jdbcType=INTEGER},
            #{item.textContentId,jdbcType=INTEGER}, #{item.examPaperId,jdbcType=INTEGER},
            #{item.questionType,jdbcType=INTEGER},
            #{item.answer,jdbcType=VARCHAR}, #{item.customerScore,jdbcType=INTEGER},
            #{item.examPaperAnswerId,jdbcType=INTEGER},
            #{item.doRight,jdbcType=BIT},#{item.questionTextContentId,jdbcType=INTEGER},#{item.itemOrder,jdbcType=INTEGER})
        </foreach>
    </insert>
    <select id="selectAllCount" resultType="java.lang.Integer">
        SELECT count(*)
        from t_exam_paper_question_customer_answer
    </select>
    <select id="selectCountByDate" resultType="com.ycl.jxkg.domain.other.KeyValue">
        SELECT create_time as name, COUNT(create_time) as value
        from
            (
            SELECT DATE_FORMAT(create_time, '%Y-%m-%d') as create_time from t_exam_paper_question_customer_answer
            WHERE create_time between #{startTime} and #{endTime}
            ) a
        GROUP BY create_time
    </select>
  <select id="selectListByPaperAnswerId" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from t_exam_paper_question_customer_answer
    where exam_paper_answer_id = #{id,jdbcType=INTEGER}
    order by item_order
  </select>
  <select id="studentPage" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.vo.student.question.answer.QuestionPageStudentRequestVO">
    SELECT
    <include refid="Base_Column_List"/>
    FROM t_exam_paper_question_customer_answer
    <where>
      and do_right=FALSE
      and create_user=#{createUser}
    </where>
  </select>
  <insert id="insertList" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id" >
    insert into t_exam_paper_question_customer_answer ( question_id, question_score,
    subject_id, create_time, create_user,
    text_content_id, exam_paper_id, question_type,
    answer, customer_score, exam_paper_answer_id ,
    do_right,question_text_content_id,item_order)
    values
    <foreach collection="list" item="item" index="index"
             separator=",">
      ( #{item.questionId,jdbcType=INTEGER}, #{item.questionScore,jdbcType=INTEGER},
      #{item.subjectId,jdbcType=INTEGER}, #{item.createTime,jdbcType=TIMESTAMP}, #{item.createUser,jdbcType=INTEGER},
      #{item.textContentId,jdbcType=INTEGER}, #{item.examPaperId,jdbcType=INTEGER}, #{item.questionType,jdbcType=INTEGER},
      #{item.answer,jdbcType=VARCHAR}, #{item.customerScore,jdbcType=INTEGER}, #{item.examPaperAnswerId,jdbcType=INTEGER},
      #{item.doRight,jdbcType=BIT},#{item.questionTextContentId,jdbcType=INTEGER},#{item.itemOrder,jdbcType=INTEGER})
    </foreach>
  </insert>
  <select id="selectAllCount"  resultType="java.lang.Integer">
        SELECT count(*) from t_exam_paper_question_customer_answer
  </select>
  <select id="selectCountByDate"  resultType="com.ycl.jxkg.domain.other.KeyValue">
        SELECT create_time as name,COUNT(create_time) as value from
                (
                  SELECT DATE_FORMAT(create_time,'%Y-%m-%d') as create_time from t_exam_paper_question_customer_answer
                    WHERE  create_time  between  #{startTime}  and  #{endTime}
                ) a
        GROUP BY create_time
  </select>
  <update id="updateScore" parameterType="java.util.List">
    <foreach collection="list" item="item" >
        update t_exam_paper_question_customer_answer
        set customer_score=#{item.customerScore} , do_right=#{item.doRight}
        where id=#{item.id} ;
    </foreach>
  </update>
    <update id="updateScore" parameterType="java.util.List">
        <foreach collection="list" item="item">
            update t_exam_paper_question_customer_answer
            set customer_score=#{item.customerScore} , do_right=#{item.doRight}
            where id=#{item.id} ;
        </foreach>
    </update>
</mapper>
src/main/resources/mapper/MessageMapper.xml
@@ -1,172 +1,49 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ycl.jxkg.mapper.MessageMapper">
  <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.Message">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="title" jdbcType="VARCHAR" property="title" />
    <result column="content" jdbcType="VARCHAR" property="content" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="send_user_id" jdbcType="INTEGER" property="sendUserId" />
    <result column="send_user_name" jdbcType="VARCHAR" property="sendUserName" />
    <result column="send_real_name" jdbcType="VARCHAR" property="sendRealName" />
    <result column="receive_user_count" jdbcType="INTEGER" property="receiveUserCount" />
    <result column="read_count" jdbcType="INTEGER" property="readCount" />
  </resultMap>
  <sql id="Base_Column_List">
    id, title, content, create_time, send_user_id, send_user_name, send_real_name, receive_user_count,
    <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.Message">
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="title" jdbcType="VARCHAR" property="title"/>
        <result column="content" jdbcType="VARCHAR" property="content"/>
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
        <result column="send_user_id" jdbcType="INTEGER" property="sendUserId"/>
        <result column="send_user_name" jdbcType="VARCHAR" property="sendUserName"/>
        <result column="send_real_name" jdbcType="VARCHAR" property="sendRealName"/>
        <result column="receive_user_count" jdbcType="INTEGER" property="receiveUserCount"/>
        <result column="read_count" jdbcType="INTEGER" property="readCount"/>
    </resultMap>
    <sql id="Base_Column_List">
        id
        , title, content, create_time, send_user_id, send_user_name, send_real_name, receive_user_count,
    read_count
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from t_message
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from t_message
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.ycl.jxkg.domain.Message" useGeneratedKeys="true" keyProperty="id">
    insert into t_message (id, title, content,
      create_time, send_user_id, send_user_name,
      send_real_name, receive_user_count, read_count
      )
    values (#{id,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR},
      #{createTime,jdbcType=TIMESTAMP}, #{sendUserId,jdbcType=INTEGER}, #{sendUserName,jdbcType=VARCHAR},
      #{sendRealName,jdbcType=VARCHAR}, #{receiveUserCount,jdbcType=INTEGER}, #{readCount,jdbcType=INTEGER}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.ycl.jxkg.domain.Message" useGeneratedKeys="true" keyProperty="id">
    insert into t_message
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="title != null">
        title,
      </if>
      <if test="content != null">
        content,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="sendUserId != null">
        send_user_id,
      </if>
      <if test="sendUserName != null">
        send_user_name,
      </if>
      <if test="sendRealName != null">
        send_real_name,
      </if>
      <if test="receiveUserCount != null">
        receive_user_count,
      </if>
      <if test="readCount != null">
        read_count,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="title != null">
        #{title,jdbcType=VARCHAR},
      </if>
      <if test="content != null">
        #{content,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="sendUserId != null">
        #{sendUserId,jdbcType=INTEGER},
      </if>
      <if test="sendUserName != null">
        #{sendUserName,jdbcType=VARCHAR},
      </if>
      <if test="sendRealName != null">
        #{sendRealName,jdbcType=VARCHAR},
      </if>
      <if test="receiveUserCount != null">
        #{receiveUserCount,jdbcType=INTEGER},
      </if>
      <if test="readCount != null">
        #{readCount,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.ycl.jxkg.domain.Message">
    update t_message
    <set>
      <if test="title != null">
        title = #{title,jdbcType=VARCHAR},
      </if>
      <if test="content != null">
        content = #{content,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="sendUserId != null">
        send_user_id = #{sendUserId,jdbcType=INTEGER},
      </if>
      <if test="sendUserName != null">
        send_user_name = #{sendUserName,jdbcType=VARCHAR},
      </if>
      <if test="sendRealName != null">
        send_real_name = #{sendRealName,jdbcType=VARCHAR},
      </if>
      <if test="receiveUserCount != null">
        receive_user_count = #{receiveUserCount,jdbcType=INTEGER},
      </if>
      <if test="readCount != null">
        read_count = #{readCount,jdbcType=INTEGER},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.ycl.jxkg.domain.Message">
    update t_message
    set title = #{title,jdbcType=VARCHAR},
      content = #{content,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      send_user_id = #{sendUserId,jdbcType=INTEGER},
      send_user_name = #{sendUserName,jdbcType=VARCHAR},
      send_real_name = #{sendRealName,jdbcType=VARCHAR},
      receive_user_count = #{receiveUserCount,jdbcType=INTEGER},
      read_count = #{readCount,jdbcType=INTEGER}
    where id = #{id,jdbcType=INTEGER}
  </update>
    </sql>
    <select id="page" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.vo.admin.message.MessagePageRequestVO">
        select
        <include refid="Base_Column_List"/>
        from t_message
        <where>
            <if test="sendUserName != null">
                and send_user_name like concat('%',#{sendUserName},'%')
            </if>
        </where>
    </select>
    <select id="selectByIds" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from t_message
        where id in
        <foreach item="id" collection="list" open="(" separator="," close=")">
            #{id}
        </foreach>
    </select>
  <select id="page" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.vo.admin.message.MessagePageRequestVO">
    select
    <include refid="Base_Column_List" />
    from t_message
    <where>
         <if test="sendUserName != null">
           and send_user_name  like concat('%',#{sendUserName},'%')
         </if>
    </where>
  </select>
  <select id="selectByIds" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from t_message
    where  id  in
    <foreach item="id" collection="list" open="(" separator=","  close=")">
      #{id}
    </foreach>
  </select>
  <update id="readAdd" parameterType="java.lang.Integer">
      UPDATE t_message SET read_count = read_count + 1
      WHERE id= #{id} and read_count = (SELECT m.read_count from ( SELECT read_count FROM t_message WHERE id = #{id} ) m)
  </update>
    <update id="readAdd" parameterType="java.lang.Integer">
        UPDATE t_message
        SET read_count = read_count + 1
        WHERE id = #{id}
          and read_count = (SELECT m.read_count from (SELECT read_count FROM t_message WHERE id = #{id}) m)
    </update>
</mapper>
src/main/resources/mapper/MessageUserMapper.xml
@@ -1,174 +1,60 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ycl.jxkg.mapper.MessageUserMapper">
  <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.MessageUser">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="message_id" jdbcType="INTEGER" property="messageId" />
    <result column="receive_user_id" jdbcType="INTEGER" property="receiveUserId" />
    <result column="receive_user_name" jdbcType="VARCHAR" property="receiveUserName" />
    <result column="receive_real_name" jdbcType="VARCHAR" property="receiveRealName" />
    <result column="readed" jdbcType="BIT" property="readed" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="read_time" jdbcType="TIMESTAMP" property="readTime" />
  </resultMap>
  <sql id="Base_Column_List">
    id, message_id, receive_user_id, receive_user_name, receive_real_name, readed, create_time,
    <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.MessageUser">
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="message_id" jdbcType="INTEGER" property="messageId"/>
        <result column="receive_user_id" jdbcType="INTEGER" property="receiveUserId"/>
        <result column="receive_user_name" jdbcType="VARCHAR" property="receiveUserName"/>
        <result column="receive_real_name" jdbcType="VARCHAR" property="receiveRealName"/>
        <result column="readed" jdbcType="BIT" property="readed"/>
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
        <result column="read_time" jdbcType="TIMESTAMP" property="readTime"/>
    </resultMap>
    <sql id="Base_Column_List">
        id
        , message_id, receive_user_id, receive_user_name, receive_real_name, readed, create_time,
    read_time
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from t_message_user
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from t_message_user
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.ycl.jxkg.domain.MessageUser" useGeneratedKeys="true" keyProperty="id">
    insert into t_message_user (id, message_id, receive_user_id,
      receive_user_name, receive_real_name, readed,
      create_time, read_time)
    values (#{id,jdbcType=INTEGER}, #{messageId,jdbcType=INTEGER}, #{receiveUserId,jdbcType=INTEGER},
      #{receiveUserName,jdbcType=VARCHAR}, #{receiveRealName,jdbcType=VARCHAR}, #{readed,jdbcType=BIT},
      #{createTime,jdbcType=TIMESTAMP}, #{readTime,jdbcType=TIMESTAMP})
  </insert>
  <insert id="insertSelective" parameterType="com.ycl.jxkg.domain.MessageUser" useGeneratedKeys="true" keyProperty="id">
    insert into t_message_user
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="messageId != null">
        message_id,
      </if>
      <if test="receiveUserId != null">
        receive_user_id,
      </if>
      <if test="receiveUserName != null">
        receive_user_name,
      </if>
      <if test="receiveRealName != null">
        receive_real_name,
      </if>
      <if test="readed != null">
        readed,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="readTime != null">
        read_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="messageId != null">
        #{messageId,jdbcType=INTEGER},
      </if>
      <if test="receiveUserId != null">
        #{receiveUserId,jdbcType=INTEGER},
      </if>
      <if test="receiveUserName != null">
        #{receiveUserName,jdbcType=VARCHAR},
      </if>
      <if test="receiveRealName != null">
        #{receiveRealName,jdbcType=VARCHAR},
      </if>
      <if test="readed != null">
        #{readed,jdbcType=BIT},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="readTime != null">
        #{readTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.ycl.jxkg.domain.MessageUser" >
    update t_message_user
    <set>
      <if test="messageId != null">
        message_id = #{messageId,jdbcType=INTEGER},
      </if>
      <if test="receiveUserId != null">
        receive_user_id = #{receiveUserId,jdbcType=INTEGER},
      </if>
      <if test="receiveUserName != null">
        receive_user_name = #{receiveUserName,jdbcType=VARCHAR},
      </if>
      <if test="receiveRealName != null">
        receive_real_name = #{receiveRealName,jdbcType=VARCHAR},
      </if>
      <if test="readed != null">
        readed = #{readed,jdbcType=BIT},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="readTime != null">
        read_time = #{readTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.ycl.jxkg.domain.MessageUser">
    update t_message_user
    set message_id = #{messageId,jdbcType=INTEGER},
      receive_user_id = #{receiveUserId,jdbcType=INTEGER},
      receive_user_name = #{receiveUserName,jdbcType=VARCHAR},
      receive_real_name = #{receiveRealName,jdbcType=VARCHAR},
      readed = #{readed,jdbcType=BIT},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      read_time = #{readTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=INTEGER}
  </update>
    </sql>
    <select id="selectByMessageIds" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from t_message_user
        where message_id in
        <foreach item="id" collection="list" open="(" separator="," close=")">
            #{id}
        </foreach>
    </select>
    <insert id="inserts" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
        insert into t_message_user (message_id, receive_user_id,
        receive_user_name, receive_real_name, readed,
        create_time)
        values
        <foreach collection="list" item="item" index="index"
                 separator=",">
            (#{item.messageId,jdbcType=INTEGER}, #{item.receiveUserId,jdbcType=INTEGER},
            #{item.receiveUserName,jdbcType=VARCHAR}, #{item.receiveRealName,jdbcType=VARCHAR},
            #{item.readed,jdbcType=BIT},
            #{item.createTime,jdbcType=TIMESTAMP})
        </foreach>
    </insert>
    <select id="studentPage" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.vo.student.user.MessageRequestVO">
        select
        <include refid="Base_Column_List"/>
        from t_message_user
        where receive_user_id = #{receiveUserId}
    </select>
  <select id="selectByMessageIds" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from t_message_user
    where  message_id  in
    <foreach item="id" collection="list" open="(" separator=","  close=")">
      #{id}
    </foreach>
  </select>
  <insert id="inserts" parameterType="java.util.List" useGeneratedKeys="true" keyProperty="id">
    insert into t_message_user (message_id, receive_user_id,
    receive_user_name, receive_real_name, readed,
    create_time)
    values
    <foreach collection="list" item="item" index="index"
             separator=",">
      (#{item.messageId,jdbcType=INTEGER}, #{item.receiveUserId,jdbcType=INTEGER},
      #{item.receiveUserName,jdbcType=VARCHAR}, #{item.receiveRealName,jdbcType=VARCHAR}, #{item.readed,jdbcType=BIT},
      #{item.createTime,jdbcType=TIMESTAMP})
    </foreach>
  </insert>
  <select id="studentPage" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.vo.student.user.MessageRequestVO">
    select
    <include refid="Base_Column_List" />
    from t_message_user
    where  receive_user_id = #{receiveUserId}
  </select>
  <select id="unReadCount" resultType="java.lang.Integer" parameterType="java.lang.Integer">
    select count(*)
    from t_message_user
    where  readed='f' and  receive_user_id = #{userId}
  </select>
    <select id="unReadCount" resultType="java.lang.Integer" parameterType="java.lang.Integer">
        select count(*)
        from t_message_user
        where readed = 'f'
          and receive_user_id = #{userId}
    </select>
</mapper>
src/main/resources/mapper/QuestionMapper.xml
@@ -1,231 +1,78 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ycl.jxkg.mapper.QuestionMapper">
  <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.Question">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="question_type" jdbcType="INTEGER" property="questionType" />
    <result column="subject_id" jdbcType="INTEGER" property="subjectId" />
    <result column="score" jdbcType="INTEGER" property="score" />
    <result column="grade_level" jdbcType="INTEGER" property="gradeLevel" />
    <result column="difficult" jdbcType="INTEGER" property="difficult" />
    <result column="correct" jdbcType="VARCHAR" property="correct" />
    <result column="info_text_content_id" jdbcType="INTEGER" property="infoTextContentId" />
    <result column="create_user" jdbcType="INTEGER" property="createUser" />
    <result column="status" jdbcType="INTEGER" property="status" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="deleted" jdbcType="BIT" property="deleted" />
  </resultMap>
  <sql id="Base_Column_List">
    id, question_type, subject_id, score, grade_level, difficult, correct, info_text_content_id,
    <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.Question">
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="question_type" jdbcType="INTEGER" property="questionType"/>
        <result column="subject_id" jdbcType="INTEGER" property="subjectId"/>
        <result column="score" jdbcType="INTEGER" property="score"/>
        <result column="grade_level" jdbcType="INTEGER" property="gradeLevel"/>
        <result column="difficult" jdbcType="INTEGER" property="difficult"/>
        <result column="correct" jdbcType="VARCHAR" property="correct"/>
        <result column="info_text_content_id" jdbcType="INTEGER" property="infoTextContentId"/>
        <result column="create_user" jdbcType="INTEGER" property="createUser"/>
        <result column="status" jdbcType="INTEGER" property="status"/>
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
        <result column="deleted" jdbcType="BIT" property="deleted"/>
    </resultMap>
    <sql id="Base_Column_List">
        id
        , question_type, subject_id, score, grade_level, difficult, correct, info_text_content_id,
    create_user, status, create_time, deleted
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from t_question
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from t_question
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.ycl.jxkg.domain.Question" useGeneratedKeys="true" keyProperty="id">
    insert into t_question (id, question_type, subject_id,
      score, grade_level, difficult,
      correct, info_text_content_id, create_user,
      status, create_time, deleted
      )
    values (#{id,jdbcType=INTEGER}, #{questionType,jdbcType=INTEGER}, #{subjectId,jdbcType=INTEGER},
      #{score,jdbcType=INTEGER}, #{gradeLevel,jdbcType=INTEGER}, #{difficult,jdbcType=INTEGER},
      #{correct,jdbcType=VARCHAR}, #{infoTextContentId,jdbcType=INTEGER}, #{createUser,jdbcType=INTEGER},
      #{status,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP}, #{deleted,jdbcType=BIT}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.ycl.jxkg.domain.Question" useGeneratedKeys="true" keyProperty="id">
    insert into t_question
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="questionType != null">
        question_type,
      </if>
      <if test="subjectId != null">
        subject_id,
      </if>
      <if test="score != null">
        score,
      </if>
      <if test="gradeLevel != null">
        grade_level,
      </if>
      <if test="difficult != null">
        difficult,
      </if>
      <if test="correct != null">
        correct,
      </if>
      <if test="infoTextContentId != null">
        info_text_content_id,
      </if>
      <if test="createUser != null">
        create_user,
      </if>
      <if test="status != null">
        status,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="deleted != null">
        deleted,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="questionType != null">
        #{questionType,jdbcType=INTEGER},
      </if>
      <if test="subjectId != null">
        #{subjectId,jdbcType=INTEGER},
      </if>
      <if test="score != null">
        #{score,jdbcType=INTEGER},
      </if>
      <if test="gradeLevel != null">
        #{gradeLevel,jdbcType=INTEGER},
      </if>
      <if test="difficult != null">
        #{difficult,jdbcType=INTEGER},
      </if>
      <if test="correct != null">
        #{correct,jdbcType=VARCHAR},
      </if>
      <if test="infoTextContentId != null">
        #{infoTextContentId,jdbcType=INTEGER},
      </if>
      <if test="createUser != null">
        #{createUser,jdbcType=INTEGER},
      </if>
      <if test="status != null">
        #{status,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="deleted != null">
        #{deleted,jdbcType=BIT},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.ycl.jxkg.domain.Question">
    update t_question
    <set>
      <if test="questionType != null">
        question_type = #{questionType,jdbcType=INTEGER},
      </if>
      <if test="subjectId != null">
        subject_id = #{subjectId,jdbcType=INTEGER},
      </if>
      <if test="score != null">
        score = #{score,jdbcType=INTEGER},
      </if>
      <if test="gradeLevel != null">
        grade_level = #{gradeLevel,jdbcType=INTEGER},
      </if>
      <if test="difficult != null">
        difficult = #{difficult,jdbcType=INTEGER},
      </if>
      <if test="correct != null">
        correct = #{correct,jdbcType=VARCHAR},
      </if>
      <if test="infoTextContentId != null">
        info_text_content_id = #{infoTextContentId,jdbcType=INTEGER},
      </if>
      <if test="createUser != null">
        create_user = #{createUser,jdbcType=INTEGER},
      </if>
      <if test="status != null">
        status = #{status,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="deleted != null">
        deleted = #{deleted,jdbcType=BIT},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.ycl.jxkg.domain.Question">
    update t_question
    set question_type = #{questionType,jdbcType=INTEGER},
      subject_id = #{subjectId,jdbcType=INTEGER},
      score = #{score,jdbcType=INTEGER},
      grade_level = #{gradeLevel,jdbcType=INTEGER},
      difficult = #{difficult,jdbcType=INTEGER},
      correct = #{correct,jdbcType=VARCHAR},
      info_text_content_id = #{infoTextContentId,jdbcType=INTEGER},
      create_user = #{createUser,jdbcType=INTEGER},
      status = #{status,jdbcType=INTEGER},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      deleted = #{deleted,jdbcType=BIT}
    where id = #{id,jdbcType=INTEGER}
  </update>
    </sql>
    <select id="page" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.vo.admin.question.QuestionPageRequestVO">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_question
        <where>
            and deleted=0
            <if test="id != null ">
                and id= #{id}
            </if>
            <if test="level != null ">
                and grade_level= #{level}
            </if>
            <if test="subjectId != null ">
                and subject_id= #{subjectId}
            </if>
            <if test="questionType != null ">
                and question_type= #{questionType}
            </if>
            <if test="content != null">
                and info_text_content_id in (SELECT id FROM t_text_content WHERE content like concat('%',#{content},'%')
                )
            </if>
        </where>
    </select>
  <select id="page" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.vo.admin.question.QuestionPageRequestVO">
    SELECT
    <include refid="Base_Column_List"/>
    FROM t_question
    <where>
        and deleted=0
      <if test="id != null ">
        and id= #{id}
      </if>
      <if test="level != null ">
        and grade_level= #{level}
      </if>
      <if test="subjectId != null ">
        and subject_id= #{subjectId}
      </if>
      <if test="questionType != null ">
        and question_type= #{questionType}
      </if>
      <if test="content != null">
        and info_text_content_id in (SELECT id FROM t_text_content WHERE content like concat('%',#{content},'%') )
      </if>
    </where>
  </select>
    <select id="selectByIds" resultMap="BaseResultMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_question where id in
        <foreach item="id" collection="ids" open="(" separator=","
                 close=")">
            #{id}
        </foreach>
    </select>
    <select id="selectAllCount" resultType="java.lang.Integer">
        SELECT count(*)
        from t_question
        where deleted = 0
    </select>
  <select id="selectByIds" resultMap="BaseResultMap" >
    SELECT
    <include refid="Base_Column_List"/>
    FROM t_question where id in
    <foreach item="id" collection="ids" open="(" separator=","
             close=")">
      #{id}
    </foreach>
  </select>
  <select id="selectAllCount"  resultType="java.lang.Integer">
        SELECT count(*) from t_question where  deleted=0
    </select>
  <select id="selectCountByDate"  resultType="com.ycl.jxkg.domain.other.KeyValue">
        SELECT create_time as name,COUNT(create_time) as value from
                (
                  SELECT DATE_FORMAT(create_time,'%Y-%m-%d') as create_time from t_question
                    WHERE  deleted=0  and  create_time  between  #{startTime}  and  #{endTime}
                ) a
        GROUP BY create_time
    </select>
    <select id="selectCountByDate" resultType="com.ycl.jxkg.domain.other.KeyValue">
        SELECT create_time as name, COUNT(create_time) as value
        from
            (
            SELECT DATE_FORMAT(create_time, '%Y-%m-%d') as create_time from t_question
            WHERE deleted=0 and create_time between #{startTime} and #{endTime}
            ) a
        GROUP BY create_time
    </select>
</mapper>
src/main/resources/mapper/SubjectMapper.xml
@@ -1,137 +1,47 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ycl.jxkg.mapper.SubjectMapper">
  <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.Subject">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="name" jdbcType="VARCHAR" property="name" />
    <result column="level" jdbcType="INTEGER" property="level" />
    <result column="level_name" jdbcType="VARCHAR" property="levelName" />
    <result column="item_order" jdbcType="INTEGER" property="itemOrder" />
    <result column="deleted" jdbcType="BIT" property="deleted" />
  </resultMap>
  <sql id="Base_Column_List">
    id, name, level, level_name, item_order, deleted
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from t_subject
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from t_subject
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.ycl.jxkg.domain.Subject" useGeneratedKeys="true" keyProperty="id">
    insert into t_subject (id, name, level,
      level_name, item_order, deleted
      )
    values (#{id,jdbcType=INTEGER}, #{name,jdbcType=VARCHAR}, #{level,jdbcType=INTEGER},
      #{levelName,jdbcType=VARCHAR}, #{itemOrder,jdbcType=INTEGER}, #{deleted,jdbcType=BIT}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.ycl.jxkg.domain.Subject" useGeneratedKeys="true" keyProperty="id">
    insert into t_subject
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="name != null">
        name,
      </if>
      <if test="level != null">
        level,
      </if>
      <if test="levelName != null">
        level_name,
      </if>
      <if test="itemOrder != null">
        item_order,
      </if>
      <if test="deleted != null">
        deleted,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="name != null">
        #{name,jdbcType=VARCHAR},
      </if>
      <if test="level != null">
        #{level,jdbcType=INTEGER},
      </if>
      <if test="levelName != null">
        #{levelName,jdbcType=VARCHAR},
      </if>
      <if test="itemOrder != null">
        #{itemOrder,jdbcType=INTEGER},
      </if>
      <if test="deleted != null">
        #{deleted,jdbcType=BIT},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.ycl.jxkg.domain.Subject">
    update t_subject
    <set>
      <if test="name != null">
        name = #{name,jdbcType=VARCHAR},
      </if>
      <if test="level != null">
        level = #{level,jdbcType=INTEGER},
      </if>
      <if test="levelName != null">
        level_name = #{levelName,jdbcType=VARCHAR},
      </if>
      <if test="itemOrder != null">
        item_order = #{itemOrder,jdbcType=INTEGER},
      </if>
      <if test="deleted != null">
        deleted = #{deleted,jdbcType=BIT},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.ycl.jxkg.domain.Subject">
    update t_subject
    set name = #{name,jdbcType=VARCHAR},
      level = #{level,jdbcType=INTEGER},
      level_name = #{levelName,jdbcType=VARCHAR},
      item_order = #{itemOrder,jdbcType=INTEGER},
      deleted = #{deleted,jdbcType=BIT}
    where id = #{id,jdbcType=INTEGER}
  </update>
    <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.Subject">
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="name" jdbcType="VARCHAR" property="name"/>
        <result column="level" jdbcType="INTEGER" property="level"/>
        <result column="level_name" jdbcType="VARCHAR" property="levelName"/>
        <result column="item_order" jdbcType="INTEGER" property="itemOrder"/>
        <result column="deleted" jdbcType="BIT" property="deleted"/>
    </resultMap>
    <sql id="Base_Column_List">
        id
        , name, level, level_name, item_order, deleted
    </sql>
  <select id="getSubjectByLevel" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List"/>
    from t_subject where level= #{level}
    order by item_order
  </select>
    <select id="getSubjectByLevel" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from t_subject where level= #{level}
        order by item_order
    </select>
  <select id="allSubject" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List"/>
    from t_subject
  </select>
    <select id="allSubject" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from t_subject
    </select>
  <select id="page" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.vo.admin.education.SubjectPageRequestVO">
    SELECT
    <include refid="Base_Column_List"/>
    FROM t_subject
    <where>
        and deleted=0
      <if test="id != null ">
        and id= #{id}
      </if>
      <if test="level != null ">
        and level= #{level}
      </if>
    </where>
  </select>
    <select id="page" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.vo.admin.education.SubjectPageRequestVO">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_subject
        <where>
            and deleted=0
            <if test="id != null ">
                and id= #{id}
            </if>
            <if test="level != null ">
                and level= #{level}
            </if>
        </where>
    </select>
</mapper>
src/main/resources/mapper/TaskExamCustomerAnswerMapper.xml
@@ -1,117 +1,37 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ycl.jxkg.mapper.TaskExamCustomerAnswerMapper">
  <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.TaskExamCustomerAnswer">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="task_exam_id" jdbcType="INTEGER" property="taskExamId" />
    <result column="create_user" jdbcType="INTEGER" property="createUser" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="text_content_id" jdbcType="INTEGER" property="textContentId" />
  </resultMap>
  <sql id="Base_Column_List">
    id, task_exam_id, create_user, create_time, text_content_id
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from t_task_exam_customer_answer
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from t_task_exam_customer_answer
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.ycl.jxkg.domain.TaskExamCustomerAnswer" useGeneratedKeys="true" keyProperty="id">
    insert into t_task_exam_customer_answer (id, task_exam_id, create_user,
      create_time, text_content_id)
    values (#{id,jdbcType=INTEGER}, #{taskExamId,jdbcType=INTEGER}, #{createUser,jdbcType=INTEGER},
      #{createTime,jdbcType=TIMESTAMP}, #{textContentId,jdbcType=INTEGER})
  </insert>
  <insert id="insertSelective" parameterType="com.ycl.jxkg.domain.TaskExamCustomerAnswer" useGeneratedKeys="true" keyProperty="id">
    insert into t_task_exam_customer_answer
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="taskExamId != null">
        task_exam_id,
      </if>
      <if test="createUser != null">
        create_user,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="textContentId != null">
        text_content_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="taskExamId != null">
        #{taskExamId,jdbcType=INTEGER},
      </if>
      <if test="createUser != null">
        #{createUser,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="textContentId != null">
        #{textContentId,jdbcType=INTEGER},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.ycl.jxkg.domain.TaskExamCustomerAnswer">
    update t_task_exam_customer_answer
    <set>
      <if test="taskExamId != null">
        task_exam_id = #{taskExamId,jdbcType=INTEGER},
      </if>
      <if test="createUser != null">
        create_user = #{createUser,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="textContentId != null">
        text_content_id = #{textContentId,jdbcType=INTEGER},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.ycl.jxkg.domain.TaskExamCustomerAnswer">
    update t_task_exam_customer_answer
    set task_exam_id = #{taskExamId,jdbcType=INTEGER},
      create_user = #{createUser,jdbcType=INTEGER},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      text_content_id = #{textContentId,jdbcType=INTEGER}
    where id = #{id,jdbcType=INTEGER}
  </update>
    <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.TaskExamCustomerAnswer">
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="task_exam_id" jdbcType="INTEGER" property="taskExamId"/>
        <result column="create_user" jdbcType="INTEGER" property="createUser"/>
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
        <result column="text_content_id" jdbcType="INTEGER" property="textContentId"/>
    </resultMap>
    <sql id="Base_Column_List">
        id
        , task_exam_id, create_user, create_time, text_content_id
    </sql>
    <select id="getByTUid" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from t_task_exam_customer_answer
        where task_exam_id = #{tid} and create_user=#{uid}
        limit 1
    </select>
  <select id="getByTUid"  resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from t_task_exam_customer_answer
    where task_exam_id = #{tid} and create_user=#{uid}
    limit 1
  </select>
  <select id="selectByTUid"  resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from t_task_exam_customer_answer
    where create_user=#{uid} and
    task_exam_id in
    <foreach collection="taskIds" open="(" close=")" separator="," item="id">
      #{id}
    </foreach>
  </select>
    <select id="selectByTUid" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from t_task_exam_customer_answer
        where create_user=#{uid} and
        task_exam_id in
        <foreach collection="taskIds" open="(" close=")" separator="," item="id">
            #{id}
        </foreach>
    </select>
</mapper>
src/main/resources/mapper/TaskExamMapper.xml
@@ -1,158 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ycl.jxkg.mapper.TaskExamMapper">
  <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.TaskExam">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="title" jdbcType="VARCHAR" property="title" />
    <result column="grade_level" jdbcType="INTEGER" property="gradeLevel" />
    <result column="frame_text_content_id" jdbcType="INTEGER" property="frameTextContentId" />
    <result column="create_user" jdbcType="INTEGER" property="createUser" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="deleted" jdbcType="BIT" property="deleted" />
    <result column="create_user_name" jdbcType="VARCHAR" property="createUserName" />
  </resultMap>
  <sql id="Base_Column_List">
    id, title, grade_level, frame_text_content_id, create_user, create_time, deleted,
    <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.TaskExam">
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="title" jdbcType="VARCHAR" property="title"/>
        <result column="grade_level" jdbcType="INTEGER" property="gradeLevel"/>
        <result column="frame_text_content_id" jdbcType="INTEGER" property="frameTextContentId"/>
        <result column="create_user" jdbcType="INTEGER" property="createUser"/>
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
        <result column="deleted" jdbcType="BIT" property="deleted"/>
        <result column="create_user_name" jdbcType="VARCHAR" property="createUserName"/>
    </resultMap>
    <sql id="Base_Column_List">
        id
        , title, grade_level, frame_text_content_id, create_user, create_time, deleted,
    create_user_name
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from t_task_exam
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from t_task_exam
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.ycl.jxkg.domain.TaskExam" useGeneratedKeys="true" keyProperty="id">
    insert into t_task_exam (id, title, grade_level,
      frame_text_content_id, create_user, create_time,
      deleted, create_user_name)
    values (#{id,jdbcType=INTEGER}, #{title,jdbcType=VARCHAR}, #{gradeLevel,jdbcType=INTEGER},
      #{frameTextContentId,jdbcType=INTEGER}, #{createUser,jdbcType=INTEGER}, #{createTime,jdbcType=TIMESTAMP},
      #{deleted,jdbcType=BIT}, #{createUserName,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.ycl.jxkg.domain.TaskExam" useGeneratedKeys="true" keyProperty="id">
    insert into t_task_exam
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="title != null">
        title,
      </if>
      <if test="gradeLevel != null">
        grade_level,
      </if>
      <if test="frameTextContentId != null">
        frame_text_content_id,
      </if>
      <if test="createUser != null">
        create_user,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="deleted != null">
        deleted,
      </if>
      <if test="createUserName != null">
        create_user_name,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="title != null">
        #{title,jdbcType=VARCHAR},
      </if>
      <if test="gradeLevel != null">
        #{gradeLevel,jdbcType=INTEGER},
      </if>
      <if test="frameTextContentId != null">
        #{frameTextContentId,jdbcType=INTEGER},
      </if>
      <if test="createUser != null">
        #{createUser,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="deleted != null">
        #{deleted,jdbcType=BIT},
      </if>
      <if test="createUserName != null">
        #{createUserName,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.ycl.jxkg.domain.TaskExam">
    update t_task_exam
    <set>
      <if test="title != null">
        title = #{title,jdbcType=VARCHAR},
      </if>
      <if test="gradeLevel != null">
        grade_level = #{gradeLevel,jdbcType=INTEGER},
      </if>
      <if test="frameTextContentId != null">
        frame_text_content_id = #{frameTextContentId,jdbcType=INTEGER},
      </if>
      <if test="createUser != null">
        create_user = #{createUser,jdbcType=INTEGER},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="deleted != null">
        deleted = #{deleted,jdbcType=BIT},
      </if>
      <if test="createUserName != null">
        create_user_name = #{createUserName,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.ycl.jxkg.domain.TaskExam">
    update t_task_exam
    set title = #{title,jdbcType=VARCHAR},
      grade_level = #{gradeLevel,jdbcType=INTEGER},
      frame_text_content_id = #{frameTextContentId,jdbcType=INTEGER},
      create_user = #{createUser,jdbcType=INTEGER},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      deleted = #{deleted,jdbcType=BIT},
      create_user_name = #{createUserName,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
    </sql>
    <select id="page" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.vo.admin.task.TaskPageRequestVO">
        select
        <include refid="Base_Column_List"/>
        from t_task_exam
        <where>
            and deleted=0
            <if test="gradeLevel != null">
                and grade_level = #{gradeLevel}
            </if>
        </where>
    </select>
  <select id="page" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.vo.admin.task.TaskPageRequestVO">
    select
    <include refid="Base_Column_List" />
    from t_task_exam
    <where>
        and deleted=0
      <if test="gradeLevel != null">
        and grade_level = #{gradeLevel}
      </if>
    </where>
  </select>
  <select id="getByGradeLevel" resultMap="BaseResultMap" parameterType="java.lang.Integer">
    select
    <include refid="Base_Column_List" />
    from t_task_exam
    where deleted=0
    and grade_level = #{gradeLevel,jdbcType=INTEGER}
  </select>
    <select id="getByGradeLevel" resultMap="BaseResultMap" parameterType="java.lang.Integer">
        select
        <include refid="Base_Column_List"/>
        from t_task_exam
        where deleted=0
        and grade_level = #{gradeLevel,jdbcType=INTEGER}
    </select>
</mapper>
src/main/resources/mapper/TextContentMapper.xml
@@ -1,71 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ycl.jxkg.mapper.TextContentMapper">
  <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.TextContent">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="content" jdbcType="VARCHAR" property="content" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  </resultMap>
  <sql id="Base_Column_List">
    id, content, create_time
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from t_text_content
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from t_text_content
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.ycl.jxkg.domain.TextContent" useGeneratedKeys="true" keyProperty="id">
    insert into t_text_content (id, content, create_time
      )
    values (#{id,jdbcType=INTEGER}, #{content,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.ycl.jxkg.domain.TextContent" useGeneratedKeys="true" keyProperty="id">
    insert into t_text_content
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="content != null">
        content,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="content != null">
        #{content,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.ycl.jxkg.domain.TextContent">
    update t_text_content
    <set>
      <if test="content != null">
        content = #{content,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.ycl.jxkg.domain.TextContent">
    update t_text_content
    set content = #{content,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=INTEGER}
  </update>
    <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.TextContent">
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="content" jdbcType="VARCHAR" property="content"/>
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
    </resultMap>
    <sql id="Base_Column_List">
        id
        , content, create_time
    </sql>
</mapper>
src/main/resources/mapper/UserEventLogMapper.xml
@@ -1,146 +1,53 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ycl.jxkg.mapper.UserEventLogMapper">
  <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.UserEventLog">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="user_id" jdbcType="INTEGER" property="userId" />
    <result column="user_name" jdbcType="VARCHAR" property="userName" />
    <result column="real_name" jdbcType="VARCHAR" property="realName" />
    <result column="content" jdbcType="VARCHAR" property="content" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
  </resultMap>
  <sql id="Base_Column_List">
    id, user_id, user_name, real_name, content, create_time
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from t_user_event_log
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from t_user_event_log
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.ycl.jxkg.domain.UserEventLog" useGeneratedKeys="true" keyProperty="id">
    insert into t_user_event_log (id, user_id, user_name,
      real_name, content, create_time
      )
    values (#{id,jdbcType=INTEGER}, #{userId,jdbcType=INTEGER}, #{userName,jdbcType=VARCHAR},
      #{realName,jdbcType=VARCHAR}, #{content,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.ycl.jxkg.domain.UserEventLog" useGeneratedKeys="true" keyProperty="id">
    insert into t_user_event_log
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="userId != null">
        user_id,
      </if>
      <if test="userName != null">
        user_name,
      </if>
      <if test="realName != null">
        real_name,
      </if>
      <if test="content != null">
        content,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="userId != null">
        #{userId,jdbcType=INTEGER},
      </if>
      <if test="userName != null">
        #{userName,jdbcType=VARCHAR},
      </if>
      <if test="realName != null">
        #{realName,jdbcType=VARCHAR},
      </if>
      <if test="content != null">
        #{content,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.ycl.jxkg.domain.UserEventLog">
    update t_user_event_log
    <set>
      <if test="userId != null">
        user_id = #{userId,jdbcType=INTEGER},
      </if>
      <if test="userName != null">
        user_name = #{userName,jdbcType=VARCHAR},
      </if>
      <if test="realName != null">
        real_name = #{realName,jdbcType=VARCHAR},
      </if>
      <if test="content != null">
        content = #{content,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.ycl.jxkg.domain.UserEventLog">
    update t_user_event_log
    set user_id = #{userId,jdbcType=INTEGER},
      user_name = #{userName,jdbcType=VARCHAR},
      real_name = #{realName,jdbcType=VARCHAR},
      content = #{content,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=TIMESTAMP}
    where id = #{id,jdbcType=INTEGER}
  </update>
    <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.UserEventLog">
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="user_id" jdbcType="INTEGER" property="userId"/>
        <result column="user_name" jdbcType="VARCHAR" property="userName"/>
        <result column="real_name" jdbcType="VARCHAR" property="realName"/>
        <result column="content" jdbcType="VARCHAR" property="content"/>
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
    </resultMap>
    <sql id="Base_Column_List">
        id
        , user_id, user_name, real_name, content, create_time
    </sql>
    <select id="getUserEventLogByUserId" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from t_user_event_log
        where user_id=#{value}
        order by id desc
        limit 10
    </select>
    <select id="page" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.vo.admin.user.UserEventPageRequestVO">
        select
        <include refid="Base_Column_List"/>
        from t_user_event_log
        <where>
            <if test="userId != null">
                and user_id= #{userId}
            </if>
            <if test="userName != null">
                and user_name= #{userName}
            </if>
        </where>
    </select>
  <select id="getUserEventLogByUserId" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List"/>
    from t_user_event_log
    where user_id=#{value}
    order by id desc
    limit 10
  </select>
  <select id="page" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.vo.admin.user.UserEventPageRequestVO">
    select
    <include refid="Base_Column_List"/>
    from t_user_event_log
    <where>
      <if test="userId != null">
         and user_id= #{userId}
      </if>
      <if test="userName != null">
        and user_name= #{userName}
      </if>
    </where>
  </select>
  <select id="selectCountByDate"  resultType="com.ycl.jxkg.domain.other.KeyValue">
        SELECT create_time as name,COUNT(create_time) as value from
                (
                  SELECT DATE_FORMAT(create_time,'%Y-%m-%d') as create_time from t_user_event_log
                    WHERE  create_time  between  #{startTime}  and  #{endTime}
                ) a
        GROUP BY create_time
    </select>
    <select id="selectCountByDate" resultType="com.ycl.jxkg.domain.other.KeyValue">
        SELECT create_time as name, COUNT(create_time) as value
        from
            (
            SELECT DATE_FORMAT(create_time, '%Y-%m-%d') as create_time from t_user_event_log
            WHERE create_time between #{startTime} and #{endTime}
            ) a
        GROUP BY create_time
    </select>
</mapper>
src/main/resources/mapper/UserMapper.xml
@@ -1,414 +1,198 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ycl.jxkg.mapper.UserMapper">
  <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.User">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="user_uuid" jdbcType="VARCHAR" property="userUuid" />
    <result column="user_name" jdbcType="VARCHAR" property="userName" />
    <result column="password" jdbcType="VARCHAR" property="password" />
    <result column="real_name" jdbcType="VARCHAR" property="realName" />
    <result column="age" jdbcType="INTEGER" property="age" />
    <result column="sex" jdbcType="INTEGER" property="sex" />
    <result column="birth_day" jdbcType="TIMESTAMP" property="birthDay" />
    <result column="user_level" jdbcType="INTEGER" property="userLevel" />
    <result column="phone" jdbcType="VARCHAR" property="phone" />
    <result column="role" jdbcType="INTEGER" property="role" />
    <result column="status" jdbcType="INTEGER" property="status" />
    <result column="image_path" jdbcType="VARCHAR" property="imagePath" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime" />
    <result column="last_active_time" jdbcType="TIMESTAMP" property="lastActiveTime" />
    <result column="deleted" jdbcType="BIT" property="deleted" />
    <result column="wx_open_id" jdbcType="VARCHAR" property="wxOpenId" />
  </resultMap>
  <sql id="Base_Column_List">
    id, user_uuid, user_name, password, real_name, age, sex, birth_day, user_level, phone,
    <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.User">
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="user_uuid" jdbcType="VARCHAR" property="userUuid"/>
        <result column="user_name" jdbcType="VARCHAR" property="userName"/>
        <result column="password" jdbcType="VARCHAR" property="password"/>
        <result column="real_name" jdbcType="VARCHAR" property="realName"/>
        <result column="age" jdbcType="INTEGER" property="age"/>
        <result column="sex" jdbcType="INTEGER" property="sex"/>
        <result column="birth_day" jdbcType="TIMESTAMP" property="birthDay"/>
        <result column="user_level" jdbcType="INTEGER" property="userLevel"/>
        <result column="phone" jdbcType="VARCHAR" property="phone"/>
        <result column="role" jdbcType="INTEGER" property="role"/>
        <result column="status" jdbcType="INTEGER" property="status"/>
        <result column="image_path" jdbcType="VARCHAR" property="imagePath"/>
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
        <result column="modify_time" jdbcType="TIMESTAMP" property="modifyTime"/>
        <result column="last_active_time" jdbcType="TIMESTAMP" property="lastActiveTime"/>
        <result column="deleted" jdbcType="BIT" property="deleted"/>
        <result column="wx_open_id" jdbcType="VARCHAR" property="wxOpenId"/>
    </resultMap>
    <sql id="Base_Column_List">
        id
        , user_uuid, user_name, password, real_name, age, sex, birth_day, user_level, phone,
    role, status, image_path, create_time, modify_time, last_active_time, deleted, wx_open_id
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from t_user
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from t_user
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.ycl.jxkg.domain.User" useGeneratedKeys="true" keyProperty="id">
    insert into t_user (id, user_uuid, user_name,
      password, real_name, age,
      sex, birth_day, user_level,
      phone, role, status,
      image_path, create_time, modify_time,
      last_active_time, deleted, wx_open_id
      )
    values (#{id,jdbcType=INTEGER}, #{userUuid,jdbcType=VARCHAR}, #{userName,jdbcType=VARCHAR},
      #{password,jdbcType=VARCHAR}, #{realName,jdbcType=VARCHAR}, #{age,jdbcType=INTEGER},
      #{sex,jdbcType=INTEGER}, #{birthDay,jdbcType=TIMESTAMP}, #{userLevel,jdbcType=INTEGER},
      #{phone,jdbcType=VARCHAR}, #{role,jdbcType=INTEGER}, #{status,jdbcType=INTEGER},
      #{imagePath,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{modifyTime,jdbcType=TIMESTAMP},
      #{lastActiveTime,jdbcType=TIMESTAMP}, #{deleted,jdbcType=BIT}, #{wxOpenId,jdbcType=VARCHAR}
      )
  </insert>
  <insert id="insertSelective" parameterType="com.ycl.jxkg.domain.User" useGeneratedKeys="true" keyProperty="id">
    insert into t_user
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="userUuid != null">
        user_uuid,
      </if>
      <if test="userName != null">
        user_name,
      </if>
      <if test="password != null">
        password,
      </if>
      <if test="realName != null">
        real_name,
      </if>
      <if test="age != null">
        age,
      </if>
      <if test="sex != null">
        sex,
      </if>
      <if test="birthDay != null">
        birth_day,
      </if>
      <if test="userLevel != null">
        user_level,
      </if>
      <if test="phone != null">
        phone,
      </if>
      <if test="role != null">
        role,
      </if>
      <if test="status != null">
        status,
      </if>
      <if test="imagePath != null">
        image_path,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="modifyTime != null">
        modify_time,
      </if>
      <if test="lastActiveTime != null">
        last_active_time,
      </if>
      <if test="deleted != null">
        deleted,
      </if>
      <if test="wxOpenId != null">
        wx_open_id,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="userUuid != null">
        #{userUuid,jdbcType=VARCHAR},
      </if>
      <if test="userName != null">
        #{userName,jdbcType=VARCHAR},
      </if>
      <if test="password != null">
        #{password,jdbcType=VARCHAR},
      </if>
      <if test="realName != null">
        #{realName,jdbcType=VARCHAR},
      </if>
      <if test="age != null">
        #{age,jdbcType=INTEGER},
      </if>
      <if test="sex != null">
        #{sex,jdbcType=INTEGER},
      </if>
      <if test="birthDay != null">
        #{birthDay,jdbcType=TIMESTAMP},
      </if>
      <if test="userLevel != null">
        #{userLevel,jdbcType=INTEGER},
      </if>
      <if test="phone != null">
        #{phone,jdbcType=VARCHAR},
      </if>
      <if test="role != null">
        #{role,jdbcType=INTEGER},
      </if>
      <if test="status != null">
        #{status,jdbcType=INTEGER},
      </if>
      <if test="imagePath != null">
        #{imagePath,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="modifyTime != null">
        #{modifyTime,jdbcType=TIMESTAMP},
      </if>
      <if test="lastActiveTime != null">
        #{lastActiveTime,jdbcType=TIMESTAMP},
      </if>
      <if test="deleted != null">
        #{deleted,jdbcType=BIT},
      </if>
      <if test="wxOpenId != null">
        #{wxOpenId,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.ycl.jxkg.domain.User">
    update t_user
    <set>
      <if test="userUuid != null">
        user_uuid = #{userUuid,jdbcType=VARCHAR},
      </if>
      <if test="userName != null">
        user_name = #{userName,jdbcType=VARCHAR},
      </if>
      <if test="password != null">
        password = #{password,jdbcType=VARCHAR},
      </if>
      <if test="realName != null">
        real_name = #{realName,jdbcType=VARCHAR},
      </if>
      <if test="age != null">
        age = #{age,jdbcType=INTEGER},
      </if>
      <if test="sex != null">
        sex = #{sex,jdbcType=INTEGER},
      </if>
      <if test="birthDay != null">
        birth_day = #{birthDay,jdbcType=TIMESTAMP},
      </if>
      <if test="userLevel != null">
        user_level = #{userLevel,jdbcType=INTEGER},
      </if>
      <if test="phone != null">
        phone = #{phone,jdbcType=VARCHAR},
      </if>
      <if test="role != null">
        role = #{role,jdbcType=INTEGER},
      </if>
      <if test="status != null">
        status = #{status,jdbcType=INTEGER},
      </if>
      <if test="imagePath != null">
        image_path = #{imagePath,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="modifyTime != null">
        modify_time = #{modifyTime,jdbcType=TIMESTAMP},
      </if>
      <if test="lastActiveTime != null">
        last_active_time = #{lastActiveTime,jdbcType=TIMESTAMP},
      </if>
      <if test="deleted != null">
        deleted = #{deleted,jdbcType=BIT},
      </if>
      <if test="wxOpenId != null">
        wx_open_id = #{wxOpenId,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.ycl.jxkg.domain.User">
    update t_user
    set user_uuid = #{userUuid,jdbcType=VARCHAR},
      user_name = #{userName,jdbcType=VARCHAR},
      password = #{password,jdbcType=VARCHAR},
      real_name = #{realName,jdbcType=VARCHAR},
      age = #{age,jdbcType=INTEGER},
      sex = #{sex,jdbcType=INTEGER},
      birth_day = #{birthDay,jdbcType=TIMESTAMP},
      user_level = #{userLevel,jdbcType=INTEGER},
      phone = #{phone,jdbcType=VARCHAR},
      role = #{role,jdbcType=INTEGER},
      status = #{status,jdbcType=INTEGER},
      image_path = #{imagePath,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      modify_time = #{modifyTime,jdbcType=TIMESTAMP},
      last_active_time = #{lastActiveTime,jdbcType=TIMESTAMP},
      deleted = #{deleted,jdbcType=BIT},
      wx_open_id = #{wxOpenId,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
    </sql>
    <select id="getAllUser" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from t_user where deleted=0
    </select>
  <select id="getAllUser" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List"/>
    from t_user where deleted=0
  </select>
    <select id="getUserById" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from t_user
        where id=#{value}
    </select>
  <select id="getUserById" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List"/>
    from t_user
    where id=#{value}
  </select>
    <select id="getUserByUserName" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from t_user
        where deleted=0 and user_name=#{value} limit 1
    </select>
  <select id="getUserByUserName" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List"/>
    from t_user
    where deleted=0  and user_name=#{value} limit 1
  </select>
    <select id="getUserByUserNamePwd" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from t_user
        where deleted=0 and user_name=#{username} and password=#{pwd} limit 1
    </select>
  <select id="getUserByUserNamePwd" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List"/>
    from t_user
    where deleted=0  and user_name=#{username} and password=#{pwd} limit 1
  </select>
  <select id="getUserByUuid" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List"/>
    from t_user
    where deleted=0  and user_uuid=#{value,jdbcType=VARCHAR}
  </select>
    <select id="getUserByUuid" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from t_user
        where deleted=0 and user_uuid=#{value,jdbcType=VARCHAR}
    </select>
  <select id="userPageList" resultMap="BaseResultMap">
    SELECT
    <include refid="Base_Column_List"/>
    FROM t_user
    <where>
        and deleted=0
      <if test="name != null and name != ''">
        and  real_name like concat('%',#{name},'%')
      </if>
    </where>
    ORDER BY id
    <if test="offset != null and limit != null ">
      <bind name="patternAdd" value="limit*offset"/>
      limit #{limit} OFFSET #{offset}
    </if>
  </select>
    <select id="userPageList" resultMap="BaseResultMap">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_user
        <where>
            and deleted=0
            <if test="name != null and name != ''">
                and real_name like concat('%',#{name},'%')
            </if>
        </where>
        ORDER BY id
        <if test="offset != null and limit != null ">
            <bind name="patternAdd" value="limit*offset"/>
            limit #{limit} OFFSET #{offset}
        </if>
    </select>
  <select id="userPageCount" resultType="java.lang.Integer">
    select count(*) from t_user
    <where>
        and deleted=0
      <if test="name != null and name != ''">
        and real_name like concat('%', #{name}, '%')
      </if>
    </where>
  </select>
    <select id="userPageCount" resultType="java.lang.Integer">
        select count(*) from t_user
        <where>
            and deleted=0
            <if test="name != null and name != ''">
                and real_name like concat('%', #{name}, '%')
            </if>
        </where>
    </select>
  <select id="userPage" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.vo.admin.user.UserPageRequestVO">
    SELECT
    <include refid="Base_Column_List"/>
    FROM t_user
    <where>
        and deleted=0
      <if test="userName != null and userName != ''">
        and user_name like concat('%',#{userName},'%')
      </if>
      <if test="role != null ">
        and role= #{role}
      </if>
    </where>
  </select>
    <select id="userPage" resultMap="BaseResultMap" parameterType="com.ycl.jxkg.vo.admin.user.UserPageRequestVO">
        SELECT
        <include refid="Base_Column_List"/>
        FROM t_user
        <where>
            and deleted=0
            <if test="userName != null and userName != ''">
                and user_name like concat('%',#{userName},'%')
            </if>
            <if test="role != null ">
                and role= #{role}
            </if>
        </where>
    </select>
    <insert id="insertUser" parameterType="com.ycl.jxkg.domain.User"
            useGeneratedKeys="true" keyProperty="id">
        insert into t_user
            (user_uuid, user_name, password, real_name, age, last_active_time)
        values (#{userUuid,jdbcType=VARCHAR}, #{userName}, #{password}, #{realName}, #{age}, #{lastActiveTime})
    </insert>
  <insert id="insertUser" parameterType="com.ycl.jxkg.domain.User"
          useGeneratedKeys="true" keyProperty="id">
        insert into t_user
        (user_uuid,user_name,password,real_name,age, last_active_time)
        values
        (#{userUuid,jdbcType=VARCHAR},#{userName},#{password},#{realName},#{age},#{lastActiveTime})
    </insert>
  <insert id="insertUsers" parameterType="java.util.List"
          useGeneratedKeys="true" keyProperty="id">
    insert into t_user
    (user_uuid,user_name,password,real_name,age,last_active_time)
    values
    <foreach collection="list" item="item" index="index"
             separator=",">
      (#{item.userUuid},#{item.userName},#{item.password},#{item.realName},#{item.age},
      #{item.lastActiveTime})
    </foreach>
  </insert>
    <insert id="insertUsers" parameterType="java.util.List"
            useGeneratedKeys="true" keyProperty="id">
        insert into t_user
        (user_uuid,user_name,password,real_name,age,last_active_time)
        values
        <foreach collection="list" item="item" index="index"
                 separator=",">
            (#{item.userUuid},#{item.userName},#{item.password},#{item.realName},#{item.age},
            #{item.lastActiveTime})
        </foreach>
    </insert>
  <update id="updateUser" parameterType="com.ycl.jxkg.domain.User">
    update t_user
    <set>
      <if test="realName != null">real_name = #{realName},</if>
      <if test="age != null">age = #{age},</if>
      <if test="lastActiveTime != null">last_active_time = #{lastActiveTime},</if>
    </set>
    where id = #{id}
  </update>
    <update id="updateUser" parameterType="com.ycl.jxkg.domain.User">
        update t_user
        <set>
            <if test="realName != null">real_name = #{realName},</if>
            <if test="age != null">age = #{age},</if>
            <if test="lastActiveTime != null">last_active_time = #{lastActiveTime},</if>
        </set>
        where id = #{id}
    </update>
  <update id="updateUsersAge">
    update t_user set age = #{age} where id in
    <foreach item="id" collection="idslist" open="(" separator=","
             close=")">
      #{id}
    </foreach>
  </update>
    <update id="updateUsersAge">
        update t_user set age = #{age} where id in
        <foreach item="id" collection="idslist" open="(" separator=","
                 close=")">
            #{id}
        </foreach>
    </update>
  <delete id="deleteUsersByIds">
    delete from t_user where id in
    <foreach item="id" collection="list" open="(" separator=","
             close=")">
      #{id}
    </foreach>
  </delete>
    <delete id="deleteUsersByIds">
        delete from t_user where id in
        <foreach item="id" collection="list" open="(" separator=","
                 close=")">
            #{id}
        </foreach>
    </delete>
  <select id="selectAllCount"  resultType="java.lang.Integer">
        SELECT count(*) from t_user where deleted=0
  </select>
    <select id="selectAllCount" resultType="java.lang.Integer">
        SELECT count(*)
        from t_user
        where deleted = 0
    </select>
  <select id="selectByUserName"  resultType="com.ycl.jxkg.domain.other.KeyValue">
        SELECT  id as value,user_name as name
        from t_user
        where deleted=0  and user_name like concat('%',#{value},'%')
        limit 5
  </select>
    <select id="selectByUserName" resultType="com.ycl.jxkg.domain.other.KeyValue">
        SELECT id as value,user_name as name
        from t_user
        where deleted=0
          and user_name like concat('%'
            , #{value}
            , '%')
            limit 5
    </select>
  <select id="selectByIds" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
     from t_user
     where id in
    <foreach item="id" collection="list" open="(" separator=","
             close=")">
      #{id}
    </foreach>
  </select>
    <select id="selectByIds" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from t_user
        where id in
        <foreach item="id" collection="list" open="(" separator=","
                 close=")">
            #{id}
        </foreach>
    </select>
  <select id="selectByWxOpenId" parameterType="java.lang.String" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from t_user
    where deleted=0  and  wx_open_id = #{wxOpenId}
    limit 1
  </select>
    <select id="selectByWxOpenId" parameterType="java.lang.String" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from t_user
        where deleted=0 and wx_open_id = #{wxOpenId}
        limit 1
    </select>
</mapper>
src/main/resources/mapper/UserTokenMapper.xml
@@ -1,132 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.ycl.jxkg.mapper.UserTokenMapper">
  <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.UserToken">
    <id column="id" jdbcType="INTEGER" property="id" />
    <result column="token" jdbcType="VARCHAR" property="token" />
    <result column="user_id" jdbcType="INTEGER" property="userId" />
    <result column="wx_open_id" jdbcType="VARCHAR" property="wxOpenId" />
    <result column="create_time" jdbcType="TIMESTAMP" property="createTime" />
    <result column="end_time" jdbcType="TIMESTAMP" property="endTime" />
    <result column="user_name" jdbcType="VARCHAR" property="userName" />
  </resultMap>
  <sql id="Base_Column_List">
    id, token, user_id, wx_open_id, create_time, end_time, user_name
  </sql>
  <select id="selectByPrimaryKey" parameterType="java.lang.Integer" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from t_user_token
    where id = #{id,jdbcType=INTEGER}
  </select>
  <delete id="deleteByPrimaryKey" parameterType="java.lang.Integer">
    delete from t_user_token
    where id = #{id,jdbcType=INTEGER}
  </delete>
  <insert id="insert" parameterType="com.ycl.jxkg.domain.UserToken" useGeneratedKeys="true" keyProperty="id">
    insert into t_user_token (id, token, user_id,
      wx_open_id, create_time, end_time,
      user_name)
    values (#{id,jdbcType=INTEGER}, #{token,jdbcType=VARCHAR}, #{userId,jdbcType=INTEGER},
      #{wxOpenId,jdbcType=VARCHAR}, #{createTime,jdbcType=TIMESTAMP}, #{endTime,jdbcType=TIMESTAMP},
      #{userName,jdbcType=VARCHAR})
  </insert>
  <insert id="insertSelective" parameterType="com.ycl.jxkg.domain.UserToken" useGeneratedKeys="true" keyProperty="id">
    insert into t_user_token
    <trim prefix="(" suffix=")" suffixOverrides=",">
      <if test="id != null">
        id,
      </if>
      <if test="token != null">
        token,
      </if>
      <if test="userId != null">
        user_id,
      </if>
      <if test="wxOpenId != null">
        wx_open_id,
      </if>
      <if test="createTime != null">
        create_time,
      </if>
      <if test="endTime != null">
        end_time,
      </if>
      <if test="userName != null">
        user_name,
      </if>
    </trim>
    <trim prefix="values (" suffix=")" suffixOverrides=",">
      <if test="id != null">
        #{id,jdbcType=INTEGER},
      </if>
      <if test="token != null">
        #{token,jdbcType=VARCHAR},
      </if>
      <if test="userId != null">
        #{userId,jdbcType=INTEGER},
      </if>
      <if test="wxOpenId != null">
        #{wxOpenId,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="endTime != null">
        #{endTime,jdbcType=TIMESTAMP},
      </if>
      <if test="userName != null">
        #{userName,jdbcType=VARCHAR},
      </if>
    </trim>
  </insert>
  <update id="updateByPrimaryKeySelective" parameterType="com.ycl.jxkg.domain.UserToken">
    update t_user_token
    <set>
      <if test="token != null">
        token = #{token,jdbcType=VARCHAR},
      </if>
      <if test="userId != null">
        user_id = #{userId,jdbcType=INTEGER},
      </if>
      <if test="wxOpenId != null">
        wx_open_id = #{wxOpenId,jdbcType=VARCHAR},
      </if>
      <if test="createTime != null">
        create_time = #{createTime,jdbcType=TIMESTAMP},
      </if>
      <if test="endTime != null">
        end_time = #{endTime,jdbcType=TIMESTAMP},
      </if>
      <if test="userName != null">
        user_name = #{userName,jdbcType=VARCHAR},
      </if>
    </set>
    where id = #{id,jdbcType=INTEGER}
  </update>
  <update id="updateByPrimaryKey" parameterType="com.ycl.jxkg.domain.UserToken">
    update t_user_token
    set token = #{token,jdbcType=VARCHAR},
      user_id = #{userId,jdbcType=INTEGER},
      wx_open_id = #{wxOpenId,jdbcType=VARCHAR},
      create_time = #{createTime,jdbcType=TIMESTAMP},
      end_time = #{endTime,jdbcType=TIMESTAMP},
      user_name = #{userName,jdbcType=VARCHAR}
    where id = #{id,jdbcType=INTEGER}
  </update>
    <resultMap id="BaseResultMap" type="com.ycl.jxkg.domain.UserToken">
        <id column="id" jdbcType="INTEGER" property="id"/>
        <result column="token" jdbcType="VARCHAR" property="token"/>
        <result column="user_id" jdbcType="INTEGER" property="userId"/>
        <result column="wx_open_id" jdbcType="VARCHAR" property="wxOpenId"/>
        <result column="create_time" jdbcType="TIMESTAMP" property="createTime"/>
        <result column="end_time" jdbcType="TIMESTAMP" property="endTime"/>
        <result column="user_name" jdbcType="VARCHAR" property="userName"/>
    </resultMap>
    <sql id="Base_Column_List">
        id
        , token, user_id, wx_open_id, create_time, end_time, user_name
    </sql>
  <select id="getToken" parameterType="java.lang.String" resultMap="BaseResultMap">
    select
    <include refid="Base_Column_List" />
    from t_user_token
    where token = #{token,jdbcType=VARCHAR}
    order by id desc
    limit 1
  </select>
    <select id="getToken" parameterType="java.lang.String" resultMap="BaseResultMap">
        select
        <include refid="Base_Column_List"/>
        from t_user_token
        where token = #{token,jdbcType=VARCHAR}
        order by id desc
        limit 1
    </select>
</mapper>