我的错题、我的收藏、优化
This commit is contained in:
parent
e70f27a7a1
commit
fd77d1885e
|
|
@ -2,10 +2,7 @@ package com.ruoyi.exam.controller;
|
||||||
|
|
||||||
import com.ruoyi.common.base.AjaxResult;
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
import com.ruoyi.exam.domain.*;
|
import com.ruoyi.exam.domain.*;
|
||||||
import com.ruoyi.exam.service.IExamPracticeQuestionService;
|
import com.ruoyi.exam.service.*;
|
||||||
import com.ruoyi.exam.service.IExamPracticeService;
|
|
||||||
import com.ruoyi.exam.service.IExamQuestionService;
|
|
||||||
import com.ruoyi.exam.service.IExamUserErrorQuestionService;
|
|
||||||
import com.ruoyi.framework.jwt.JwtUtil;
|
import com.ruoyi.framework.jwt.JwtUtil;
|
||||||
import com.ruoyi.framework.web.base.BaseController;
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||||
|
|
@ -22,7 +19,7 @@ import java.util.*;
|
||||||
/**
|
/**
|
||||||
* Created by flower on 2019/1/9.
|
* Created by flower on 2019/1/9.
|
||||||
*/
|
*/
|
||||||
@Api("练习")
|
@Api("练习接口")
|
||||||
@RestController
|
@RestController
|
||||||
@RequestMapping("/api")
|
@RequestMapping("/api")
|
||||||
public class ApiPracticeController extends BaseController {
|
public class ApiPracticeController extends BaseController {
|
||||||
|
|
@ -30,20 +27,17 @@ public class ApiPracticeController extends BaseController {
|
||||||
@Autowired
|
@Autowired
|
||||||
private IExamPracticeService examPracticeService;
|
private IExamPracticeService examPracticeService;
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IExamPracticeQuestionService examPracticeQuestionService;
|
|
||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IExamQuestionService examQuestionService;
|
private IExamQuestionService examQuestionService;
|
||||||
|
|
||||||
@Autowired
|
/**
|
||||||
private IExamUserErrorQuestionService examUserErrorQuestionService;
|
* 查询练习列表
|
||||||
|
* @param examPractice
|
||||||
@Autowired
|
* @return
|
||||||
private ISysUserService sysUserService;
|
*/
|
||||||
|
|
||||||
@GetMapping("/v1/practice/list")
|
@GetMapping("/v1/practice/list")
|
||||||
public AjaxResult list(ExamPractice examPractice) {
|
public AjaxResult list(@RequestParam ExamPractice examPractice) {
|
||||||
|
|
||||||
List<ExamPracticeVO> list = examPracticeService.selectListFromWeb(examPractice);
|
List<ExamPracticeVO> list = examPracticeService.selectListFromWeb(examPractice);
|
||||||
AjaxResult success = success("查询成功");
|
AjaxResult success = success("查询成功");
|
||||||
|
|
@ -52,7 +46,7 @@ public class ApiPracticeController extends BaseController {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询练习具体的问题列表
|
* 查询练习题库的问题列表
|
||||||
*
|
*
|
||||||
* @param map
|
* @param map
|
||||||
* @return
|
* @return
|
||||||
|
|
@ -68,60 +62,4 @@ public class ApiPracticeController extends BaseController {
|
||||||
return success;
|
return success;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* 保存错题记录
|
|
||||||
*
|
|
||||||
* @param questionIds
|
|
||||||
* @return
|
|
||||||
* @description 练习时答错题就保存到错题记录中
|
|
||||||
* 传入问题id
|
|
||||||
*/
|
|
||||||
@PostMapping("/v1/practice/answer")
|
|
||||||
public AjaxResult answer(@RequestBody List<String> questionIds) {
|
|
||||||
for (String questionId : questionIds) {
|
|
||||||
ExamUserErrorQuestion examUserErrorQuestion = new ExamUserErrorQuestion();
|
|
||||||
examUserErrorQuestion.setExamQuestionId(Integer.parseInt(questionId));
|
|
||||||
SysUser sysUser = sysUserService.selectUserByLoginName( JwtUtil.getLoginName() );
|
|
||||||
examUserErrorQuestion.setVipUserId(sysUser.getUserId().intValue());
|
|
||||||
examUserErrorQuestion.setCreateBy(sysUser.getLoginName());
|
|
||||||
examUserErrorQuestion.setCreateDate(new Date());
|
|
||||||
examUserErrorQuestion.setDelFlag("0");
|
|
||||||
examUserErrorQuestion.setUpdateBy(sysUser.getLoginName());
|
|
||||||
examUserErrorQuestion.setUpdateDate(new Date());
|
|
||||||
int insert = examUserErrorQuestionService.insertError( examUserErrorQuestion );
|
|
||||||
}
|
|
||||||
AjaxResult success = success("插入错题本成功");
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询我的错题列表
|
|
||||||
*
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GetMapping("/v1/practice/error")
|
|
||||||
public AjaxResult queryError() {
|
|
||||||
ExamUserErrorQuestion examUserErrorQuestion = new ExamUserErrorQuestion();
|
|
||||||
SysUser sysUser = sysUserService.selectUserByLoginName( JwtUtil.getLoginName() );
|
|
||||||
examUserErrorQuestion.setVipUserId(sysUser.getUserId().intValue());
|
|
||||||
List<ExamUserErrorQuestionVO> list = examUserErrorQuestionService.selectExamUserErrorQuestionDetailPage(examUserErrorQuestion);
|
|
||||||
AjaxResult success = success("查询成功");
|
|
||||||
success.put("data", list);
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询问题详情
|
|
||||||
*
|
|
||||||
* @param id
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
@GetMapping("/v1/practice/question/{id}")
|
|
||||||
public AjaxResult queryQuestion(@PathVariable("id") String id) {
|
|
||||||
ExamQuestionVO result = examQuestionService.selectQuestionDetail(id);
|
|
||||||
AjaxResult success = success("查询成功");
|
|
||||||
success.put("data", result);
|
|
||||||
return success;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,94 @@
|
||||||
|
package com.ruoyi.exam.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
|
import com.ruoyi.exam.domain.*;
|
||||||
|
import com.ruoyi.exam.service.*;
|
||||||
|
import com.ruoyi.framework.jwt.JwtUtil;
|
||||||
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
|
import com.ruoyi.system.domain.SysUser;
|
||||||
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by flower on 2019/1/9.
|
||||||
|
*/
|
||||||
|
@Api("收藏接口")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api")
|
||||||
|
public class ApiUserCollectionQuestionController extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysUserService sysUserService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IExamUserCollectionQuestionService examUserCollectionQuestionService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存收藏记录
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/v1/practice/collection/{id}")
|
||||||
|
public AjaxResult answer(@PathVariable("id") Integer id) {
|
||||||
|
ExamUserCollectionQuestion examUserCollectionQuestion = new ExamUserCollectionQuestion();
|
||||||
|
examUserCollectionQuestion.setExamQuestionId(id);
|
||||||
|
SysUser sysUser = sysUserService.selectUserByLoginName( JwtUtil.getLoginName() );
|
||||||
|
examUserCollectionQuestion.setVipUserId(sysUser.getUserId().intValue());
|
||||||
|
examUserCollectionQuestion.setCreateBy(sysUser.getLoginName());
|
||||||
|
examUserCollectionQuestion.setCreateDate(new Date());
|
||||||
|
examUserCollectionQuestion.setDelFlag("0");
|
||||||
|
examUserCollectionQuestion.setUpdateBy(sysUser.getLoginName());
|
||||||
|
examUserCollectionQuestion.setUpdateDate(new Date());
|
||||||
|
int insert = examUserCollectionQuestionService.insertSelectiveBySelf(examUserCollectionQuestion );
|
||||||
|
AjaxResult success = success("插入我的收藏记录成功");
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 我的收藏显示列表(分页)
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/v1/question/collection/page")
|
||||||
|
public AjaxResult collectionPage(){
|
||||||
|
ExamUserCollectionQuestion examUserCollectionQuestion=new ExamUserCollectionQuestion();
|
||||||
|
SysUser sysUser = sysUserService.selectUserByLoginName( JwtUtil.getLoginName() );
|
||||||
|
examUserCollectionQuestion.setVipUserId(sysUser.getUserId().intValue());
|
||||||
|
List<ExamUserCollectionQuestion> list = examUserCollectionQuestionService.selectExamUserCollectionQuestionPage(examUserCollectionQuestion);
|
||||||
|
AjaxResult success = success("查询我的收藏成功");
|
||||||
|
success.put("data", list);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 我的收藏显示列表(不分页)
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/v1/question/collection/list")
|
||||||
|
public AjaxResult collectionList(){
|
||||||
|
ExamUserCollectionQuestion examUserCollectionQuestion=new ExamUserCollectionQuestion();
|
||||||
|
SysUser sysUser = sysUserService.selectUserByLoginName( JwtUtil.getLoginName() );
|
||||||
|
examUserCollectionQuestion.setVipUserId(sysUser.getUserId().intValue());
|
||||||
|
List<ExamUserCollectionQuestion> list = examUserCollectionQuestionService.selectExamUserCollectionQuestionPage(examUserCollectionQuestion);
|
||||||
|
AjaxResult success = success("查询我的收藏成功");
|
||||||
|
success.put("data", list);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 删除我的收藏记录
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/v1/question/collection/delete/{id}")
|
||||||
|
public AjaxResult deleteCollectionQuestion(@PathVariable("id") String id) {
|
||||||
|
examUserCollectionQuestionService.deleteById(id);
|
||||||
|
AjaxResult success = success("删除成功");
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,113 @@
|
||||||
|
package com.ruoyi.exam.controller;
|
||||||
|
|
||||||
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
|
import com.ruoyi.exam.domain.*;
|
||||||
|
import com.ruoyi.exam.service.*;
|
||||||
|
import com.ruoyi.framework.jwt.JwtUtil;
|
||||||
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
|
import com.ruoyi.system.domain.SysUser;
|
||||||
|
import com.ruoyi.system.service.ISysUserService;
|
||||||
|
import io.swagger.annotations.Api;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.*;
|
||||||
|
|
||||||
|
import java.util.Collections;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by flower on 2019/1/9.
|
||||||
|
*/
|
||||||
|
@Api("错题接口")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api")
|
||||||
|
public class ApiUserErrorQuestionController extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IExamPracticeService examPracticeService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IExamPracticeQuestionService examPracticeQuestionService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IExamQuestionService examQuestionService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IExamUserErrorQuestionService examUserErrorQuestionService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysUserService sysUserService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IExamUserCollectionQuestionService examUserCollectionQuestionService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 保存错题记录
|
||||||
|
*
|
||||||
|
* @param questionIds
|
||||||
|
* @return
|
||||||
|
* @description 练习时答错题就保存到错题记录中
|
||||||
|
* 传入问题id
|
||||||
|
*/
|
||||||
|
@PostMapping("/v1/practice/answer")
|
||||||
|
public AjaxResult answer(@RequestBody List<String> questionIds) {
|
||||||
|
for (String questionId : questionIds) {
|
||||||
|
ExamUserErrorQuestion examUserErrorQuestion = new ExamUserErrorQuestion();
|
||||||
|
examUserErrorQuestion.setExamQuestionId(Integer.parseInt(questionId));
|
||||||
|
SysUser sysUser = sysUserService.selectUserByLoginName( JwtUtil.getLoginName() );
|
||||||
|
examUserErrorQuestion.setVipUserId(sysUser.getUserId().intValue());
|
||||||
|
examUserErrorQuestion.setCreateBy(sysUser.getLoginName());
|
||||||
|
examUserErrorQuestion.setCreateDate(new Date());
|
||||||
|
examUserErrorQuestion.setDelFlag("0");
|
||||||
|
examUserErrorQuestion.setUpdateBy(sysUser.getLoginName());
|
||||||
|
examUserErrorQuestion.setUpdateDate(new Date());
|
||||||
|
int insert = examUserErrorQuestionService.insertError( examUserErrorQuestion );
|
||||||
|
}
|
||||||
|
AjaxResult success = success("插入错题本成功");
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询我的错题列表
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/v1/practice/error")
|
||||||
|
public AjaxResult queryError() {
|
||||||
|
ExamUserErrorQuestion examUserErrorQuestion = new ExamUserErrorQuestion();
|
||||||
|
SysUser sysUser = sysUserService.selectUserByLoginName( JwtUtil.getLoginName() );
|
||||||
|
examUserErrorQuestion.setVipUserId(sysUser.getUserId().intValue());
|
||||||
|
List<ExamUserErrorQuestionVO> list = examUserErrorQuestionService.selectExamUserErrorQuestionDetailPage(examUserErrorQuestion);
|
||||||
|
AjaxResult success = success("查询成功");
|
||||||
|
success.put("data", list);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询问题详情
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/v1/question/{id}")
|
||||||
|
public AjaxResult queryQuestion(@PathVariable("id") String id) {
|
||||||
|
ExamQuestionVO result = examQuestionService.selectQuestionDetail(id);
|
||||||
|
AjaxResult success = success("查询成功");
|
||||||
|
success.put("data", result);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 删除错题记录
|
||||||
|
*
|
||||||
|
* @param id
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/v1/question/error/delete/{id}")
|
||||||
|
public AjaxResult deleteErrorQuestion(@PathVariable("id") String id) {
|
||||||
|
examUserErrorQuestionService.deleteById(id);
|
||||||
|
AjaxResult success = success("删除成功");
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,126 @@
|
||||||
|
package com.ruoyi.exam.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.apache.shiro.authz.annotation.RequiresPermissions;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Controller;
|
||||||
|
import org.springframework.ui.ModelMap;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.ResponseBody;
|
||||||
|
import com.ruoyi.common.annotation.Log;
|
||||||
|
import com.ruoyi.common.enums.BusinessType;
|
||||||
|
import com.ruoyi.exam.domain.ExamUserCollectionQuestion;
|
||||||
|
import com.ruoyi.exam.service.IExamUserCollectionQuestionService;
|
||||||
|
import com.ruoyi.framework.web.base.BaseController;
|
||||||
|
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||||
|
import com.ruoyi.common.base.AjaxResult;
|
||||||
|
import com.ruoyi.common.utils.ExcelUtil;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 我的收藏 信息操作处理
|
||||||
|
*
|
||||||
|
* @author zhujj
|
||||||
|
* @date 2019-01-16
|
||||||
|
*/
|
||||||
|
@Controller
|
||||||
|
@RequestMapping("/exam/examUserCollectionQuestion")
|
||||||
|
public class ExamUserCollectionQuestionController extends BaseController
|
||||||
|
{
|
||||||
|
private String prefix = "exam/examUserCollectionQuestion";
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IExamUserCollectionQuestionService examUserCollectionQuestionService;
|
||||||
|
|
||||||
|
@RequiresPermissions("exam:examUserCollectionQuestion:view")
|
||||||
|
@GetMapping()
|
||||||
|
public String examUserCollectionQuestion()
|
||||||
|
{
|
||||||
|
return prefix + "/examUserCollectionQuestion";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询我的收藏列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("exam:examUserCollectionQuestion:list")
|
||||||
|
@PostMapping("/list")
|
||||||
|
@ResponseBody
|
||||||
|
public TableDataInfo list(ExamUserCollectionQuestion examUserCollectionQuestion)
|
||||||
|
{
|
||||||
|
List<ExamUserCollectionQuestion> list = examUserCollectionQuestionService.selectExamUserCollectionQuestionPage(examUserCollectionQuestion);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出我的收藏列表
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("exam:examUserCollectionQuestion:export")
|
||||||
|
@PostMapping("/export")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult export(ExamUserCollectionQuestion examUserCollectionQuestion)
|
||||||
|
{
|
||||||
|
List<ExamUserCollectionQuestion> list = examUserCollectionQuestionService.selectExamUserCollectionQuestionList(examUserCollectionQuestion);
|
||||||
|
ExcelUtil<ExamUserCollectionQuestion> util = new ExcelUtil<ExamUserCollectionQuestion>(ExamUserCollectionQuestion.class);
|
||||||
|
return util.exportExcel(list, "examUserCollectionQuestion");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增我的收藏
|
||||||
|
*/
|
||||||
|
@GetMapping("/add")
|
||||||
|
public String add()
|
||||||
|
{
|
||||||
|
return prefix + "/add";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增保存我的收藏
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("exam:examUserCollectionQuestion:add")
|
||||||
|
@Log(title = "我的收藏", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping("/add")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult addSave(ExamUserCollectionQuestion examUserCollectionQuestion)
|
||||||
|
{
|
||||||
|
return toAjax(examUserCollectionQuestionService.insert(examUserCollectionQuestion));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改我的收藏
|
||||||
|
*/
|
||||||
|
@GetMapping("/edit/{id}")
|
||||||
|
public String edit(@PathVariable("id") Integer id, ModelMap mmap)
|
||||||
|
{
|
||||||
|
ExamUserCollectionQuestion examUserCollectionQuestion = examUserCollectionQuestionService.selectById(id);
|
||||||
|
mmap.put("examUserCollectionQuestion", examUserCollectionQuestion);
|
||||||
|
return prefix + "/edit";
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改保存我的收藏
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("exam:examUserCollectionQuestion:edit")
|
||||||
|
@Log(title = "我的收藏", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/edit")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult editSave(ExamUserCollectionQuestion examUserCollectionQuestion)
|
||||||
|
{
|
||||||
|
return toAjax(examUserCollectionQuestionService.updateById(examUserCollectionQuestion));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除我的收藏
|
||||||
|
*/
|
||||||
|
@RequiresPermissions("exam:examUserCollectionQuestion:remove")
|
||||||
|
@Log(title = "我的收藏", businessType = BusinessType.DELETE)
|
||||||
|
@PostMapping( "/remove")
|
||||||
|
@ResponseBody
|
||||||
|
public AjaxResult remove(String ids)
|
||||||
|
{
|
||||||
|
return toAjax(examUserCollectionQuestionService.deleteByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,152 @@
|
||||||
|
package com.ruoyi.exam.domain;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.ruoyi.common.base.BaseEntity;
|
||||||
|
import javax.persistence.Id;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 我的收藏表 exam_user_collection_question
|
||||||
|
*
|
||||||
|
* @author zhujj
|
||||||
|
* @date 2019-01-16
|
||||||
|
*/
|
||||||
|
public class ExamUserCollectionQuestion
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 练习对象 */
|
||||||
|
@Id
|
||||||
|
private Integer id;
|
||||||
|
/** 会员代码 */
|
||||||
|
private Integer vipUserId;
|
||||||
|
/** 练习题代码 */
|
||||||
|
private Integer examQuestionId;
|
||||||
|
/** 创建者 */
|
||||||
|
private String createBy;
|
||||||
|
/** 创建时间 */
|
||||||
|
private Date createDate;
|
||||||
|
/** 更新者 */
|
||||||
|
private String updateBy;
|
||||||
|
/** 更新时间 */
|
||||||
|
private Date updateDate;
|
||||||
|
/** 备注信息 */
|
||||||
|
private String remarks;
|
||||||
|
/** 删除标记 */
|
||||||
|
private String delFlag;
|
||||||
|
|
||||||
|
/** 设置练习对象 */
|
||||||
|
public void setId(Integer id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取练习对象 */
|
||||||
|
public Integer getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
/** 设置会员代码 */
|
||||||
|
public void setVipUserId(Integer vipUserId)
|
||||||
|
{
|
||||||
|
this.vipUserId = vipUserId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取会员代码 */
|
||||||
|
public Integer getVipUserId()
|
||||||
|
{
|
||||||
|
return vipUserId;
|
||||||
|
}
|
||||||
|
/** 设置练习题代码 */
|
||||||
|
public void setExamQuestionId(Integer examQuestionId)
|
||||||
|
{
|
||||||
|
this.examQuestionId = examQuestionId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取练习题代码 */
|
||||||
|
public Integer getExamQuestionId()
|
||||||
|
{
|
||||||
|
return examQuestionId;
|
||||||
|
}
|
||||||
|
/** 设置创建者 */
|
||||||
|
public void setCreateBy(String createBy)
|
||||||
|
{
|
||||||
|
this.createBy = createBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取创建者 */
|
||||||
|
public String getCreateBy()
|
||||||
|
{
|
||||||
|
return createBy;
|
||||||
|
}
|
||||||
|
/** 设置创建时间 */
|
||||||
|
public void setCreateDate(Date createDate)
|
||||||
|
{
|
||||||
|
this.createDate = createDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取创建时间 */
|
||||||
|
public Date getCreateDate()
|
||||||
|
{
|
||||||
|
return createDate;
|
||||||
|
}
|
||||||
|
/** 设置更新者 */
|
||||||
|
public void setUpdateBy(String updateBy)
|
||||||
|
{
|
||||||
|
this.updateBy = updateBy;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取更新者 */
|
||||||
|
public String getUpdateBy()
|
||||||
|
{
|
||||||
|
return updateBy;
|
||||||
|
}
|
||||||
|
/** 设置更新时间 */
|
||||||
|
public void setUpdateDate(Date updateDate)
|
||||||
|
{
|
||||||
|
this.updateDate = updateDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取更新时间 */
|
||||||
|
public Date getUpdateDate()
|
||||||
|
{
|
||||||
|
return updateDate;
|
||||||
|
}
|
||||||
|
/** 设置备注信息 */
|
||||||
|
public void setRemarks(String remarks)
|
||||||
|
{
|
||||||
|
this.remarks = remarks;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取备注信息 */
|
||||||
|
public String getRemarks()
|
||||||
|
{
|
||||||
|
return remarks;
|
||||||
|
}
|
||||||
|
/** 设置删除标记 */
|
||||||
|
public void setDelFlag(String delFlag)
|
||||||
|
{
|
||||||
|
this.delFlag = delFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取删除标记 */
|
||||||
|
public String getDelFlag()
|
||||||
|
{
|
||||||
|
return delFlag;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("vipUserId", getVipUserId())
|
||||||
|
.append("examQuestionId", getExamQuestionId())
|
||||||
|
.append("createBy", getCreateBy())
|
||||||
|
.append("createDate", getCreateDate())
|
||||||
|
.append("updateBy", getUpdateBy())
|
||||||
|
.append("updateDate", getUpdateDate())
|
||||||
|
.append("remarks", getRemarks())
|
||||||
|
.append("delFlag", getDelFlag())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -63,11 +63,47 @@ public interface ExamQuestionMapper extends MyMapper<ExamQuestion>
|
||||||
*/
|
*/
|
||||||
public int deleteExamQuestionByIds(String[] ids);
|
public int deleteExamQuestionByIds(String[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据分类筛选题库
|
||||||
|
* @param examQuestion
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
List<ExamQuestion> selectListBycategory(ExamQuestion examQuestion);
|
List<ExamQuestion> selectListBycategory(ExamQuestion examQuestion);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询练习题库
|
||||||
|
* @param map
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
List<ExamQuestionVO> selectQuestionListByPracticeId(Map<String, Object> map);
|
List<ExamQuestionVO> selectQuestionListByPracticeId(Map<String, Object> map);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询问题详情
|
||||||
|
* @param questionId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
ExamQuestionVO selectQuestionDetail(String questionId);
|
ExamQuestionVO selectQuestionDetail(String questionId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询试卷题库
|
||||||
|
* @param examPaperId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
List<ExamQuestionVO> selectQuestionListByPaperId(Integer examPaperId);
|
List<ExamQuestionVO> selectQuestionListByPaperId(Integer examPaperId);
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询我的错题
|
||||||
|
* @param vipUserId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<ExamQuestionVO> selectQuestionListByUserError(Integer vipUserId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询我的收藏
|
||||||
|
* @param vipUserId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<ExamQuestionVO> selectQuestionListByUserCollection(Integer vipUserId);
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.ruoyi.exam.mapper;
|
||||||
|
|
||||||
|
import com.ruoyi.exam.domain.ExamUserCollectionQuestion;
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.framework.web.base.MyMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 我的收藏 数据层
|
||||||
|
*
|
||||||
|
* @author zhujj
|
||||||
|
* @date 2019-01-16
|
||||||
|
*/
|
||||||
|
public interface ExamUserCollectionQuestionMapper extends MyMapper<ExamUserCollectionQuestion>
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询我的收藏列表
|
||||||
|
*
|
||||||
|
* @param examUserCollectionQuestion 我的收藏信息
|
||||||
|
* @return 我的收藏集合
|
||||||
|
*/
|
||||||
|
public List<ExamUserCollectionQuestion> selectExamUserCollectionQuestionList(ExamUserCollectionQuestion examUserCollectionQuestion);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
package com.ruoyi.exam.service;
|
||||||
|
|
||||||
|
import com.ruoyi.exam.domain.ExamUserCollectionQuestion;
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.framework.web.base.AbstractBaseService;
|
||||||
|
/**
|
||||||
|
* 我的收藏 服务层
|
||||||
|
*
|
||||||
|
* @author zhujj
|
||||||
|
* @date 2019-01-16
|
||||||
|
*/
|
||||||
|
public interface IExamUserCollectionQuestionService extends AbstractBaseService<ExamUserCollectionQuestion>
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询我的收藏分页列表
|
||||||
|
*
|
||||||
|
* @param examUserCollectionQuestion 我的收藏信息
|
||||||
|
* @return 我的收藏集合
|
||||||
|
*/
|
||||||
|
public List<ExamUserCollectionQuestion> selectExamUserCollectionQuestionPage(ExamUserCollectionQuestion examUserCollectionQuestion);
|
||||||
|
/**
|
||||||
|
* 查询我的收藏列表
|
||||||
|
*
|
||||||
|
* @param examUserCollectionQuestion 我的收藏信息
|
||||||
|
* @return 我的收藏集合
|
||||||
|
*/
|
||||||
|
public List<ExamUserCollectionQuestion> selectExamUserCollectionQuestionList(ExamUserCollectionQuestion examUserCollectionQuestion);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 插入收藏题库
|
||||||
|
* @param examUserCollectionQuestion
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
int insertSelectiveBySelf(ExamUserCollectionQuestion examUserCollectionQuestion);
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,54 @@
|
||||||
|
package com.ruoyi.exam.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.ruoyi.exam.mapper.ExamUserCollectionQuestionMapper;
|
||||||
|
import com.ruoyi.exam.domain.ExamUserCollectionQuestion;
|
||||||
|
import com.ruoyi.exam.service.IExamUserCollectionQuestionService;
|
||||||
|
import com.ruoyi.common.support.Convert;
|
||||||
|
import com.ruoyi.framework.web.base.AbstractBaseServiceImpl;
|
||||||
|
/**
|
||||||
|
* 我的收藏 服务层实现
|
||||||
|
*
|
||||||
|
* @author zhujj
|
||||||
|
* @date 2019-01-16
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ExamUserCollectionQuestionServiceImpl extends AbstractBaseServiceImpl<ExamUserCollectionQuestionMapper,ExamUserCollectionQuestion> implements IExamUserCollectionQuestionService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ExamUserCollectionQuestionMapper examUserCollectionQuestionMapper;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询我的收藏列表
|
||||||
|
*
|
||||||
|
* @param examUserCollectionQuestion 我的收藏信息
|
||||||
|
* @return 我的收藏集合
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<ExamUserCollectionQuestion> selectExamUserCollectionQuestionList(ExamUserCollectionQuestion examUserCollectionQuestion)
|
||||||
|
{
|
||||||
|
return examUserCollectionQuestionMapper.selectExamUserCollectionQuestionList(examUserCollectionQuestion);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int insertSelectiveBySelf(ExamUserCollectionQuestion examUserCollectionQuestion) {
|
||||||
|
return examUserCollectionQuestionMapper.insertSelective(examUserCollectionQuestion);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询我的收藏分页列表
|
||||||
|
*
|
||||||
|
* @param examUserCollectionQuestion 我的收藏信息
|
||||||
|
* @return 我的收藏集合
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<ExamUserCollectionQuestion> selectExamUserCollectionQuestionPage(ExamUserCollectionQuestion examUserCollectionQuestion)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
return examUserCollectionQuestionMapper.selectExamUserCollectionQuestionList(examUserCollectionQuestion);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -108,7 +108,34 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
where epq.exam_practice_id = #{practiceId}
|
where epq.exam_practice_id = #{practiceId}
|
||||||
order by epq.order_num
|
order by epq.order_num
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectQuestionListByUserError" resultMap="ExamQuestionResultVO">
|
||||||
|
select eq.id, eq.title, eq.answer, eq.type, eq.label, eq.category_id,
|
||||||
|
eq.create_by, eq.create_date, eq.update_by, eq.update_date, eq.remarks, eq.del_flag ,
|
||||||
|
eqi.id AS item_id,
|
||||||
|
eqi.content AS item_content,
|
||||||
|
eqi.number AS item_number,
|
||||||
|
eqi.exam_question_id AS item_exam_question_id,
|
||||||
|
eqi.remarks AS item_remarks
|
||||||
|
from exam_user_error_question eueq
|
||||||
|
INNER JOIN exam_question eq ON eq.id = eueq.exam_question_id
|
||||||
|
INNER JOIN exam_question_item eqi ON eqi.exam_question_id = eq.id
|
||||||
|
where eueq.vip_user_id = #{vipUserId}
|
||||||
|
order by eueq.update_date
|
||||||
|
</select>
|
||||||
|
<select id="selectQuestionListByUserCollection" resultMap="ExamQuestionResultVO">
|
||||||
|
select eq.id, eq.title, eq.answer, eq.type, eq.label, eq.category_id,
|
||||||
|
eq.create_by, eq.create_date, eq.update_by, eq.update_date, eq.remarks, eq.del_flag ,
|
||||||
|
eqi.id AS item_id,
|
||||||
|
eqi.content AS item_content,
|
||||||
|
eqi.number AS item_number,
|
||||||
|
eqi.exam_question_id AS item_exam_question_id,
|
||||||
|
eqi.remarks AS item_remarks
|
||||||
|
from exam_user_collection_question eueq
|
||||||
|
INNER JOIN exam_question eq ON eq.id = eueq.exam_question_id
|
||||||
|
INNER JOIN exam_question_item eqi ON eqi.exam_question_id = eq.id
|
||||||
|
where eueq.vip_user_id = #{vipUserId}
|
||||||
|
order by eueq.update_date
|
||||||
|
</select>
|
||||||
<select id="selectQuestionDetail" resultMap="ExamQuestionResultVO">
|
<select id="selectQuestionDetail" resultMap="ExamQuestionResultVO">
|
||||||
select eq.id, eq.title, eq.answer, eq.type, eq.label, eq.category_id,
|
select eq.id, eq.title, eq.answer, eq.type, eq.label, eq.category_id,
|
||||||
eq.create_by, eq.create_date, eq.update_by, eq.update_date, eq.remarks, eq.del_flag ,
|
eq.create_by, eq.create_date, eq.update_by, eq.update_date, eq.remarks, eq.del_flag ,
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,40 @@
|
||||||
|
<?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.ruoyi.exam.mapper.ExamUserCollectionQuestionMapper">
|
||||||
|
|
||||||
|
<resultMap type="ExamUserCollectionQuestion" id="ExamUserCollectionQuestionResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="vipUserId" column="vip_user_id" />
|
||||||
|
<result property="examQuestionId" column="exam_question_id" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createDate" column="create_date" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateDate" column="update_date" />
|
||||||
|
<result property="remarks" column="remarks" />
|
||||||
|
<result property="delFlag" column="del_flag" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectExamUserCollectionQuestionVo">
|
||||||
|
id, vip_user_id, exam_question_id, create_by, create_date, update_by, update_date, remarks, del_flag </sql>
|
||||||
|
|
||||||
|
<select id="selectExamUserCollectionQuestionList" parameterType="ExamUserCollectionQuestion" resultMap="ExamUserCollectionQuestionResult">
|
||||||
|
select
|
||||||
|
<include refid="selectExamUserCollectionQuestionVo"/>
|
||||||
|
from exam_user_collection_question
|
||||||
|
<where>
|
||||||
|
<if test="id != null "> and id = #{id}</if>
|
||||||
|
<if test="vipUserId != null "> and vip_user_id = #{vipUserId}</if>
|
||||||
|
<if test="examQuestionId != null "> and exam_question_id = #{examQuestionId}</if>
|
||||||
|
<if test="createBy != null and createBy != '' "> and create_by = #{createBy}</if>
|
||||||
|
<if test="createDate != null "> and create_date = #{createDate}</if>
|
||||||
|
<if test="updateBy != null and updateBy != '' "> and update_by = #{updateBy}</if>
|
||||||
|
<if test="updateDate != null "> and update_date = #{updateDate}</if>
|
||||||
|
<if test="remarks != null and remarks != '' "> and remarks = #{remarks}</if>
|
||||||
|
<if test="delFlag != null and delFlag != '' "> and del_flag = #{delFlag}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue