|
@@ -0,0 +1,164 @@
|
|
|
+package com.zhongzheng.controller.user;
|
|
|
+
|
|
|
+import com.zhongzheng.common.annotation.Log;
|
|
|
+import com.zhongzheng.common.core.controller.BaseController;
|
|
|
+import com.zhongzheng.common.core.domain.AjaxResult;
|
|
|
+import com.zhongzheng.common.core.page.TableDataInfo;
|
|
|
+import com.zhongzheng.common.enums.BusinessType;
|
|
|
+import com.zhongzheng.common.utils.ServletUtils;
|
|
|
+import com.zhongzheng.framework.web.service.WxTokenService;
|
|
|
+import com.zhongzheng.modules.user.bo.UserMockWrongRecordAddBo;
|
|
|
+import com.zhongzheng.modules.user.bo.UserMockWrongRecordEditBo;
|
|
|
+import com.zhongzheng.modules.user.bo.UserMockWrongRecordQueryBo;
|
|
|
+import com.zhongzheng.modules.user.entity.ClientLoginUser;
|
|
|
+import com.zhongzheng.modules.user.service.IUserMockWrongRecordService;
|
|
|
+import com.zhongzheng.modules.user.vo.UserMockWrongRecordVo;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import lombok.RequiredArgsConstructor;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.Arrays;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * 用户模考错题记录Controller
|
|
|
+ *
|
|
|
+ * @author tzh
|
|
|
+ * @date 2022-6-1
|
|
|
+ */
|
|
|
+@Api(value = "用户模考错题记录控制器", tags = {"用户模考错题记录管理"})
|
|
|
+@RequiredArgsConstructor(onConstructor_ = @Autowired)
|
|
|
+@RestController
|
|
|
+@RequestMapping("/mock/wwrong/record")
|
|
|
+public class UserMockWrongRecordController extends BaseController {
|
|
|
+
|
|
|
+ private final IUserMockWrongRecordService iUserMockWrongRecordService;
|
|
|
+
|
|
|
+ private final WxTokenService wxTokenService;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 查询用户模考错题记录列表
|
|
|
+ */
|
|
|
+ @ApiOperation("查询用户模考错题记录列表-按试卷")
|
|
|
+ @GetMapping("/list")
|
|
|
+ public TableDataInfo<UserMockWrongRecordVo> list(UserMockWrongRecordQueryBo bo) {
|
|
|
+ ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ bo.setUserId(loginUser.getUser().getUserId());
|
|
|
+ startPage();
|
|
|
+ List<UserMockWrongRecordVo> list = iUserMockWrongRecordService.selectList(bo);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("按类型获取收藏数量")
|
|
|
+ @GetMapping("/type_list")
|
|
|
+ public TableDataInfo<UserMockWrongRecordVo> type_list(UserMockWrongRecordQueryBo bo) {
|
|
|
+ ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ bo.setUserId(loginUser.getUser().getUserId());
|
|
|
+ startPage();
|
|
|
+ List<UserMockWrongRecordVo> list = iUserMockWrongRecordService.selectTypeNum(bo);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("试卷获取题目列表")
|
|
|
+ @GetMapping("/exam_question_list")
|
|
|
+ public TableDataInfo<UserMockWrongRecordVo> selectQuestionList(UserMockWrongRecordQueryBo bo) {
|
|
|
+ ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ bo.setUserId(loginUser.getUser().getUserId());
|
|
|
+ startPage();
|
|
|
+ List<UserMockWrongRecordVo> list = iUserMockWrongRecordService.selectQuestionList(bo);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation("类型获取题目列表")
|
|
|
+ @GetMapping("/type_question_list")
|
|
|
+ public TableDataInfo<UserMockWrongRecordVo> type_question_list(UserMockWrongRecordQueryBo bo) {
|
|
|
+ ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ bo.setUserId(loginUser.getUser().getUserId());
|
|
|
+ startPage();
|
|
|
+ List<UserMockWrongRecordVo> list = iUserMockWrongRecordService.selectTypeQuestionList(bo);
|
|
|
+ return getDataTable(list);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ *
|
|
|
+ * 导出用户模考错题记录列表
|
|
|
+ */
|
|
|
+ /*@ApiOperation("导出用户模考错题记录列表")
|
|
|
+ @PreAuthorize("@ss.hasPermi('system:record:export')")
|
|
|
+ @Log(title = "用户模考错题记录", businessType = BusinessType.EXPORT)
|
|
|
+ @GetMapping("/export")
|
|
|
+ public AjaxResult<UserMockWrongRecordVo> export(UserMockWrongRecordQueryBo bo) {
|
|
|
+ List<UserMockWrongRecordVo> list = iUserMockWrongRecordService.queryList(bo);
|
|
|
+ ExcelUtil<UserMockWrongRecordVo> util = new ExcelUtil<UserMockWrongRecordVo>(UserMockWrongRecordVo.class);
|
|
|
+ return util.exportExcel(list, "用户模考错题记录");
|
|
|
+ }*/
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获取用户模考错题记录详细信息
|
|
|
+ */
|
|
|
+ @ApiOperation("获取用户模考错题记录详细信息")
|
|
|
+ @GetMapping("/{wrongId}")
|
|
|
+ public AjaxResult<UserMockWrongRecordVo> getInfo(@PathVariable("wrongId" ) Long wrongId) {
|
|
|
+ return AjaxResult.success(iUserMockWrongRecordService.queryById(wrongId));
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation("获取用户报告错题数")
|
|
|
+ @GetMapping("/wrongNum/{recordId}")
|
|
|
+ public AjaxResult<Long> wrongNum(@PathVariable("recordId" ) Long recordId) {
|
|
|
+ ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ UserMockWrongRecordQueryBo wBo = new UserMockWrongRecordQueryBo();
|
|
|
+ wBo.setRecordId(recordId);
|
|
|
+ wBo.setUserId(loginUser.getUser().getUserId());
|
|
|
+ return AjaxResult.success(iUserMockWrongRecordService.recordNum(wBo));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 新增用户模考错题记录
|
|
|
+ */
|
|
|
+ @ApiOperation("新增用户模考错题记录")
|
|
|
+ @Log(title = "用户模考错题记录", businessType = BusinessType.INSERT)
|
|
|
+ @PostMapping()
|
|
|
+ public AjaxResult<Void> add(@RequestBody UserMockWrongRecordAddBo bo) {
|
|
|
+ ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ bo.setUserId(loginUser.getUser().getUserId());
|
|
|
+ return toAjax(iUserMockWrongRecordService.insertByAddBo(bo) ? 1 : 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 修改用户模考错题记录
|
|
|
+ */
|
|
|
+ @ApiOperation("修改用户模考错题记录")
|
|
|
+ @Log(title = "用户模考错题记录", businessType = BusinessType.UPDATE)
|
|
|
+ @PostMapping("/edit")
|
|
|
+ public AjaxResult<Void> edit(@RequestBody UserMockWrongRecordEditBo bo) {
|
|
|
+ ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ bo.setUserId(loginUser.getUser().getUserId());
|
|
|
+ return toAjax(iUserMockWrongRecordService.updateByEditBo(bo) ? 1 : 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除用户模考错题记录
|
|
|
+ */
|
|
|
+ @ApiOperation("删除用户模考错题记录")
|
|
|
+ @Log(title = "用户模考错题记录" , businessType = BusinessType.DELETE)
|
|
|
+ @PostMapping("/delete/{wrongIds}")
|
|
|
+ public AjaxResult<Void> remove(@PathVariable Long[] wrongIds) {
|
|
|
+ return toAjax(iUserMockWrongRecordService.deleteWithValidByIds(Arrays.asList(wrongIds), true) ? 1 : 0);
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除用户模考错题记录
|
|
|
+ */
|
|
|
+ @ApiOperation("删除用户模考错题记录")
|
|
|
+ @Log(title = "用户模考错题记录" , businessType = BusinessType.DELETE)
|
|
|
+ @PostMapping("/delete/question")
|
|
|
+ public AjaxResult<Void> remove_question(@RequestBody UserMockWrongRecordQueryBo bo) {
|
|
|
+
|
|
|
+ ClientLoginUser loginUser = wxTokenService.getLoginUser(ServletUtils.getRequest());
|
|
|
+ bo.setUserId(loginUser.getUser().getUserId());
|
|
|
+ return toAjax(iUserMockWrongRecordService.remove_question(bo));
|
|
|
+ }
|
|
|
+}
|