feat:考试详情

pg_adapter
wangxy 9 months ago
parent 7a15fd22ad
commit 3d8031a20c

@ -0,0 +1,45 @@
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.exam.dto.ExamDTO;
import com.ruoyi.system.domain.userexam.dto.request.UserExamReqDTO;
import com.ruoyi.system.domain.userexam.dto.response.UserExamRespDTO;
import com.ruoyi.web.controller.manager.UserExamManager;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.annotation.Resource;
import java.util.List;
/**
* packageName com.ruoyi.web.controller.exam
*
* @author wangxy
* @version JDK 8
* @className UserExamController
* @date 2024/7/3
* @description
*/
@Api("考试详情")
@Controller
@RequestMapping("/system/userExam")
public class UserExamController extends BaseController {
@Resource
private UserExamManager userExamManager;
@ApiOperation("考试详情")
@PostMapping("/list")
@ResponseBody
public TableDataInfo list(UserExamReqDTO reqDTO) {
startPage();
List<UserExamRespDTO> list = userExamManager.selectExamList(reqDTO);
return getDataTable(list);
}
}

@ -1,11 +1,15 @@
package com.ruoyi.web.controller.manager;
import com.ruoyi.system.domain.exam.dto.ExamDTO;
import com.ruoyi.system.domain.userexam.ElUserExam;
import com.ruoyi.system.domain.userexam.dto.request.UserExamReqDTO;
import com.ruoyi.system.domain.userexam.dto.response.UserExamRespDTO;
import com.ruoyi.system.service.ElUserExamService;
import org.springframework.stereotype.Component;
import javax.annotation.Resource;
import java.util.Date;
import java.util.List;
import java.util.Objects;
/**
@ -23,6 +27,20 @@ public class UserExamManager {
@Resource
private ElUserExamService elUserExamService;
/**
*
*
* @param reqDTO
* @return java.util.List<com.hyp.system.domain.SysNotice>
*/
public List<UserExamRespDTO> selectExamList(UserExamReqDTO reqDTO) {
return elUserExamService.selectExamList(reqDTO);
}
/**
*
*

@ -0,0 +1,48 @@
package com.ruoyi.system.domain.userexam.dto;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.io.Serializable;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author
* @since 2020-09-21 15:13
*/
@Data
@ApiModel(value="考试记录", description="考试记录")
public class UserExamDTO implements Serializable {
private static final long serialVersionUID = 1L;
private String id;
@ApiModelProperty(value = "用户ID")
private String userId;
@ApiModelProperty(value = "考试ID")
private String examId;
@ApiModelProperty(value = "考试次数")
private Integer tryCount;
@ApiModelProperty(value = "最高分数")
private Integer maxScore;
@ApiModelProperty(value = "是否通过")
private Boolean passed;
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "更新时间")
private Date updateTime;
}

@ -0,0 +1,30 @@
package com.ruoyi.system.domain.userexam.dto.request;
import com.ruoyi.system.domain.userexam.dto.UserExamDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* <p>
*
* </p>
*
* @author
* @since 2020-09-21 15:13
*/
@Data
@ApiModel(value="考试记录", description="考试记录")
public class UserExamReqDTO extends UserExamDTO {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "考试名称")
private String title;
@ApiModelProperty(value = "人员名称")
private String userName;
}

@ -0,0 +1,29 @@
package com.ruoyi.system.domain.userexam.dto.response;
import com.ruoyi.system.domain.userexam.dto.UserExamDTO;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* <p>
*
* </p>
*
* @author
* @since 2020-09-21 15:13
*/
@Data
@ApiModel(value="考试记录", description="考试记录")
public class UserExamRespDTO extends UserExamDTO {
private static final long serialVersionUID = 1L;
@ApiModelProperty(value = "考试名称")
private String title;
@ApiModelProperty(value = "人员名称")
private String userName;
}

@ -2,8 +2,12 @@ package com.ruoyi.system.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.ruoyi.system.domain.userexam.ElUserExam;
import com.ruoyi.system.domain.userexam.dto.request.UserExamReqDTO;
import com.ruoyi.system.domain.userexam.dto.response.UserExamRespDTO;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* @author 13560
* @description el_user_exam()Mapper
@ -13,6 +17,9 @@ import org.apache.ibatis.annotations.Mapper;
@Mapper
public interface ElUserExamMapper extends BaseMapper<ElUserExam> {
public List<UserExamRespDTO> selectExamList(UserExamReqDTO reqDTO);
}

@ -1,7 +1,12 @@
package com.ruoyi.system.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.ruoyi.system.domain.exam.dto.ExamDTO;
import com.ruoyi.system.domain.userexam.ElUserExam;
import com.ruoyi.system.domain.userexam.dto.request.UserExamReqDTO;
import com.ruoyi.system.domain.userexam.dto.response.UserExamRespDTO;
import java.util.List;
/**
* @author 13560
@ -10,4 +15,8 @@ import com.ruoyi.system.domain.userexam.ElUserExam;
*/
public interface ElUserExamService extends IService<ElUserExam> {
public List<UserExamRespDTO> selectExamList(UserExamReqDTO reqDTO);
}

@ -1,11 +1,17 @@
package com.ruoyi.system.service.impl;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.system.domain.exam.dto.ExamDTO;
import com.ruoyi.system.domain.userexam.ElUserExam;
import com.ruoyi.system.domain.userexam.dto.request.UserExamReqDTO;
import com.ruoyi.system.domain.userexam.dto.response.UserExamRespDTO;
import com.ruoyi.system.mapper.ElUserExamMapper;
import com.ruoyi.system.service.ElUserExamService;
import org.springframework.stereotype.Service;
import javax.annotation.Resource;
import java.util.List;
/**
* @author 13560
* @description el_user_exam()Service
@ -15,6 +21,13 @@ import org.springframework.stereotype.Service;
public class ElUserExamServiceImpl extends ServiceImpl<ElUserExamMapper, ElUserExam>
implements ElUserExamService {
@Resource
private ElUserExamMapper userExamMapper;
@Override
public List<UserExamRespDTO> selectExamList(UserExamReqDTO reqDTO) {
return userExamMapper.selectExamList(reqDTO);
}
}

@ -20,4 +20,23 @@
try_count,max_score,passed,
create_time,update_time
</sql>
<select id="selectExamList" parameterType="com.ruoyi.system.domain.userexam.dto.request.UserExamReqDTO" resultType="com.ruoyi.system.domain.userexam.dto.response.UserExamRespDTO">
SELECT ue.*,ee.title,uc.user_name FROM el_user_exam ue
LEFT JOIN el_exam ee ON ue.exam_id=ee.id
LEFT JOIN ${prefix}sys_user uc ON ue.user_id=uc.user_id
WHERE ee.id IS NOT NULL AND uc.user_id IS NOT NULL
<if test="userId!=null and userId!=''">
AND ue.user_id= #{userId}
</if>
<if test="examId!=null and examId!=''">
AND ue.exam_id = #{examId}
</if>
<if test="title!=null and title!=''">
AND ee.title LIKE CONCAT('%',#{title},'%')
</if>
<if test="userName!=null and userName!=''">
AND uc.user_name LIKE CONCAT('%',#{userName},'%')
</if>
</select>
</mapper>

Loading…
Cancel
Save