练习接口
This commit is contained in:
parent
0533925e9e
commit
b70cb240b7
|
|
@ -0,0 +1,172 @@
|
||||||
|
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.web.base.BaseController;
|
||||||
|
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.*;
|
||||||
|
|
||||||
|
import java.util.*;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by flower on 2019/1/9.
|
||||||
|
*/
|
||||||
|
@Api("考试")
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/api")
|
||||||
|
public class ApiInationController extends BaseController {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IExamExaminationService examExaminationService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IExamPaperService examPaperService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IExamUserExaminationService examUserExaminationService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ISysUserService sysUserService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private IExamExaminationUserService examExaminationUserService;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取考试列表
|
||||||
|
* @param examExamination
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/v1/ination/list")
|
||||||
|
public AjaxResult list(ExamExamination examExamination) {
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("ination",examExamination);
|
||||||
|
map.put("userId", ShiroUtils.getUserId());
|
||||||
|
List<ExamExamination> list = examExaminationService.selectListFromWeb(map);
|
||||||
|
AjaxResult success = success("查询成功");
|
||||||
|
success.put("data", list);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 开始考试
|
||||||
|
* @param inationId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/v1/ination/start/{inationId}")
|
||||||
|
public AjaxResult start(@PathVariable("inationId") String inationId) {
|
||||||
|
ExamExamination examExamination = examExaminationService.selectById(inationId);
|
||||||
|
Integer userId = 1;//Integer.parseInt(ShiroUtils.getUserId().toString());
|
||||||
|
//考试类型
|
||||||
|
String type = examExamination.getType();
|
||||||
|
//试卷ID
|
||||||
|
Integer examPaperId = examExamination.getExamPaperId();
|
||||||
|
//考试次数
|
||||||
|
Integer examNumber = examExamination.getExamNumber();
|
||||||
|
//考试时长
|
||||||
|
Integer timeLength = examExamination.getTimeLength();
|
||||||
|
|
||||||
|
if(type.equals("2")){
|
||||||
|
ExamUserExamination examUserExamination = new ExamUserExamination();
|
||||||
|
examUserExamination.setVipUserId(userId);
|
||||||
|
examUserExamination.setExamPaperId(examPaperId);
|
||||||
|
examUserExamination.setExamExaminationId(Integer.parseInt(inationId));
|
||||||
|
//考试记录集合
|
||||||
|
List<ExamUserExamination> userExamination = examUserExaminationService.selectLastOne(examUserExamination);
|
||||||
|
// 最后一次考试
|
||||||
|
ExamUserExamination last;
|
||||||
|
|
||||||
|
//超过考试次数
|
||||||
|
if(userExamination.size()>=examNumber){
|
||||||
|
|
||||||
|
last = userExamination.get(0);
|
||||||
|
//最后一次考试已交卷,直接返回
|
||||||
|
if(last.getUpdateDate()!=null&&!last.getUpdateDate().equals("")){
|
||||||
|
return error(500,"已超过"+examNumber+"次考试,");
|
||||||
|
}else{
|
||||||
|
// 最后一次考试未交卷,但超过考试时长,直接返回
|
||||||
|
if(last.getCreateDate().getTime()+timeLength*60*1000<new Date().getTime()){
|
||||||
|
return error(500,"已超过"+examNumber+"次考试,");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
if(userExamination.size()<=0 //考试次数小于0
|
||||||
|
||userExamination.get(0).getUpdateDate()!=null //最后一次考试已交卷
|
||||||
|
||userExamination.get(0).getCreateDate().getTime()+timeLength*60*1000<new Date().getTime()//最后一次考试,已超过考过时长
|
||||||
|
){
|
||||||
|
ExamUserExamination insert = new ExamUserExamination();
|
||||||
|
insert.setExamExaminationId(Integer.parseInt(inationId));
|
||||||
|
insert.setVipUserId(userId);
|
||||||
|
insert.setCreateDate(new Date());
|
||||||
|
insert.setExamPaperId(examPaperId);
|
||||||
|
insert.setDelFlag("0");
|
||||||
|
insert.setScore(0);
|
||||||
|
examUserExaminationService.insert(insert);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
List<ExamQuestionVO> list = examPaperService.selectQuestionAndItemByPaperId(examPaperId);
|
||||||
|
//是否乱序
|
||||||
|
if(examExamination.getQuestionDisorder().equals("2")){
|
||||||
|
Collections.shuffle(list);
|
||||||
|
}
|
||||||
|
AjaxResult success = success("查询成功");
|
||||||
|
success.put("data", list);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报名列表
|
||||||
|
* @param examExamination
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@GetMapping("/v1/ination/entername/list")
|
||||||
|
public AjaxResult enterNameList(ExamExamination examExamination) {
|
||||||
|
Map<String, Object> map = new HashMap<>();
|
||||||
|
map.put("ination",examExamination);
|
||||||
|
map.put("userId",1);
|
||||||
|
List<ExamExamination> list = examExaminationService.selectEnterNameListFromWeb(map);
|
||||||
|
AjaxResult success = success("查询成功");
|
||||||
|
success.put("data", list);
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 报名
|
||||||
|
* @param sysUser
|
||||||
|
* @param inationId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@PostMapping("/v1/ination/entername")
|
||||||
|
public AjaxResult enterName(SysUser sysUser,String inationId) {
|
||||||
|
sysUser.setUserId(ShiroUtils.getUserId());
|
||||||
|
sysUserService.updateSelectiveById(sysUser);
|
||||||
|
|
||||||
|
ExamExaminationUser examExaminationUser = new ExamExaminationUser();
|
||||||
|
examExaminationUser.setVipUserId(Integer.parseInt(ShiroUtils.getUserId().toString()));
|
||||||
|
examExaminationUser.setDelFlag("0");
|
||||||
|
examExaminationUser.setCreateDate(new Date());
|
||||||
|
examExaminationUser.setCreateBy(ShiroUtils.getLoginName());
|
||||||
|
examExaminationUser.setExamExaminationId(Integer.parseInt(inationId));
|
||||||
|
examExaminationUserService.insert(examExaminationUser);
|
||||||
|
|
||||||
|
AjaxResult success = success("报名成功");
|
||||||
|
return success;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -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_examination_user
|
||||||
|
*
|
||||||
|
* @author zhujj
|
||||||
|
* @date 2019-01-13
|
||||||
|
*/
|
||||||
|
public class ExamExaminationUser
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 考试对象 */
|
||||||
|
@Id
|
||||||
|
private Integer id;
|
||||||
|
/** 考试代码 */
|
||||||
|
private Integer examExaminationId;
|
||||||
|
/** 会员代码 */
|
||||||
|
private Integer vipUserId;
|
||||||
|
/** 创建者 */
|
||||||
|
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 setExamExaminationId(Integer examExaminationId)
|
||||||
|
{
|
||||||
|
this.examExaminationId = examExaminationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取考试代码 */
|
||||||
|
public Integer getExamExaminationId()
|
||||||
|
{
|
||||||
|
return examExaminationId;
|
||||||
|
}
|
||||||
|
/** 设置会员代码 */
|
||||||
|
public void setVipUserId(Integer vipUserId)
|
||||||
|
{
|
||||||
|
this.vipUserId = vipUserId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取会员代码 */
|
||||||
|
public Integer getVipUserId()
|
||||||
|
{
|
||||||
|
return vipUserId;
|
||||||
|
}
|
||||||
|
/** 设置创建者 */
|
||||||
|
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("examExaminationId", getExamExaminationId())
|
||||||
|
.append("vipUserId", getVipUserId())
|
||||||
|
.append("createBy", getCreateBy())
|
||||||
|
.append("createDate", getCreateDate())
|
||||||
|
.append("updateBy", getUpdateBy())
|
||||||
|
.append("updateDate", getUpdateDate())
|
||||||
|
.append("remarks", getRemarks())
|
||||||
|
.append("delFlag", getDelFlag())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,21 @@
|
||||||
|
package com.ruoyi.exam.domain;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by flower on 2019/1/12.
|
||||||
|
*/
|
||||||
|
public class ExamExaminationVO extends ExamExamination {
|
||||||
|
|
||||||
|
private String trainCourseName;
|
||||||
|
|
||||||
|
|
||||||
|
public String getTrainCourseName() {
|
||||||
|
return trainCourseName;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTrainCourseName(String trainCourseName) {
|
||||||
|
this.trainCourseName = trainCourseName;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,180 @@
|
||||||
|
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_examination
|
||||||
|
*
|
||||||
|
* @author zhujj
|
||||||
|
* @date 2019-01-12
|
||||||
|
*/
|
||||||
|
public class ExamUserExamination
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 考试记录编码 */
|
||||||
|
@Id
|
||||||
|
private Integer id;
|
||||||
|
/** 会员代码 */
|
||||||
|
private Integer vipUserId;
|
||||||
|
/** 试题编码 */
|
||||||
|
private Integer examExaminationId;
|
||||||
|
/** 试卷编码 */
|
||||||
|
private Integer examPaperId;
|
||||||
|
/** 考试得分 */
|
||||||
|
private Integer score;
|
||||||
|
/** 创建者 */
|
||||||
|
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 setExamExaminationId(Integer examExaminationId)
|
||||||
|
{
|
||||||
|
this.examExaminationId = examExaminationId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取试题编码 */
|
||||||
|
public Integer getExamExaminationId()
|
||||||
|
{
|
||||||
|
return examExaminationId;
|
||||||
|
}
|
||||||
|
/** 设置试卷编码 */
|
||||||
|
public void setExamPaperId(Integer examPaperId)
|
||||||
|
{
|
||||||
|
this.examPaperId = examPaperId;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取试卷编码 */
|
||||||
|
public Integer getExamPaperId()
|
||||||
|
{
|
||||||
|
return examPaperId;
|
||||||
|
}
|
||||||
|
/** 设置考试得分 */
|
||||||
|
public void setScore(Integer score)
|
||||||
|
{
|
||||||
|
this.score = score;
|
||||||
|
}
|
||||||
|
|
||||||
|
/** 获取考试得分 */
|
||||||
|
public Integer getScore()
|
||||||
|
{
|
||||||
|
return score;
|
||||||
|
}
|
||||||
|
/** 设置创建者 */
|
||||||
|
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("examExaminationId", getExamExaminationId())
|
||||||
|
.append("examPaperId", getExamPaperId())
|
||||||
|
.append("score", getScore())
|
||||||
|
.append("createBy", getCreateBy())
|
||||||
|
.append("createDate", getCreateDate())
|
||||||
|
.append("updateBy", getUpdateBy())
|
||||||
|
.append("updateDate", getUpdateDate())
|
||||||
|
.append("remarks", getRemarks())
|
||||||
|
.append("delFlag", getDelFlag())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -24,4 +24,6 @@ public interface ExamExaminationMapper extends MyMapper<ExamExamination>
|
||||||
public List<ExamExamination> selectExamExaminationList(ExamExamination examExamination);
|
public List<ExamExamination> selectExamExaminationList(ExamExamination examExamination);
|
||||||
|
|
||||||
List<ExamExamination> selectListFromWeb(Map<String, Object> map);
|
List<ExamExamination> selectListFromWeb(Map<String, Object> map);
|
||||||
|
|
||||||
|
List<ExamExamination> selectEnterNameListFromWeb(Map<String, Object> map);
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,24 @@
|
||||||
|
package com.ruoyi.exam.mapper;
|
||||||
|
|
||||||
|
import com.ruoyi.exam.domain.ExamExaminationUser;
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.framework.web.base.MyMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 考试对象 数据层
|
||||||
|
*
|
||||||
|
* @author zhujj
|
||||||
|
* @date 2019-01-13
|
||||||
|
*/
|
||||||
|
public interface ExamExaminationUserMapper extends MyMapper<ExamExaminationUser>
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询考试对象列表
|
||||||
|
*
|
||||||
|
* @param examExaminationUser 考试对象信息
|
||||||
|
* @return 考试对象集合
|
||||||
|
*/
|
||||||
|
public List<ExamExaminationUser> selectExamExaminationUserList(ExamExaminationUser examExaminationUser);
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -68,4 +68,6 @@ public interface ExamQuestionMapper extends MyMapper<ExamQuestion>
|
||||||
List<ExamQuestionVO> selectQuestionListByPracticeId(Map<String, Object> map);
|
List<ExamQuestionVO> selectQuestionListByPracticeId(Map<String, Object> map);
|
||||||
|
|
||||||
ExamQuestionVO selectQuestionDetail(String questionId);
|
ExamQuestionVO selectQuestionDetail(String questionId);
|
||||||
|
|
||||||
|
List<ExamQuestionVO> selectQuestionListByPaperId(Integer examPaperId);
|
||||||
}
|
}
|
||||||
|
|
@ -0,0 +1,25 @@
|
||||||
|
package com.ruoyi.exam.mapper;
|
||||||
|
|
||||||
|
import com.ruoyi.exam.domain.ExamUserExamination;
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.framework.web.base.MyMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 我的考试记录 数据层
|
||||||
|
*
|
||||||
|
* @author zhujj
|
||||||
|
* @date 2019-01-12
|
||||||
|
*/
|
||||||
|
public interface ExamUserExaminationMapper extends MyMapper<ExamUserExamination>
|
||||||
|
{
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询我的考试记录列表
|
||||||
|
*
|
||||||
|
* @param examUserExamination 我的考试记录信息
|
||||||
|
* @return 我的考试记录集合
|
||||||
|
*/
|
||||||
|
public List<ExamUserExamination> selectExamUserExaminationList(ExamUserExamination examUserExamination);
|
||||||
|
|
||||||
|
List<ExamUserExamination> selectLastOne(ExamUserExamination examUserExamination);
|
||||||
|
}
|
||||||
|
|
@ -34,4 +34,11 @@ public interface IExamExaminationService extends AbstractBaseService<ExamExamina
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
List<ExamExamination> selectListFromWeb(Map<String, Object> map);
|
List<ExamExamination> selectListFromWeb(Map<String, Object> map);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询可以报名的列表
|
||||||
|
* @param map
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<ExamExamination> selectEnterNameListFromWeb(Map<String, Object> map);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,30 @@
|
||||||
|
package com.ruoyi.exam.service;
|
||||||
|
|
||||||
|
import com.ruoyi.exam.domain.ExamExaminationUser;
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.framework.web.base.AbstractBaseService;
|
||||||
|
/**
|
||||||
|
* 考试对象 服务层
|
||||||
|
*
|
||||||
|
* @author zhujj
|
||||||
|
* @date 2019-01-13
|
||||||
|
*/
|
||||||
|
public interface IExamExaminationUserService extends AbstractBaseService<ExamExaminationUser>
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询考试对象分页列表
|
||||||
|
*
|
||||||
|
* @param examExaminationUser 考试对象信息
|
||||||
|
* @return 考试对象集合
|
||||||
|
*/
|
||||||
|
public List<ExamExaminationUser> selectExamExaminationUserPage(ExamExaminationUser examExaminationUser);
|
||||||
|
/**
|
||||||
|
* 查询考试对象列表
|
||||||
|
*
|
||||||
|
* @param examExaminationUser 考试对象信息
|
||||||
|
* @return 考试对象集合
|
||||||
|
*/
|
||||||
|
public List<ExamExaminationUser> selectExamExaminationUserList(ExamExaminationUser examExaminationUser);
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -2,6 +2,8 @@ package com.ruoyi.exam.service;
|
||||||
|
|
||||||
import com.ruoyi.exam.domain.ExamPaper;
|
import com.ruoyi.exam.domain.ExamPaper;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.ruoyi.exam.domain.ExamQuestionVO;
|
||||||
import com.ruoyi.framework.web.base.AbstractBaseService;
|
import com.ruoyi.framework.web.base.AbstractBaseService;
|
||||||
/**
|
/**
|
||||||
* 试卷 服务层
|
* 试卷 服务层
|
||||||
|
|
@ -28,4 +30,6 @@ public interface IExamPaperService extends AbstractBaseService<ExamPaper>
|
||||||
|
|
||||||
|
|
||||||
List<ExamPaper> selectListByCategory(ExamPaper examPaper);
|
List<ExamPaper> selectListByCategory(ExamPaper examPaper);
|
||||||
|
|
||||||
|
List<ExamQuestionVO> selectQuestionAndItemByPaperId(Integer examPaperId);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,35 @@
|
||||||
|
package com.ruoyi.exam.service;
|
||||||
|
|
||||||
|
import com.ruoyi.exam.domain.ExamUserExamination;
|
||||||
|
import java.util.List;
|
||||||
|
import com.ruoyi.framework.web.base.AbstractBaseService;
|
||||||
|
/**
|
||||||
|
* 我的考试记录 服务层
|
||||||
|
*
|
||||||
|
* @author zhujj
|
||||||
|
* @date 2019-01-12
|
||||||
|
*/
|
||||||
|
public interface IExamUserExaminationService extends AbstractBaseService<ExamUserExamination>
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询我的考试记录分页列表
|
||||||
|
*
|
||||||
|
* @param examUserExamination 我的考试记录信息
|
||||||
|
* @return 我的考试记录集合
|
||||||
|
*/
|
||||||
|
public List<ExamUserExamination> selectExamUserExaminationPage(ExamUserExamination examUserExamination);
|
||||||
|
/**
|
||||||
|
* 查询我的考试记录列表
|
||||||
|
*
|
||||||
|
* @param examUserExamination 我的考试记录信息
|
||||||
|
* @return 我的考试记录集合
|
||||||
|
*/
|
||||||
|
public List<ExamUserExamination> selectExamUserExaminationList(ExamUserExamination examUserExamination);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户上一次的考试
|
||||||
|
* @param examUserExamination
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
List<ExamUserExamination> selectLastOne(ExamUserExamination examUserExamination);
|
||||||
|
}
|
||||||
|
|
@ -41,6 +41,12 @@ public class ExamExaminationServiceImpl extends AbstractBaseServiceImpl<ExamExam
|
||||||
return examExaminationMapper.selectListFromWeb(map);
|
return examExaminationMapper.selectListFromWeb(map);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ExamExamination> selectEnterNameListFromWeb(Map<String, Object> map) {
|
||||||
|
startPage();
|
||||||
|
return examExaminationMapper.selectEnterNameListFromWeb(map);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询考试分页列表
|
* 查询考试分页列表
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,48 @@
|
||||||
|
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.ExamExaminationUserMapper;
|
||||||
|
import com.ruoyi.exam.domain.ExamExaminationUser;
|
||||||
|
import com.ruoyi.exam.service.IExamExaminationUserService;
|
||||||
|
import com.ruoyi.common.support.Convert;
|
||||||
|
import com.ruoyi.framework.web.base.AbstractBaseServiceImpl;
|
||||||
|
/**
|
||||||
|
* 考试对象 服务层实现
|
||||||
|
*
|
||||||
|
* @author zhujj
|
||||||
|
* @date 2019-01-13
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ExamExaminationUserServiceImpl extends AbstractBaseServiceImpl<ExamExaminationUserMapper,ExamExaminationUser> implements IExamExaminationUserService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ExamExaminationUserMapper examExaminationUserMapper;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询考试对象列表
|
||||||
|
*
|
||||||
|
* @param examExaminationUser 考试对象信息
|
||||||
|
* @return 考试对象集合
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<ExamExaminationUser> selectExamExaminationUserList(ExamExaminationUser examExaminationUser)
|
||||||
|
{
|
||||||
|
return examExaminationUserMapper.selectExamExaminationUserList(examExaminationUser);
|
||||||
|
}
|
||||||
|
/**
|
||||||
|
* 查询考试对象分页列表
|
||||||
|
*
|
||||||
|
* @param examExaminationUser 考试对象信息
|
||||||
|
* @return 考试对象集合
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<ExamExaminationUser> selectExamExaminationUserPage(ExamExaminationUser examExaminationUser)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
return examExaminationUserMapper.selectExamExaminationUserList(examExaminationUser);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -1,6 +1,10 @@
|
||||||
package com.ruoyi.exam.service.impl;
|
package com.ruoyi.exam.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.ruoyi.exam.domain.ExamQuestionVO;
|
||||||
|
import com.ruoyi.exam.mapper.ExamPaperQuestionMapper;
|
||||||
|
import com.ruoyi.exam.mapper.ExamQuestionMapper;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.ruoyi.exam.mapper.ExamPaperMapper;
|
import com.ruoyi.exam.mapper.ExamPaperMapper;
|
||||||
|
|
@ -20,6 +24,9 @@ public class ExamPaperServiceImpl extends AbstractBaseServiceImpl<ExamPaperMappe
|
||||||
@Autowired
|
@Autowired
|
||||||
private ExamPaperMapper examPaperMapper;
|
private ExamPaperMapper examPaperMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ExamQuestionMapper examQuestionMapper;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询试卷列表
|
* 查询试卷列表
|
||||||
|
|
@ -39,6 +46,12 @@ public class ExamPaperServiceImpl extends AbstractBaseServiceImpl<ExamPaperMappe
|
||||||
return examPaperMapper.selectListByCategory(examPaper);
|
return examPaperMapper.selectListByCategory(examPaper);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ExamQuestionVO> selectQuestionAndItemByPaperId(Integer examPaperId) {
|
||||||
|
List<ExamQuestionVO> list = examQuestionMapper.selectQuestionListByPaperId(examPaperId);
|
||||||
|
return list;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询试卷分页列表
|
* 查询试卷分页列表
|
||||||
*
|
*
|
||||||
|
|
|
||||||
|
|
@ -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.ExamUserExaminationMapper;
|
||||||
|
import com.ruoyi.exam.domain.ExamUserExamination;
|
||||||
|
import com.ruoyi.exam.service.IExamUserExaminationService;
|
||||||
|
import com.ruoyi.common.support.Convert;
|
||||||
|
import com.ruoyi.framework.web.base.AbstractBaseServiceImpl;
|
||||||
|
/**
|
||||||
|
* 我的考试记录 服务层实现
|
||||||
|
*
|
||||||
|
* @author zhujj
|
||||||
|
* @date 2019-01-12
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ExamUserExaminationServiceImpl extends AbstractBaseServiceImpl<ExamUserExaminationMapper,ExamUserExamination> implements IExamUserExaminationService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ExamUserExaminationMapper examUserExaminationMapper;
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询我的考试记录列表
|
||||||
|
*
|
||||||
|
* @param examUserExamination 我的考试记录信息
|
||||||
|
* @return 我的考试记录集合
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<ExamUserExamination> selectExamUserExaminationList(ExamUserExamination examUserExamination)
|
||||||
|
{
|
||||||
|
return examUserExaminationMapper.selectExamUserExaminationList(examUserExamination);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<ExamUserExamination> selectLastOne(ExamUserExamination examUserExamination) {
|
||||||
|
return examUserExaminationMapper.selectLastOne(examUserExamination);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询我的考试记录分页列表
|
||||||
|
*
|
||||||
|
* @param examUserExamination 我的考试记录信息
|
||||||
|
* @return 我的考试记录集合
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<ExamUserExamination> selectExamUserExaminationPage(ExamUserExamination examUserExamination)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
return examUserExaminationMapper.selectExamUserExaminationList(examUserExamination);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
@ -4,11 +4,12 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.ruoyi.exam.mapper.ExamExaminationMapper">
|
<mapper namespace="com.ruoyi.exam.mapper.ExamExaminationMapper">
|
||||||
|
|
||||||
<resultMap type="ExamExamination" id="ExamExaminationResult">
|
<resultMap type="ExamExaminationVO" id="ExamExaminationResult">
|
||||||
<result property="id" column="id" />
|
<result property="id" column="id" />
|
||||||
<result property="deptId" column="dept_id" />
|
<result property="deptId" column="dept_id" />
|
||||||
<result property="examPaperId" column="exam_paper_id" />
|
<result property="examPaperId" column="exam_paper_id" />
|
||||||
<result property="trainCourseId" column="train_course_id" />
|
<result property="trainCourseId" column="train_course_id" />
|
||||||
|
<result property="trainCourseName" column="traincourse_name" />
|
||||||
<result property="name" column="name" />
|
<result property="name" column="name" />
|
||||||
<result property="type" column="type" />
|
<result property="type" column="type" />
|
||||||
<result property="enableControlTime" column="enable_control_time" />
|
<result property="enableControlTime" column="enable_control_time" />
|
||||||
|
|
@ -30,7 +31,28 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectExamExaminationVo">
|
<sql id="selectExamExaminationVo">
|
||||||
id, dept_id, exam_paper_id,train_course_id, name,type, enable_control_time, start_time, end_time, time_length, exam_number, pass_mark, question_disorder, finished_paper, exam_end, examination_user_limit, create_by, create_date, update_by, update_date, remarks, del_flag </sql>
|
exam_examination.id,
|
||||||
|
exam_examination.dept_id,
|
||||||
|
exam_examination.exam_paper_id,
|
||||||
|
exam_examination.train_course_id,
|
||||||
|
exam_examination.name,
|
||||||
|
exam_examination.type,
|
||||||
|
exam_examination.enable_control_time,
|
||||||
|
exam_examination.start_time,
|
||||||
|
exam_examination.end_time,
|
||||||
|
exam_examination.time_length,
|
||||||
|
exam_examination.exam_number,
|
||||||
|
exam_examination.pass_mark,
|
||||||
|
exam_examination.question_disorder,
|
||||||
|
exam_examination.finished_paper,
|
||||||
|
exam_examination.exam_end,
|
||||||
|
exam_examination.examination_user_limit,
|
||||||
|
exam_examination.create_by,
|
||||||
|
exam_examination.create_date,
|
||||||
|
exam_examination.update_by,
|
||||||
|
exam_examination.update_date,
|
||||||
|
exam_examination.remarks,
|
||||||
|
exam_examination.del_flag </sql>
|
||||||
|
|
||||||
<select id="selectExamExaminationList" parameterType="ExamExamination" resultMap="ExamExaminationResult">
|
<select id="selectExamExaminationList" parameterType="ExamExamination" resultMap="ExamExaminationResult">
|
||||||
select
|
select
|
||||||
|
|
@ -64,11 +86,53 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
|
|
||||||
<select id="selectListFromWeb" resultMap="ExamExaminationResult">
|
<select id="selectListFromWeb" resultMap="ExamExaminationResult">
|
||||||
select
|
select
|
||||||
*
|
<include refid="selectExamExaminationVo"/>,tc.name as traincourse_name
|
||||||
from exam_examination exam_examination
|
from exam_examination exam_examination
|
||||||
|
INNER JOIN train_course tc ON exam_examination.train_course_id = tc.id
|
||||||
LEFT JOIN exam_examination_user eeu ON eeu.exam_examination_id = exam_examination.id
|
LEFT JOIN exam_examination_user eeu ON eeu.exam_examination_id = exam_examination.id
|
||||||
|
|
||||||
<where>
|
<where>
|
||||||
(exam_examination.type = '1' or eeu.vip_user_id = #{userId})
|
(exam_examination.type = '1' or eeu.vip_user_id = #{userId})
|
||||||
|
and
|
||||||
|
<![CDATA[((enable_control_time = '1' and end_time > NOW() and start_time < NOW())
|
||||||
|
or enable_control_time = '0') ]]>
|
||||||
|
<if test="id != null "> and exam_examination.id = #{ination.id}</if>
|
||||||
|
<if test="deptId != null "> and exam_examination.dept_id = #{ination.deptId}</if>
|
||||||
|
<if test="examPaperId != null "> and exam_examination.exam_paper_id = #{ination.examPaperId}</if>
|
||||||
|
<if test="name != null and name != '' "> and exam_examination.name = #{ination.name}</if>
|
||||||
|
<if test="type != null and type != '' "> and exam_examination.type = #{ination.type}</if>
|
||||||
|
<if test="enableControlTime != null and enableControlTime != '' "> and exam_examination.enable_control_time = #{ination.enableControlTime}</if>
|
||||||
|
<if test="startTime != null "> and exam_examination.start_time = #{ination.startTime}</if>
|
||||||
|
<if test="endTime != null "> and exam_examination.end_time = #{ination.endTime}</if>
|
||||||
|
<if test="timeLength != null "> and exam_examination.time_length = #{ination.timeLength}</if>
|
||||||
|
<if test="examNumber != null "> and exam_examination.exam_number = #{ination.examNumber}</if>
|
||||||
|
<if test="passMark != null "> and exam_examination.pass_mark = #{ination.passMark}</if>
|
||||||
|
<if test="questionDisorder != null and questionDisorder != '' "> and exam_examination.question_disorder = #{ination.questionDisorder}</if>
|
||||||
|
<if test="finishedPaper != null and finishedPaper != '' "> and exam_examination.finished_paper = #{ination.finishedPaper}</if>
|
||||||
|
<if test="examEnd != null and examEnd != '' "> and exam_examination.exam_end = #{ination.examEnd}</if>
|
||||||
|
<if test="examinationUserLimit != null and examinationUserLimit != '' "> and exam_examination.examination_user_limit = #{ination.examinationUserLimit}</if>
|
||||||
|
<if test="createBy != null and createBy != '' "> and exam_examination.create_by = #{ination.createBy}</if>
|
||||||
|
<if test="createDate != null "> and exam_examination.create_date = #{ination.createDate}</if>
|
||||||
|
<if test="updateBy != null and updateBy != '' "> and exam_examination.update_by = #{ination.updateBy}</if>
|
||||||
|
<if test="updateDate != null "> and exam_examination.update_date = #{ination.updateDate}</if>
|
||||||
|
<if test="remarks != null and remarks != '' "> and exam_examination.remarks = #{ination.remarks}</if>
|
||||||
|
<if test="delFlag != null and delFlag != '' "> and exam_examination.del_flag = #{ination.delFlag}</if>
|
||||||
|
</where>
|
||||||
|
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
<select id="selectEnterNameListFromWeb" resultMap="ExamExaminationResult">
|
||||||
|
select
|
||||||
|
<include refid="selectExamExaminationVo"/>,tc.name as traincourse_name
|
||||||
|
from exam_examination exam_examination
|
||||||
|
INNER JOIN train_course tc ON exam_examination.train_course_id = tc.id
|
||||||
|
|
||||||
|
<where>
|
||||||
|
exam_examination.type = '2' and exam_examination.id not in (select exam_examination_id from exam_examination_user where vip_user_id = #{userId})
|
||||||
|
and
|
||||||
|
<![CDATA[((enable_control_time = '1' and end_time > NOW() and start_time < NOW())
|
||||||
|
or enable_control_time = '0') ]]>
|
||||||
<if test="id != null "> and exam_examination.id = #{ination.id}</if>
|
<if test="id != null "> and exam_examination.id = #{ination.id}</if>
|
||||||
<if test="deptId != null "> and exam_examination.dept_id = #{ination.deptId}</if>
|
<if test="deptId != null "> and exam_examination.dept_id = #{ination.deptId}</if>
|
||||||
<if test="examPaperId != null "> and exam_examination.exam_paper_id = #{ination.examPaperId}</if>
|
<if test="examPaperId != null "> and exam_examination.exam_paper_id = #{ination.examPaperId}</if>
|
||||||
|
|
|
||||||
|
|
@ -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.ExamExaminationUserMapper">
|
||||||
|
|
||||||
|
<resultMap type="ExamExaminationUser" id="ExamExaminationUserResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="examExaminationId" column="exam_examination_id" />
|
||||||
|
<result property="vipUserId" column="vip_user_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="selectExamExaminationUserVo">
|
||||||
|
id, exam_examination_id, vip_user_id, create_by, create_date, update_by, update_date, remarks, del_flag </sql>
|
||||||
|
|
||||||
|
<select id="selectExamExaminationUserList" parameterType="ExamExaminationUser" resultMap="ExamExaminationUserResult">
|
||||||
|
select
|
||||||
|
<include refid="selectExamExaminationUserVo"/>
|
||||||
|
from exam_examination_user
|
||||||
|
<where>
|
||||||
|
<if test="id != null "> and id = #{id}</if>
|
||||||
|
<if test="examExaminationId != null "> and exam_examination_id = #{examExaminationId}</if>
|
||||||
|
<if test="vipUserId != null "> and vip_user_id = #{vipUserId}</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>
|
||||||
|
|
@ -122,6 +122,20 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
where eq.id = #{questionId}
|
where eq.id = #{questionId}
|
||||||
|
|
||||||
</select>
|
</select>
|
||||||
|
<select id="selectQuestionListByPaperId" 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_question eq
|
||||||
|
INNER JOIN exam_paper_question epq ON eq.id = epq.exam_question_id
|
||||||
|
INNER JOIN exam_question_item eqi ON eqi.exam_question_id = eq.id
|
||||||
|
where epq.exam_paper_id = #{examPaperId}
|
||||||
|
order by epq.order_num
|
||||||
|
</select>
|
||||||
|
|
||||||
<insert id="insertExamQuestion" keyProperty="id" useGeneratedKeys="true" parameterType="ExamQuestion">
|
<insert id="insertExamQuestion" keyProperty="id" useGeneratedKeys="true" parameterType="ExamQuestion">
|
||||||
insert into exam_question
|
insert into exam_question
|
||||||
|
|
|
||||||
|
|
@ -0,0 +1,64 @@
|
||||||
|
<?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.ExamUserExaminationMapper">
|
||||||
|
|
||||||
|
<resultMap type="ExamUserExamination" id="ExamUserExaminationResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="vipUserId" column="vip_user_id" />
|
||||||
|
<result property="examExaminationId" column="exam_examination_id" />
|
||||||
|
<result property="examPaperId" column="exam_paper_id" />
|
||||||
|
<result property="score" column="score" />
|
||||||
|
<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="selectExamUserExaminationVo">
|
||||||
|
id, vip_user_id, exam_examination_id, exam_paper_id, score, create_by, create_date, update_by, update_date, remarks, del_flag </sql>
|
||||||
|
|
||||||
|
<select id="selectExamUserExaminationList" parameterType="ExamUserExamination" resultMap="ExamUserExaminationResult">
|
||||||
|
select
|
||||||
|
<include refid="selectExamUserExaminationVo"/>
|
||||||
|
from exam_user_examination
|
||||||
|
<where>
|
||||||
|
<if test="id != null "> and id = #{id}</if>
|
||||||
|
<if test="vipUserId != null "> and vip_user_id = #{vipUserId}</if>
|
||||||
|
<if test="examExaminationId != null "> and exam_examination_id = #{examExaminationId}</if>
|
||||||
|
<if test="examPaperId != null "> and exam_paper_id = #{examPaperId}</if>
|
||||||
|
<if test="score != null "> and score = #{score}</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>
|
||||||
|
|
||||||
|
<select id="selectLastOne" resultMap="ExamUserExaminationResult">
|
||||||
|
select
|
||||||
|
<include refid="selectExamUserExaminationVo"/>
|
||||||
|
from exam_user_examination
|
||||||
|
<where>
|
||||||
|
<if test="id != null "> and id = #{id}</if>
|
||||||
|
<if test="vipUserId != null "> and vip_user_id = #{vipUserId}</if>
|
||||||
|
<if test="examExaminationId != null "> and exam_examination_id = #{examExaminationId}</if>
|
||||||
|
<if test="examPaperId != null "> and exam_paper_id = #{examPaperId}</if>
|
||||||
|
<if test="score != null "> and score = #{score}</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>
|
||||||
|
order by create_date desc;
|
||||||
|
</select>
|
||||||
|
|
||||||
|
|
||||||
|
</mapper>
|
||||||
Loading…
Reference in New Issue