This commit is contained in:
parent
1aa54e37cd
commit
20a71a467f
|
|
@ -75,6 +75,12 @@
|
|||
<artifactId>hutool-all</artifactId>
|
||||
<version>4.2.1</version>
|
||||
</dependency>
|
||||
<!--fastjson-->
|
||||
<dependency>
|
||||
<groupId>com.alibaba</groupId>
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.4</version>
|
||||
</dependency>
|
||||
<!-- 单表通用mapper -->
|
||||
<dependency>
|
||||
<groupId>tk.mybatis</groupId>
|
||||
|
|
|
|||
|
|
@ -6,9 +6,13 @@ import com.ruoyi.exam.service.IExamPracticeQuestionService;
|
|||
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.web.base.BaseController;
|
||||
import com.ruoyi.framework.web.page.TableDataInfo;
|
||||
import com.ruoyi.framework.web.util.EntityUtils;
|
||||
import com.ruoyi.framework.web.util.ShiroUtils;
|
||||
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.*;
|
||||
|
|
@ -35,6 +39,8 @@ public class ApiPracticeController extends BaseController {
|
|||
@Autowired
|
||||
private IExamUserErrorQuestionService examUserErrorQuestionService;
|
||||
|
||||
@Autowired
|
||||
private ISysUserService sysUserService;
|
||||
|
||||
@GetMapping("/v1/practice/list")
|
||||
public AjaxResult list(ExamPractice examPractice) {
|
||||
|
|
@ -65,22 +71,25 @@ public class ApiPracticeController extends BaseController {
|
|||
/**
|
||||
* 保存错题记录
|
||||
*
|
||||
* @param questionId
|
||||
* @param questionIds
|
||||
* @return
|
||||
* @description 练习时答错题就保存到错题记录中
|
||||
* 传入问题id
|
||||
*/
|
||||
@PostMapping("/v1/practice/answer")
|
||||
public AjaxResult answer(String questionId) {
|
||||
|
||||
ExamUserErrorQuestion examUserErrorQuestion = new ExamUserErrorQuestion();
|
||||
examUserErrorQuestion.setExamQuestionId(Integer.parseInt(questionId));
|
||||
examUserErrorQuestion.setVipUserId(Integer.parseInt(ShiroUtils.getUserId().toString()));
|
||||
examUserErrorQuestion.setCreateBy(ShiroUtils.getLoginName());
|
||||
examUserErrorQuestion.setCreateDate(new Date());
|
||||
examUserErrorQuestion.setDelFlag("0");
|
||||
examUserErrorQuestionService.insert(examUserErrorQuestion);
|
||||
|
||||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -49,9 +49,9 @@ private static final long serialVersionUID = 1L;
|
|||
}
|
||||
/** 设置会员代码 */
|
||||
public void setVipUserId(Integer vipUserId)
|
||||
{
|
||||
this.vipUserId = vipUserId;
|
||||
}
|
||||
{
|
||||
this.vipUserId = vipUserId;
|
||||
}
|
||||
|
||||
/** 获取会员代码 */
|
||||
public Integer getVipUserId()
|
||||
|
|
|
|||
|
|
@ -30,4 +30,6 @@ public interface IExamUserErrorQuestionService extends AbstractBaseService<ExamU
|
|||
|
||||
|
||||
List<ExamUserErrorQuestionVO> selectExamUserErrorQuestionDetailPage(ExamUserErrorQuestion examUserErrorQuestion);
|
||||
|
||||
int insertError(ExamUserErrorQuestion examUserErrorQuestion);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -11,28 +11,28 @@ import com.ruoyi.exam.service.IExamUserErrorQuestionService;
|
|||
import com.ruoyi.framework.web.base.AbstractBaseServiceImpl;
|
||||
/**
|
||||
* 我的错题 服务层实现
|
||||
*
|
||||
*
|
||||
* @author zhujj
|
||||
* @date 2019-01-10
|
||||
*/
|
||||
@Service
|
||||
public class ExamUserErrorQuestionServiceImpl extends AbstractBaseServiceImpl<ExamUserErrorQuestionMapper,ExamUserErrorQuestion> implements IExamUserErrorQuestionService
|
||||
{
|
||||
@Autowired
|
||||
private ExamUserErrorQuestionMapper examUserErrorQuestionMapper;
|
||||
@Autowired
|
||||
private ExamUserErrorQuestionMapper examUserErrorQuestionMapper;
|
||||
|
||||
|
||||
/**
|
||||
|
||||
/**
|
||||
* 查询我的错题列表
|
||||
*
|
||||
*
|
||||
* @param examUserErrorQuestion 我的错题信息
|
||||
* @return 我的错题集合
|
||||
*/
|
||||
@Override
|
||||
public List<ExamUserErrorQuestion> selectExamUserErrorQuestionList(ExamUserErrorQuestion examUserErrorQuestion)
|
||||
{
|
||||
@Override
|
||||
public List<ExamUserErrorQuestion> selectExamUserErrorQuestionList(ExamUserErrorQuestion examUserErrorQuestion)
|
||||
{
|
||||
return examUserErrorQuestionMapper.selectExamUserErrorQuestionList(examUserErrorQuestion);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExamUserErrorQuestionVO> selectExamUserErrorQuestionDetailPage(ExamUserErrorQuestion examUserErrorQuestion) {
|
||||
|
|
@ -40,6 +40,13 @@ public class ExamUserErrorQuestionServiceImpl extends AbstractBaseServiceImpl<Ex
|
|||
return examUserErrorQuestionMapper.selectExamUserErrorQuestionDetailPage(examUserErrorQuestion);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int insertError(ExamUserErrorQuestion examUserErrorQuestion) {
|
||||
|
||||
|
||||
return examUserErrorQuestionMapper.insert( examUserErrorQuestion );
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询我的错题分页列表
|
||||
*
|
||||
|
|
|
|||
Loading…
Reference in New Issue