试卷试题列表
This commit is contained in:
parent
c7849b087d
commit
ec71a0849d
@ -1,10 +1,23 @@
|
||||
package ink.wgink.module.examine.controller.api.paper.question;
|
||||
|
||||
import ink.wgink.common.base.DefaultBaseController;
|
||||
import ink.wgink.exceptions.SearchException;
|
||||
import ink.wgink.interfaces.consts.ISystemConstant;
|
||||
import io.swagger.annotations.Api;
|
||||
import ink.wgink.module.examine.pojo.dtos.paper.question.PaperQuestionDTO;
|
||||
import ink.wgink.module.examine.service.paper.question.IPaperQuestionService;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.result.ErrorResult;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import io.swagger.annotations.*;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PathVariable;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @ClassName: PaperQuestionController
|
||||
* @Description: 试卷试题
|
||||
@ -15,8 +28,37 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
@Api(tags = ISystemConstant.API_TAGS_SYSTEM_PREFIX + "试卷试题接口")
|
||||
@RestController
|
||||
@RequestMapping(ISystemConstant.API_PREFIX + "/paper/question")
|
||||
public class PaperQuestionController {
|
||||
public class PaperQuestionController extends DefaultBaseController {
|
||||
|
||||
@Autowired
|
||||
private IPaperQuestionService paperQuestionService;
|
||||
|
||||
@ApiOperation(value = "试卷试题列表", notes = "试卷试题列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "paperId", value = "试卷ID", paramType = "path"),
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("list/paper-id/{paperId}")
|
||||
public List<PaperQuestionDTO> listPage(@PathVariable("paperId") String paperId) throws SearchException {
|
||||
Map<String, Object> params = requestParams();
|
||||
return paperQuestionService.list(paperId, params);
|
||||
}
|
||||
|
||||
@ApiOperation(value = "试卷试题分页列表", notes = "试卷试题分页列表接口")
|
||||
@ApiImplicitParams({
|
||||
@ApiImplicitParam(name = "paperId", value = "试卷ID", paramType = "path"),
|
||||
@ApiImplicitParam(name = "page", value = "当前页码", paramType = "query", dataType = "int", defaultValue = "1"),
|
||||
@ApiImplicitParam(name = "rows", value = "显示数量", paramType = "query", dataType = "int", defaultValue = "20"),
|
||||
@ApiImplicitParam(name = "keywords", value = "关键字", paramType = "query", dataType = "String"),
|
||||
@ApiImplicitParam(name = "startTime", value = "开始时间", paramType = "query", dataType = "String"),
|
||||
@ApiImplicitParam(name = "endTime", value = "结束时间", paramType = "query", dataType = "String")
|
||||
})
|
||||
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
|
||||
@GetMapping("listpage/paper-id/{paperId}")
|
||||
public SuccessResultList<List<PaperQuestionDTO>> listPage(@PathVariable("paperId") String paperId, ListPage page) throws SearchException {
|
||||
Map<String, Object> params = requestParams();
|
||||
page.setParams(params);
|
||||
return paperQuestionService.listPage(paperId, page);
|
||||
}
|
||||
|
||||
}
|
||||
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.examine.dao.paper;
|
||||
package ink.wgink.module.examine.dao.paper.question;
|
||||
|
||||
import ink.wgink.exceptions.RemoveException;
|
||||
import ink.wgink.exceptions.SaveException;
|
||||
@ -6,6 +6,7 @@ import ink.wgink.exceptions.SearchException;
|
||||
import ink.wgink.exceptions.UpdateException;
|
||||
import ink.wgink.interfaces.init.IInitBaseTable;
|
||||
import ink.wgink.module.examine.pojo.dtos.paper.PaperDTO;
|
||||
import ink.wgink.module.examine.pojo.dtos.paper.question.PaperQuestionDTO;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
@ -53,4 +54,12 @@ public interface IPaperQuestionDao extends IInitBaseTable {
|
||||
*/
|
||||
List<PaperDTO> listPO(Map<String, Object> params) throws SearchException;
|
||||
|
||||
/**
|
||||
* 列表
|
||||
*
|
||||
* @param params
|
||||
* @return
|
||||
* @throws SearchException
|
||||
*/
|
||||
List<PaperQuestionDTO> list(Map<String, Object> params) throws SearchException;
|
||||
}
|
@ -1,4 +1,4 @@
|
||||
package ink.wgink.module.examine.pojo.dtos.paper;
|
||||
package ink.wgink.module.examine.pojo.dtos.paper.question;
|
||||
|
||||
import io.swagger.annotations.ApiModel;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
@ -14,25 +14,23 @@ import io.swagger.annotations.ApiModelProperty;
|
||||
@ApiModel
|
||||
public class PaperQuestionDTO {
|
||||
|
||||
@ApiModelProperty(name = "paperQuestionId", value = "试卷问题ID")
|
||||
@ApiModelProperty(name = "paperQuestionId", value = "试卷试题ID")
|
||||
private String paperQuestionId;
|
||||
@ApiModelProperty(name = "paperId", value = "试卷ID")
|
||||
private String paperId;
|
||||
@ApiModelProperty(name = "paperName", value = "试卷名称")
|
||||
private String paperName;
|
||||
@ApiModelProperty(name = "questionId", value = "问题")
|
||||
@ApiModelProperty(name = "questionId", value = "试题ID")
|
||||
private String questionId;
|
||||
@ApiModelProperty(name = "questionSubject", value = "问题题目")
|
||||
@ApiModelProperty(name = "questionSort", value = "试题排序")
|
||||
private String questionSort;
|
||||
@ApiModelProperty(name = "questionSubject", value = "试题题目")
|
||||
private String questionSubject;
|
||||
@ApiModelProperty(name = "questionType", value = "问题种类")
|
||||
@ApiModelProperty(name = "questionType", value = "试题种类")
|
||||
private String questionType;
|
||||
@ApiModelProperty(name = "questionChoiceType", value = "问题选择类别")
|
||||
@ApiModelProperty(name = "questionChoiceType", value = "试题选择类别")
|
||||
private String questionChoiceType;
|
||||
@ApiModelProperty(name = "questionAnalysis", value = "问题解析")
|
||||
private String questionAnalysis;
|
||||
@ApiModelProperty(name = "questionDifficulty", value = "难度")
|
||||
private String questionDifficulty;
|
||||
@ApiModelProperty(name = "questionSource", value = "问题来源")
|
||||
@ApiModelProperty(name = "questionSource", value = "试题来源")
|
||||
private String questionSource;
|
||||
|
||||
public String getPaperQuestionId() {
|
||||
@ -51,14 +49,6 @@ public class PaperQuestionDTO {
|
||||
this.paperId = paperId;
|
||||
}
|
||||
|
||||
public String getPaperName() {
|
||||
return paperName;
|
||||
}
|
||||
|
||||
public void setPaperName(String paperName) {
|
||||
this.paperName = paperName;
|
||||
}
|
||||
|
||||
public String getQuestionId() {
|
||||
return questionId;
|
||||
}
|
||||
@ -67,6 +57,14 @@ public class PaperQuestionDTO {
|
||||
this.questionId = questionId;
|
||||
}
|
||||
|
||||
public String getQuestionSort() {
|
||||
return questionSort;
|
||||
}
|
||||
|
||||
public void setQuestionSort(String questionSort) {
|
||||
this.questionSort = questionSort;
|
||||
}
|
||||
|
||||
public String getQuestionSubject() {
|
||||
return questionSubject;
|
||||
}
|
||||
@ -91,14 +89,6 @@ public class PaperQuestionDTO {
|
||||
this.questionChoiceType = questionChoiceType;
|
||||
}
|
||||
|
||||
public String getQuestionAnalysis() {
|
||||
return questionAnalysis;
|
||||
}
|
||||
|
||||
public void setQuestionAnalysis(String questionAnalysis) {
|
||||
this.questionAnalysis = questionAnalysis;
|
||||
}
|
||||
|
||||
public String getQuestionDifficulty() {
|
||||
return questionDifficulty;
|
||||
}
|
||||
@ -114,4 +104,5 @@ public class PaperQuestionDTO {
|
||||
public void setQuestionSource(String questionSource) {
|
||||
this.questionSource = questionSource;
|
||||
}
|
||||
|
||||
}
|
@ -16,7 +16,7 @@ public class PaperQuestionPO implements Serializable {
|
||||
private String paperQuestionId;
|
||||
private String paperId;
|
||||
private String questionId;
|
||||
private String questionType;
|
||||
private String questionSort;
|
||||
|
||||
public String getPaperQuestionId() {
|
||||
return paperQuestionId;
|
||||
@ -42,11 +42,11 @@ public class PaperQuestionPO implements Serializable {
|
||||
this.questionId = questionId;
|
||||
}
|
||||
|
||||
public String getQuestionType() {
|
||||
return questionType;
|
||||
public String getQuestionSort() {
|
||||
return questionSort;
|
||||
}
|
||||
|
||||
public void setQuestionType(String questionType) {
|
||||
this.questionType = questionType;
|
||||
public void setQuestionSort(String questionSort) {
|
||||
this.questionSort = questionSort;
|
||||
}
|
||||
}
|
||||
|
@ -0,0 +1,36 @@
|
||||
package ink.wgink.module.examine.service.paper.question;
|
||||
|
||||
import ink.wgink.module.examine.pojo.dtos.paper.question.PaperQuestionDTO;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 试卷试题
|
||||
* @Author: WenG
|
||||
* @Date: 2022/5/23 23:44
|
||||
* @Version: 1.0
|
||||
**/
|
||||
public interface IPaperQuestionService {
|
||||
|
||||
/**
|
||||
* 试卷试题列表
|
||||
*
|
||||
* @param paperId
|
||||
* @param params
|
||||
* @return
|
||||
*/
|
||||
List<PaperQuestionDTO> list(String paperId, Map<String, Object> params);
|
||||
|
||||
/**
|
||||
* 试卷试题分页列表
|
||||
*
|
||||
* @param paperId
|
||||
* @param page
|
||||
* @return
|
||||
*/
|
||||
SuccessResultList<List<PaperQuestionDTO>> listPage(String paperId, ListPage page);
|
||||
|
||||
}
|
@ -0,0 +1,42 @@
|
||||
package ink.wgink.module.examine.service.paper.question.impl;
|
||||
|
||||
import com.github.pagehelper.PageHelper;
|
||||
import com.github.pagehelper.PageInfo;
|
||||
import ink.wgink.common.base.DefaultBaseService;
|
||||
import ink.wgink.module.examine.dao.paper.question.IPaperQuestionDao;
|
||||
import ink.wgink.module.examine.pojo.dtos.paper.question.PaperQuestionDTO;
|
||||
import ink.wgink.module.examine.service.paper.question.IPaperQuestionService;
|
||||
import ink.wgink.pojo.ListPage;
|
||||
import ink.wgink.pojo.result.SuccessResultList;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @Description: 试卷试题
|
||||
* @Author: WenG
|
||||
* @Date: 2022/5/23 23:44
|
||||
* @Version: 1.0
|
||||
**/
|
||||
@Service
|
||||
public class PaperQuestionServiceImpl extends DefaultBaseService implements IPaperQuestionService {
|
||||
|
||||
@Autowired
|
||||
private IPaperQuestionDao paperQuestionDao;
|
||||
|
||||
@Override
|
||||
public List<PaperQuestionDTO> list(String paperId, Map<String, Object> params) {
|
||||
params = params == null ? getHashMap(0) : params;
|
||||
return paperQuestionDao.list(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public SuccessResultList<List<PaperQuestionDTO>> listPage(String paperId, ListPage page) {
|
||||
PageHelper.startPage(page.getPage(), page.getRows());
|
||||
List<PaperQuestionDTO> paperQuestionDTOS = paperQuestionDao.list(page.getParams());
|
||||
PageInfo<PaperQuestionDTO> pageInfo = new PageInfo<>(paperQuestionDTOS);
|
||||
return new SuccessResultList<>(paperQuestionDTOS, pageInfo.getPageNum(), pageInfo.getTotal());
|
||||
}
|
||||
}
|
@ -1,16 +1,24 @@
|
||||
<?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="ink.wgink.module.examine.dao.paper.IPaperQuestionDao">
|
||||
<mapper namespace="ink.wgink.module.examine.dao.paper.question.IPaperQuestionDao">
|
||||
|
||||
<resultMap id="paperDTO" type="ink.wgink.module.examine.pojo.dtos.paper.PaperQuestionDTO">
|
||||
<id column="paper_id" property="paperId"/>
|
||||
<result column="paper_name" property="paperName"/>
|
||||
<resultMap id="paperQuestionDTO" type="ink.wgink.module.examine.pojo.dtos.paper.question.PaperQuestionDTO">
|
||||
<id column="paper_question_id" property="paperQuestionId"/>
|
||||
<result column="paper_id" property="paperId"/>
|
||||
<result column="question_id" property="questionId"/>
|
||||
<result column="question_sort" property="questionSort"/>
|
||||
<result column="question_subject" property="questionSubject"/>
|
||||
<result column="question_type" property="questionType"/>
|
||||
<result column="question_choice_type" property="questionChoiceType"/>
|
||||
<result column="question_difficulty" property="questionDifficulty"/>
|
||||
<result column="question_source" property="questionSource"/>
|
||||
</resultMap>
|
||||
|
||||
<resultMap id="paperQuestionPO" type="ink.wgink.module.examine.pojo.pos.paper.PaperQuestionPO">
|
||||
<id column="paper_question_id" property="paperQuestionId"/>
|
||||
<result column="paper_id" property="paperId"/>
|
||||
<result column="question_id" property="questionId"/>
|
||||
<result column="question_sort" property="questionId"/>
|
||||
</resultMap>
|
||||
|
||||
<!-- 建表 -->
|
||||
@ -84,4 +92,51 @@
|
||||
</where>
|
||||
</select>
|
||||
|
||||
<!-- 试卷试题列表 -->
|
||||
<select id="list" parameterType="map" resultMap="paperQuestionDTO">
|
||||
SELECT
|
||||
t1.paper_question_id,
|
||||
t1.paper_id,
|
||||
t1.question_id,
|
||||
t1.question_sort,
|
||||
jt1.subject question_subject,
|
||||
jt1.type question_type,
|
||||
jt1.choice_type question_choice_type,
|
||||
jt1.difficulty question_difficulty,
|
||||
jt1.source question_source
|
||||
FROM
|
||||
exam_paper_question t1
|
||||
INNER JOIN
|
||||
exam_question jt1
|
||||
ON
|
||||
t1.question_id = jt1.question_id
|
||||
WHERE
|
||||
jt1.is_delete = 0
|
||||
<if test="paperId != null and paperId != ''">
|
||||
AND
|
||||
t1.paper_id = #{paperId}
|
||||
</if>
|
||||
<if test="paperIds != null and paperIds.size > 0">
|
||||
AND
|
||||
t1.paper_id IN
|
||||
<foreach collection="paperIds" index="index" open="(" separator="," close=")">
|
||||
#{paperIds[${index}]}
|
||||
</foreach>
|
||||
</if>
|
||||
<if test="keywords != null and keywords != ''">
|
||||
AND
|
||||
jt1.subject LIKE CONCAT('%', #{keywords}, '%')
|
||||
</if>
|
||||
<if test="questionType != null and questionType != ''">
|
||||
AND
|
||||
jt1.type = #{questionType}
|
||||
</if>
|
||||
<if test="sort != null and (sort == 'questionSort')">
|
||||
ORDER BY
|
||||
<if test="sort == 'questionSort'">
|
||||
t1.question_sort ${order}
|
||||
</if>
|
||||
</if>
|
||||
</select>
|
||||
|
||||
</mapper>
|
@ -18,7 +18,7 @@
|
||||
<div class="layui-card-body">
|
||||
<div class="test-table-reload-btn" style="margin-bottom: 10px;">
|
||||
<div class="layui-inline">
|
||||
<input type="text" id="keywords" class="layui-input search-item search-item-width-100" placeholder="输入关键字">
|
||||
<input type="text" id="keywords" class="layui-input search-item search-item-width-200" placeholder="输入试题名称">
|
||||
</div>
|
||||
<button type="button" id="search" class="layui-btn layui-btn-sm">
|
||||
<i class="fa fa-lg fa-search"></i> 搜索
|
||||
@ -64,7 +64,7 @@
|
||||
var questionType = queryParams.questionType;
|
||||
var selectCount = queryParams.selectCount;
|
||||
var selectedCount = 0;
|
||||
var tableUrl = 'api/paper/question/listpage?paperId={paperId}&questionType={questionType}';
|
||||
var tableUrl = 'api/paper/question/listpage/paper-id/{paperId}?questionType={questionType}';
|
||||
|
||||
function getDifficulty(num) {
|
||||
var result = '';
|
||||
@ -93,7 +93,7 @@
|
||||
[
|
||||
{type:'checkbox', fixed: 'left'},
|
||||
{field:'rowNum', width:80, title: '序号', fixed: 'left', align:'center', templet: '<span>{{d.LAY_INDEX}}</span>'},
|
||||
{field: 'questionSubject', width: 400, title: '题目', align:'center',
|
||||
{field: 'questionSubject', width: 400, title: '试题题目', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
@ -102,7 +102,7 @@
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'questionType', width: 150, title: '种类', align:'center',
|
||||
{field: 'questionType', width: 150, title: '试题种类', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
@ -120,7 +120,7 @@
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'questionChoiceType', width: 150, title: '选择类别', align:'center',
|
||||
{field: 'questionChoiceType', width: 150, title: '试题选择类别', align:'center',
|
||||
templet: function(row) {
|
||||
if(row.questionType != 'choice') {
|
||||
return '-';
|
||||
@ -137,7 +137,7 @@
|
||||
return rowData;
|
||||
}
|
||||
},
|
||||
{field: 'questionDifficulty', width: 150, title: '难度', align:'center',
|
||||
{field: 'questionDifficulty', width: 150, title: '试题难度', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
@ -146,7 +146,7 @@
|
||||
return getDifficulty(rowData);
|
||||
}
|
||||
},
|
||||
{field: 'questionSource', width: 150, title: '来源', align:'center',
|
||||
{field: 'questionSource', width: 150, title: '试题来源', align:'center',
|
||||
templet: function(row) {
|
||||
var rowData = row[this.field];
|
||||
if(typeof(rowData) === 'undefined' || rowData == null || rowData == '') {
|
||||
|
Loading…
Reference in New Issue
Block a user