From 325dbefbcb95fd194f2df0591494701a7c60fbc1 Mon Sep 17 00:00:00 2001 From: wangxy <1356089412@qq.com> Date: Tue, 9 Jul 2024 09:38:24 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E9=94=99=E9=A2=98=E5=88=97=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/exam/UserBookController.java | 55 ++++++++++++++ .../controller/manager/UserBookManager.java | 23 ++++++ .../system/elExam/userBook/book.html | 73 +++++++++++++++++++ .../system/elExam/userExam/myGrades.html | 11 +++ .../domain/userbook/dto/UserBookDTO.java | 52 +++++++++++++ 5 files changed, 214 insertions(+) create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/web/controller/exam/UserBookController.java create mode 100644 ruoyi-admin/src/main/resources/templates/system/elExam/userBook/book.html create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/userbook/dto/UserBookDTO.java diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/exam/UserBookController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/exam/UserBookController.java new file mode 100644 index 0000000..417dbf5 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/exam/UserBookController.java @@ -0,0 +1,55 @@ +package com.ruoyi.web.controller.exam; + +import com.ruoyi.common.core.controller.BaseController; +import com.ruoyi.common.core.page.TableDataInfo; +import com.ruoyi.system.domain.userbook.dto.UserBookDTO; +import com.ruoyi.web.controller.manager.UserBookManager; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.springframework.stereotype.Controller; +import org.springframework.ui.ModelMap; +import org.springframework.web.bind.annotation.*; + +import javax.annotation.Resource; +import java.util.List; + +/** + * packageName com.ruoyi.web.controller.exam + * + * @author wangxy + * @version JDK 8 + * @className UserBookController + * @date 2024/7/9 + * @description 错题 + */ +@Api("错题") +@Controller +@RequestMapping("/system/userBook") +public class UserBookController extends BaseController { + + + private String prefix = "system/elExam/userBook"; + + @Resource + private UserBookManager userBookManager; + + @ApiOperation("错题列表") + @GetMapping("/toBook/{id}") + public String toBook(@PathVariable("id") String id, ModelMap mmap) { + mmap.put("examId", id); + return prefix + "/book"; + } + + + @ApiOperation("错题") + @PostMapping("/list") + @ResponseBody + public TableDataInfo list(UserBookDTO reqDTO) { + startPage(); + List list = userBookManager.paging(reqDTO); + return getDataTable(list); + } + + + +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/UserBookManager.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/UserBookManager.java index a4424f4..39f13ba 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/UserBookManager.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/manager/UserBookManager.java @@ -1,15 +1,18 @@ package com.ruoyi.web.controller.manager; +import cn.hutool.core.convert.Convert; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.ruoyi.common.utils.ShiroUtils; import com.ruoyi.system.domain.qu.ElQu; import com.ruoyi.system.domain.userbook.ElUserBook; +import com.ruoyi.system.domain.userbook.dto.UserBookDTO; import com.ruoyi.system.service.ElQuService; import com.ruoyi.system.service.ElUserBookService; import org.springframework.stereotype.Component; import javax.annotation.Resource; import java.util.Date; +import java.util.List; import java.util.Objects; /** @@ -77,5 +80,25 @@ public class UserBookManager { } + public List paging(UserBookDTO reqDTO) { + //查询条件 + QueryWrapper wrapper = new QueryWrapper<>(); + // 查找用户的错题 + wrapper.lambda().eq(ElUserBook::getUserId, ShiroUtils.getUserId()); + if(Objects.nonNull(reqDTO.getTitle())){ + wrapper.lambda().like(ElUserBook::getTitle, reqDTO.getTitle()); + } + if(Objects.nonNull(reqDTO.getExamId())){ + wrapper.lambda().eq(ElUserBook::getExamId, reqDTO.getExamId()); + } + List list = userBookService.list(wrapper); + return Convert.toList(UserBookDTO.class, list); + } + + + + + + } diff --git a/ruoyi-admin/src/main/resources/templates/system/elExam/userBook/book.html b/ruoyi-admin/src/main/resources/templates/system/elExam/userBook/book.html new file mode 100644 index 0000000..acca53a --- /dev/null +++ b/ruoyi-admin/src/main/resources/templates/system/elExam/userBook/book.html @@ -0,0 +1,73 @@ + + + + + + +
+
+
+
+
+ +
+
+
+ + + +
+
+
+
+
+ + + + diff --git a/ruoyi-admin/src/main/resources/templates/system/elExam/userExam/myGrades.html b/ruoyi-admin/src/main/resources/templates/system/elExam/userExam/myGrades.html index c952c1e..3719146 100644 --- a/ruoyi-admin/src/main/resources/templates/system/elExam/userExam/myGrades.html +++ b/ruoyi-admin/src/main/resources/templates/system/elExam/userExam/myGrades.html @@ -34,6 +34,7 @@ diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/userbook/dto/UserBookDTO.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/userbook/dto/UserBookDTO.java new file mode 100644 index 0000000..e1e28a0 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/userbook/dto/UserBookDTO.java @@ -0,0 +1,52 @@ +package com.ruoyi.system.domain.userbook.dto; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +import java.io.Serializable; +import java.util.Date; + +/** +*

+* 错题本请求类 +*

+* +* @author 聪明笨狗 +* @since 2020-05-27 17:56 +*/ +@Data +@ApiModel(value="错题本", description="错题本") +public class UserBookDTO implements Serializable { + + private static final long serialVersionUID = 1L; + + + @ApiModelProperty(value = "ID") + private String id; + + @ApiModelProperty(value = "考试ID") + private String examId; + + @ApiModelProperty(value = "用户ID") + private String userId; + + @ApiModelProperty(value = "题目ID") + private String quId; + + @ApiModelProperty(value = "加入时间") + private Date createTime; + + @ApiModelProperty(value = "最近错误时间") + private Date updateTime; + + @ApiModelProperty(value = "错误时间") + private Integer wrongCount; + + @ApiModelProperty(value = "题目标题") + private String title; + + @ApiModelProperty(value = "错题序号") + private Integer sort; + +} \ No newline at end of file