考核评估-试题库
This commit is contained in:
parent
863a8b312d
commit
54095a7983
@ -0,0 +1,115 @@
|
|||||||
|
package com.inspur.web.controller.examine;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.inspur.common.annotation.Log;
|
||||||
|
import com.inspur.common.core.controller.BaseController;
|
||||||
|
import com.inspur.common.core.domain.AjaxResult;
|
||||||
|
import com.inspur.common.enums.BusinessType;
|
||||||
|
import com.inspur.examine.domain.ExamQuestionBank;
|
||||||
|
import com.inspur.examine.service.IExamQuestionBankService;
|
||||||
|
import com.inspur.common.utils.poi.ExcelUtil;
|
||||||
|
import com.inspur.common.core.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 试题库Controller
|
||||||
|
*
|
||||||
|
* @author inspur
|
||||||
|
* @date 2024-05-06
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/examine/question")
|
||||||
|
public class ExamQuestionBankController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IExamQuestionBankService examQuestionBankService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询试题库列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('examine:question:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(ExamQuestionBank examQuestionBank)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<ExamQuestionBank> list = examQuestionBankService.selectExamQuestionBankList(examQuestionBank);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出试题库列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('examine:question:export')")
|
||||||
|
@Log(title = "试题库", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, ExamQuestionBank examQuestionBank)
|
||||||
|
{
|
||||||
|
List<ExamQuestionBank> list = examQuestionBankService.selectExamQuestionBankList(examQuestionBank);
|
||||||
|
ExcelUtil<ExamQuestionBank> util = new ExcelUtil<ExamQuestionBank>(ExamQuestionBank.class);
|
||||||
|
util.exportExcel(response, list, "试题库数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取试题库详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('examine:question:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") String id)
|
||||||
|
{
|
||||||
|
return success(examQuestionBankService.selectExamQuestionBankById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增试题库
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('examine:question:add')")
|
||||||
|
@Log(title = "试题库", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody ExamQuestionBank examQuestionBank)
|
||||||
|
{
|
||||||
|
return toAjax(examQuestionBankService.insertExamQuestionBank(examQuestionBank));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改试题库
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('examine:question:edit')")
|
||||||
|
@Log(title = "试题库", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody ExamQuestionBank examQuestionBank)
|
||||||
|
{
|
||||||
|
return toAjax(examQuestionBankService.updateExamQuestionBank(examQuestionBank));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除试题库
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('examine:question:remove')")
|
||||||
|
@Log(title = "试题库", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable String[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(examQuestionBankService.deleteExamQuestionBankByIds(ids));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改状态
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('examine:question:changeStatus')")
|
||||||
|
@Log(title = "修改状态", businessType = BusinessType.UPDATE)
|
||||||
|
@PostMapping("/changeStatus")
|
||||||
|
public AjaxResult changeStatus(@RequestBody ExamQuestionBank examQuestionBank)
|
||||||
|
{
|
||||||
|
return toAjax(examQuestionBankService.updateExamQuestionBank(examQuestionBank));
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,71 @@
|
|||||||
|
package com.inspur.examine.domain;
|
||||||
|
|
||||||
|
import com.inspur.common.annotation.Excel;
|
||||||
|
import com.inspur.common.core.domain.BaseEntity;
|
||||||
|
import lombok.Data;
|
||||||
|
import lombok.EqualsAndHashCode;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 试题库对象 exam_question_bank
|
||||||
|
*
|
||||||
|
* @author inspur
|
||||||
|
* @date 2024-05-06
|
||||||
|
*/
|
||||||
|
@EqualsAndHashCode(callSuper = true)
|
||||||
|
@Data
|
||||||
|
public class ExamQuestionBank extends BaseEntity {
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 主键
|
||||||
|
*/
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 考试类型(按业务等进行划分)
|
||||||
|
*/
|
||||||
|
@Excel(name = "考试类型", dictType = "exam_type")
|
||||||
|
private String examType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 考试等级 0 初级,1 中级,2 高级
|
||||||
|
*/
|
||||||
|
@Excel(name = "考试等级", dictType = "exam_level")
|
||||||
|
private String examLevel;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 试题类型 0 单选,1 多选,2 判断
|
||||||
|
*/
|
||||||
|
@Excel(name = "试题类型", dictType = "question_type")
|
||||||
|
private String questionType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 试题题目
|
||||||
|
*/
|
||||||
|
@Excel(name = "试题题目")
|
||||||
|
private String questionTitle;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 试题选项
|
||||||
|
*/
|
||||||
|
@Excel(name = "试题选项")
|
||||||
|
private String questionOptions;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 试题答案
|
||||||
|
*/
|
||||||
|
@Excel(name = "试题答案")
|
||||||
|
private String questionAnswer;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 答案解析
|
||||||
|
*/
|
||||||
|
@Excel(name = "答案解析")
|
||||||
|
private String questionAnswerAnalysis;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 状态
|
||||||
|
*/
|
||||||
|
@Excel(name = "状态", dictType = "sys_normal_disable")
|
||||||
|
private String status;
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
package com.inspur.examine.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.inspur.examine.domain.ExamQuestionBank;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 试题库Mapper接口
|
||||||
|
*
|
||||||
|
* @author inspur
|
||||||
|
* @date 2024-05-06
|
||||||
|
*/
|
||||||
|
public interface ExamQuestionBankMapper
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询试题库
|
||||||
|
*
|
||||||
|
* @param id 试题库主键
|
||||||
|
* @return 试题库
|
||||||
|
*/
|
||||||
|
public ExamQuestionBank selectExamQuestionBankById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询试题库列表
|
||||||
|
*
|
||||||
|
* @param examQuestionBank 试题库
|
||||||
|
* @return 试题库集合
|
||||||
|
*/
|
||||||
|
public List<ExamQuestionBank> selectExamQuestionBankList(ExamQuestionBank examQuestionBank);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增试题库
|
||||||
|
*
|
||||||
|
* @param examQuestionBank 试题库
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertExamQuestionBank(ExamQuestionBank examQuestionBank);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改试题库
|
||||||
|
*
|
||||||
|
* @param examQuestionBank 试题库
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateExamQuestionBank(ExamQuestionBank examQuestionBank);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除试题库
|
||||||
|
*
|
||||||
|
* @param id 试题库主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteExamQuestionBankById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除试题库
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteExamQuestionBankByIds(String[] ids);
|
||||||
|
}
|
@ -0,0 +1,102 @@
|
|||||||
|
package com.inspur.examine.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.inspur.common.utils.DateUtils;
|
||||||
|
import com.inspur.common.utils.SecurityUtils;
|
||||||
|
import com.inspur.common.utils.uuid.IdUtils;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.inspur.examine.mapper.ExamQuestionBankMapper;
|
||||||
|
import com.inspur.examine.domain.ExamQuestionBank;
|
||||||
|
import com.inspur.examine.service.IExamQuestionBankService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 试题库Service业务层处理
|
||||||
|
*
|
||||||
|
* @author inspur
|
||||||
|
* @date 2024-05-06
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ExamQuestionBankServiceImpl implements IExamQuestionBankService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private ExamQuestionBankMapper examQuestionBankMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询试题库
|
||||||
|
*
|
||||||
|
* @param id 试题库主键
|
||||||
|
* @return 试题库
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ExamQuestionBank selectExamQuestionBankById(String id)
|
||||||
|
{
|
||||||
|
return examQuestionBankMapper.selectExamQuestionBankById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询试题库列表
|
||||||
|
*
|
||||||
|
* @param examQuestionBank 试题库
|
||||||
|
* @return 试题库
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<ExamQuestionBank> selectExamQuestionBankList(ExamQuestionBank examQuestionBank)
|
||||||
|
{
|
||||||
|
return examQuestionBankMapper.selectExamQuestionBankList(examQuestionBank);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增试题库
|
||||||
|
*
|
||||||
|
* @param examQuestionBank 试题库
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertExamQuestionBank(ExamQuestionBank examQuestionBank)
|
||||||
|
{
|
||||||
|
examQuestionBank.setId(IdUtils.fastSimpleUUID());
|
||||||
|
examQuestionBank.setCreateBy(String.valueOf(SecurityUtils.getUserId()));
|
||||||
|
examQuestionBank.setCreateTime(DateUtils.getNowDate());
|
||||||
|
examQuestionBank.setStatus("0");
|
||||||
|
return examQuestionBankMapper.insertExamQuestionBank(examQuestionBank);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改试题库
|
||||||
|
*
|
||||||
|
* @param examQuestionBank 试题库
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateExamQuestionBank(ExamQuestionBank examQuestionBank)
|
||||||
|
{
|
||||||
|
examQuestionBank.setUpdateBy(String.valueOf(SecurityUtils.getUserId()));
|
||||||
|
examQuestionBank.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
return examQuestionBankMapper.updateExamQuestionBank(examQuestionBank);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除试题库
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的试题库主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteExamQuestionBankByIds(String[] ids)
|
||||||
|
{
|
||||||
|
return examQuestionBankMapper.deleteExamQuestionBankByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除试题库信息
|
||||||
|
*
|
||||||
|
* @param id 试题库主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteExamQuestionBankById(String id)
|
||||||
|
{
|
||||||
|
return examQuestionBankMapper.deleteExamQuestionBankById(id);
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,61 @@
|
|||||||
|
package com.inspur.examine.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.inspur.examine.domain.ExamQuestionBank;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 试题库Service接口
|
||||||
|
*
|
||||||
|
* @author inspur
|
||||||
|
* @date 2024-05-06
|
||||||
|
*/
|
||||||
|
public interface IExamQuestionBankService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询试题库
|
||||||
|
*
|
||||||
|
* @param id 试题库主键
|
||||||
|
* @return 试题库
|
||||||
|
*/
|
||||||
|
public ExamQuestionBank selectExamQuestionBankById(String id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询试题库列表
|
||||||
|
*
|
||||||
|
* @param examQuestionBank 试题库
|
||||||
|
* @return 试题库集合
|
||||||
|
*/
|
||||||
|
public List<ExamQuestionBank> selectExamQuestionBankList(ExamQuestionBank examQuestionBank);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增试题库
|
||||||
|
*
|
||||||
|
* @param examQuestionBank 试题库
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertExamQuestionBank(ExamQuestionBank examQuestionBank);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改试题库
|
||||||
|
*
|
||||||
|
* @param examQuestionBank 试题库
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateExamQuestionBank(ExamQuestionBank examQuestionBank);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除试题库
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的试题库主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteExamQuestionBankByIds(String[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除试题库信息
|
||||||
|
*
|
||||||
|
* @param id 试题库主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteExamQuestionBankById(String id);
|
||||||
|
}
|
@ -0,0 +1,106 @@
|
|||||||
|
<?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.inspur.examine.mapper.ExamQuestionBankMapper">
|
||||||
|
|
||||||
|
<resultMap type="com.inspur.examine.domain.ExamQuestionBank" id="ExamQuestionBankResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="examType" column="exam_type" />
|
||||||
|
<result property="examLevel" column="exam_level" />
|
||||||
|
<result property="questionType" column="question_type" />
|
||||||
|
<result property="questionTitle" column="question_title" />
|
||||||
|
<result property="questionOptions" column="question_options" />
|
||||||
|
<result property="questionAnswer" column="question_answer" />
|
||||||
|
<result property="questionAnswerAnalysis" column="question_answer_analysis" />
|
||||||
|
<result property="status" column="status" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectExamQuestionBankVo">
|
||||||
|
select id, exam_type, exam_level, question_type, question_title, question_options, question_answer, question_answer_analysis, status, create_by, create_time, update_by, update_time from exam_question_bank
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectExamQuestionBankList" parameterType="com.inspur.examine.domain.ExamQuestionBank" resultMap="ExamQuestionBankResult">
|
||||||
|
<include refid="selectExamQuestionBankVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="examType != null and examType != ''"> and exam_type = #{examType}</if>
|
||||||
|
<if test="examLevel != null and examLevel != ''"> and exam_level = #{examLevel}</if>
|
||||||
|
<if test="questionType != null and questionType != ''"> and question_type = #{questionType}</if>
|
||||||
|
<if test="questionTitle != null and questionTitle != ''"> and question_title like concat('%', #{questionTitle}, '%')</if>
|
||||||
|
<if test="status != null and status != ''"> and status = #{status}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectExamQuestionBankById" parameterType="String" resultMap="ExamQuestionBankResult">
|
||||||
|
<include refid="selectExamQuestionBankVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertExamQuestionBank" parameterType="com.inspur.examine.domain.ExamQuestionBank">
|
||||||
|
insert into exam_question_bank
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">id,</if>
|
||||||
|
<if test="examType != null and examType != ''">exam_type,</if>
|
||||||
|
<if test="examLevel != null and examLevel != ''">exam_level,</if>
|
||||||
|
<if test="questionType != null and questionType != ''">question_type,</if>
|
||||||
|
<if test="questionTitle != null and questionTitle != ''">question_title,</if>
|
||||||
|
<if test="questionOptions != null and questionOptions != ''">question_options,</if>
|
||||||
|
<if test="questionAnswer != null and questionAnswer != ''">question_answer,</if>
|
||||||
|
<if test="questionAnswerAnalysis != null and questionAnswerAnalysis != ''">question_answer_analysis,</if>
|
||||||
|
<if test="status != null">status,</if>
|
||||||
|
<if test="createBy != null">create_by,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="updateBy != null">update_by,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="id != null">#{id},</if>
|
||||||
|
<if test="examType != null and examType != ''">#{examType},</if>
|
||||||
|
<if test="examLevel != null and examLevel != ''">#{examLevel},</if>
|
||||||
|
<if test="questionType != null and questionType != ''">#{questionType},</if>
|
||||||
|
<if test="questionTitle != null and questionTitle != ''">#{questionTitle},</if>
|
||||||
|
<if test="questionOptions != null and questionOptions != ''">#{questionOptions},</if>
|
||||||
|
<if test="questionAnswer != null and questionAnswer != ''">#{questionAnswer},</if>
|
||||||
|
<if test="questionAnswerAnalysis != null and questionAnswerAnalysis != ''">#{questionAnswerAnalysis},</if>
|
||||||
|
<if test="status != null">#{status},</if>
|
||||||
|
<if test="createBy != null">#{createBy},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateExamQuestionBank" parameterType="com.inspur.examine.domain.ExamQuestionBank">
|
||||||
|
update exam_question_bank
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="examType != null and examType != ''">exam_type = #{examType},</if>
|
||||||
|
<if test="examLevel != null and examLevel != ''">exam_level = #{examLevel},</if>
|
||||||
|
<if test="questionType != null and questionType != ''">question_type = #{questionType},</if>
|
||||||
|
<if test="questionTitle != null and questionTitle != ''">question_title = #{questionTitle},</if>
|
||||||
|
<if test="questionOptions != null and questionOptions != ''">question_options = #{questionOptions},</if>
|
||||||
|
<if test="questionAnswer != null and questionAnswer != ''">question_answer = #{questionAnswer},</if>
|
||||||
|
<if test="questionAnswerAnalysis != null and questionAnswerAnalysis != ''">question_answer_analysis = #{questionAnswerAnalysis},</if>
|
||||||
|
<if test="status != null">status = #{status},</if>
|
||||||
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteExamQuestionBankById" parameterType="String">
|
||||||
|
delete from exam_question_bank where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteExamQuestionBankByIds" parameterType="String">
|
||||||
|
delete from exam_question_bank where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
53
inspur-ui/src/api/examine/question.js
Normal file
53
inspur-ui/src/api/examine/question.js
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
import request from '@/utils/request'
|
||||||
|
|
||||||
|
// 查询试题库列表
|
||||||
|
export function listQuestion(query) {
|
||||||
|
return request({
|
||||||
|
url: '/examine/question/list',
|
||||||
|
method: 'get',
|
||||||
|
params: query
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 查询试题库详细
|
||||||
|
export function getQuestion(id) {
|
||||||
|
return request({
|
||||||
|
url: '/examine/question/' + id,
|
||||||
|
method: 'get'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 新增试题库
|
||||||
|
export function addQuestion(data) {
|
||||||
|
return request({
|
||||||
|
url: '/examine/question',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改试题库
|
||||||
|
export function updateQuestion(data) {
|
||||||
|
return request({
|
||||||
|
url: '/examine/question',
|
||||||
|
method: 'put',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 删除试题库
|
||||||
|
export function delQuestion(id) {
|
||||||
|
return request({
|
||||||
|
url: '/examine/question/' + id,
|
||||||
|
method: 'delete'
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
// 修改状态
|
||||||
|
export function changeStatus(data) {
|
||||||
|
return request({
|
||||||
|
url: '/examine/question/changeStatus',
|
||||||
|
method: 'post',
|
||||||
|
data: data
|
||||||
|
})
|
||||||
|
}
|
419
inspur-ui/src/views/examine/question/index.vue
Normal file
419
inspur-ui/src/views/examine/question/index.vue
Normal file
@ -0,0 +1,419 @@
|
|||||||
|
<template>
|
||||||
|
<div class="app-container">
|
||||||
|
<el-form :model="queryParams" ref="queryForm" size="small" :inline="true" v-show="showSearch" label-width="80px">
|
||||||
|
<el-form-item label="试题题目" prop="questionTitle">
|
||||||
|
<el-input v-model="queryParams.questionTitle" placeholder="请输入试题题目"/>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="考试类型" prop="examType">
|
||||||
|
<el-select v-model="queryParams.examType" placeholder="请选择考试类型" clearable>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in dict.type.exam_type"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="考试等级" prop="examLevel">
|
||||||
|
<el-select v-model="queryParams.examLevel" placeholder="请选择考试等级" clearable>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in dict.type.exam_level"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="试题类型" prop="questionType">
|
||||||
|
<el-select v-model="queryParams.questionType" placeholder="请选择试题类型" clearable>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in dict.type.question_type"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="状态" prop="status">
|
||||||
|
<el-select v-model="queryParams.status" placeholder="请选择状态" clearable>
|
||||||
|
<el-option
|
||||||
|
v-for="dict in dict.type.sys_normal_disable"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
/>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item>
|
||||||
|
<el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
|
||||||
|
<el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
|
||||||
|
<el-row :gutter="10" class="mb8">
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="primary"
|
||||||
|
plain
|
||||||
|
icon="el-icon-plus"
|
||||||
|
size="mini"
|
||||||
|
@click="handleAdd"
|
||||||
|
v-hasPermi="['examine:question:add']"
|
||||||
|
>新增</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="success"
|
||||||
|
plain
|
||||||
|
icon="el-icon-edit"
|
||||||
|
size="mini"
|
||||||
|
:disabled="single"
|
||||||
|
@click="handleUpdate"
|
||||||
|
v-hasPermi="['examine:question:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="danger"
|
||||||
|
plain
|
||||||
|
icon="el-icon-delete"
|
||||||
|
size="mini"
|
||||||
|
:disabled="multiple"
|
||||||
|
@click="handleDelete"
|
||||||
|
v-hasPermi="['examine:question:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
</el-col>
|
||||||
|
<el-col :span="1.5">
|
||||||
|
<el-button
|
||||||
|
type="warning"
|
||||||
|
plain
|
||||||
|
icon="el-icon-download"
|
||||||
|
size="mini"
|
||||||
|
@click="handleExport"
|
||||||
|
v-hasPermi="['examine:question:export']"
|
||||||
|
>导出</el-button>
|
||||||
|
</el-col>
|
||||||
|
<right-toolbar :showSearch.sync="showSearch" @queryTable="getList"></right-toolbar>
|
||||||
|
</el-row>
|
||||||
|
|
||||||
|
<el-table v-loading="loading" :data="questionList" @selection-change="handleSelectionChange">
|
||||||
|
<el-table-column type="selection" width="55" align="center" />
|
||||||
|
<el-table-column label="考试类型" align="center" prop="examType">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<dict-tag :options="dict.type.exam_type" :value="scope.row.examType"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="考试等级" align="center" prop="examLevel">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<dict-tag :options="dict.type.exam_level" :value="scope.row.examLevel"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="试题类型" align="center" prop="questionType">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<dict-tag :options="dict.type.question_type" :value="scope.row.questionType"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="试题题目" align="center" prop="questionTitle" />
|
||||||
|
<el-table-column label="试题答案" align="center" prop="questionAnswer" />
|
||||||
|
<el-table-column label="答案解析" align="center" prop="questionAnswerAnalysis" />
|
||||||
|
<el-table-column label="状态" align="center" prop="status">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<dict-tag :options="dict.type.sys_normal_disable" :value="scope.row.status"/>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
<el-table-column label="操作" align="center" class-name="small-padding fixed-width">
|
||||||
|
<template slot-scope="scope">
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-edit"
|
||||||
|
@click="handleUpdate(scope.row)"
|
||||||
|
v-hasPermi="['examine:question:edit']"
|
||||||
|
>修改</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="text"
|
||||||
|
icon="el-icon-delete"
|
||||||
|
@click="handleDelete(scope.row)"
|
||||||
|
v-hasPermi="['examine:question:remove']"
|
||||||
|
>删除</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-switch-button"
|
||||||
|
@click="handleStart(scope.row)"
|
||||||
|
v-if="scope.row.status === '1'"
|
||||||
|
v-hasPermi="['examine:question:changeStatus']"
|
||||||
|
>启用</el-button>
|
||||||
|
<el-button
|
||||||
|
size="mini"
|
||||||
|
type="primary"
|
||||||
|
icon="el-icon-switch-button"
|
||||||
|
@click="handleStop(scope.row)"
|
||||||
|
v-if="scope.row.status === '0'"
|
||||||
|
v-hasPermi="['examine:question:changeStatus']"
|
||||||
|
>禁用</el-button>
|
||||||
|
</template>
|
||||||
|
</el-table-column>
|
||||||
|
</el-table>
|
||||||
|
|
||||||
|
<pagination
|
||||||
|
v-show="total>0"
|
||||||
|
:total="total"
|
||||||
|
:page.sync="queryParams.pageNum"
|
||||||
|
:limit.sync="queryParams.pageSize"
|
||||||
|
@pagination="getList"
|
||||||
|
/>
|
||||||
|
|
||||||
|
<!-- 添加或修改试题库对话框 -->
|
||||||
|
<el-dialog :title="title" :visible.sync="open" width="500px" append-to-body>
|
||||||
|
<el-form ref="form" :model="form" :rules="rules" label-width="120px">
|
||||||
|
<el-form-item label="考试类型" prop="examType">
|
||||||
|
<el-select v-model="form.examType" placeholder="请选择考试类型">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in dict.type.exam_type"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="考试等级" prop="examLevel">
|
||||||
|
<el-select v-model="form.examLevel" placeholder="请选择考试等级">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in dict.type.exam_level"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="试题类型" prop="questionType">
|
||||||
|
<el-select v-model="form.questionType" placeholder="请选择试题类型">
|
||||||
|
<el-option
|
||||||
|
v-for="dict in dict.type.question_type"
|
||||||
|
:key="dict.value"
|
||||||
|
:label="dict.label"
|
||||||
|
:value="dict.value"
|
||||||
|
></el-option>
|
||||||
|
</el-select>
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="试题题目" prop="questionTitle">
|
||||||
|
<el-input v-model="form.questionTitle" type="textarea" placeholder="请输入内容" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="试题选项" prop="questionOptions">
|
||||||
|
<el-input v-model="form.questionOptions" placeholder="请输入试题选项" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="试题答案" prop="questionAnswer">
|
||||||
|
<el-input v-model="form.questionAnswer" placeholder="请输入试题答案" />
|
||||||
|
</el-form-item>
|
||||||
|
<el-form-item label="答案解析" prop="questionAnswerAnalysis">
|
||||||
|
<el-input v-model="form.questionAnswerAnalysis" type="textarea" placeholder="请输入内容" />
|
||||||
|
</el-form-item>
|
||||||
|
</el-form>
|
||||||
|
<div slot="footer" class="dialog-footer">
|
||||||
|
<el-button type="primary" @click="submitForm">确 定</el-button>
|
||||||
|
<el-button @click="cancel">取 消</el-button>
|
||||||
|
</div>
|
||||||
|
</el-dialog>
|
||||||
|
</div>
|
||||||
|
</template>
|
||||||
|
|
||||||
|
<script>
|
||||||
|
import { listQuestion, getQuestion, delQuestion, addQuestion, updateQuestion, changeStatus } from "@/api/examine/question";
|
||||||
|
|
||||||
|
export default {
|
||||||
|
name: "Question",
|
||||||
|
dicts: ['exam_type', 'question_type', 'exam_level', 'sys_normal_disable'],
|
||||||
|
data() {
|
||||||
|
return {
|
||||||
|
// 遮罩层
|
||||||
|
loading: true,
|
||||||
|
// 选中数组
|
||||||
|
ids: [],
|
||||||
|
// 非单个禁用
|
||||||
|
single: true,
|
||||||
|
// 非多个禁用
|
||||||
|
multiple: true,
|
||||||
|
// 显示搜索条件
|
||||||
|
showSearch: true,
|
||||||
|
// 总条数
|
||||||
|
total: 0,
|
||||||
|
// 试题库表格数据
|
||||||
|
questionList: [],
|
||||||
|
// 弹出层标题
|
||||||
|
title: "",
|
||||||
|
// 是否显示弹出层
|
||||||
|
open: false,
|
||||||
|
// 查询参数
|
||||||
|
queryParams: {
|
||||||
|
pageNum: 1,
|
||||||
|
pageSize: 10,
|
||||||
|
examType: null,
|
||||||
|
examLevel: null,
|
||||||
|
questionType: null,
|
||||||
|
questionTitle: null,
|
||||||
|
status: null,
|
||||||
|
},
|
||||||
|
// 表单参数
|
||||||
|
form: {},
|
||||||
|
// 表单校验
|
||||||
|
rules: {
|
||||||
|
examType: [
|
||||||
|
{ required: true, message: "考试类型不能为空", trigger: "change" }
|
||||||
|
],
|
||||||
|
examLevel: [
|
||||||
|
{ required: true, message: "考试等级不能为空", trigger: "change" }
|
||||||
|
],
|
||||||
|
questionType: [
|
||||||
|
{ required: true, message: "试题类型不能为空", trigger: "change" }
|
||||||
|
],
|
||||||
|
questionTitle: [
|
||||||
|
{ required: true, message: "试题题目不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
questionOptions: [
|
||||||
|
{ required: true, message: "试题选项不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
questionAnswer: [
|
||||||
|
{ required: true, message: "试题答案不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
questionAnswerAnalysis: [
|
||||||
|
{ required: true, message: "答案解析不能为空", trigger: "blur" }
|
||||||
|
],
|
||||||
|
}
|
||||||
|
};
|
||||||
|
},
|
||||||
|
created() {
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
methods: {
|
||||||
|
//启用
|
||||||
|
handleStart(row) {
|
||||||
|
this.loading = true
|
||||||
|
const data = {
|
||||||
|
id: row.id,
|
||||||
|
status: '0'
|
||||||
|
}
|
||||||
|
this.changeStatus(data)
|
||||||
|
},
|
||||||
|
//禁用
|
||||||
|
handleStop(row){
|
||||||
|
this.loading = true
|
||||||
|
const data = {
|
||||||
|
id: row.id,
|
||||||
|
status: '1'
|
||||||
|
}
|
||||||
|
this.changeStatus(data)
|
||||||
|
},
|
||||||
|
//修改状态
|
||||||
|
changeStatus(data){
|
||||||
|
changeStatus(data).then(()=>{
|
||||||
|
this.$modal.msgSuccess("修改状态成功");
|
||||||
|
this.loading = false;
|
||||||
|
this.getList();
|
||||||
|
})
|
||||||
|
},
|
||||||
|
/** 查询试题库列表 */
|
||||||
|
getList() {
|
||||||
|
this.loading = true;
|
||||||
|
listQuestion(this.queryParams).then(response => {
|
||||||
|
this.questionList = response.rows;
|
||||||
|
this.total = response.total;
|
||||||
|
this.loading = false;
|
||||||
|
});
|
||||||
|
},
|
||||||
|
// 取消按钮
|
||||||
|
cancel() {
|
||||||
|
this.open = false;
|
||||||
|
this.reset();
|
||||||
|
},
|
||||||
|
// 表单重置
|
||||||
|
reset() {
|
||||||
|
this.form = {
|
||||||
|
id: null,
|
||||||
|
examType: null,
|
||||||
|
examLevel: null,
|
||||||
|
questionType: null,
|
||||||
|
questionTitle: null,
|
||||||
|
questionOptions: null,
|
||||||
|
questionAnswer: null,
|
||||||
|
questionAnswerAnalysis: null,
|
||||||
|
status: null,
|
||||||
|
createBy: null,
|
||||||
|
createTime: null,
|
||||||
|
updateBy: null,
|
||||||
|
updateTime: null
|
||||||
|
};
|
||||||
|
this.resetForm("form");
|
||||||
|
},
|
||||||
|
/** 搜索按钮操作 */
|
||||||
|
handleQuery() {
|
||||||
|
this.queryParams.pageNum = 1;
|
||||||
|
this.getList();
|
||||||
|
},
|
||||||
|
/** 重置按钮操作 */
|
||||||
|
resetQuery() {
|
||||||
|
this.resetForm("queryForm");
|
||||||
|
this.handleQuery();
|
||||||
|
},
|
||||||
|
// 多选框选中数据
|
||||||
|
handleSelectionChange(selection) {
|
||||||
|
this.ids = selection.map(item => item.id)
|
||||||
|
this.single = selection.length!==1
|
||||||
|
this.multiple = !selection.length
|
||||||
|
},
|
||||||
|
/** 新增按钮操作 */
|
||||||
|
handleAdd() {
|
||||||
|
this.reset();
|
||||||
|
this.open = true;
|
||||||
|
this.title = "添加试题";
|
||||||
|
},
|
||||||
|
/** 修改按钮操作 */
|
||||||
|
handleUpdate(row) {
|
||||||
|
this.reset();
|
||||||
|
const id = row.id || this.ids
|
||||||
|
getQuestion(id).then(response => {
|
||||||
|
this.form = response.data;
|
||||||
|
this.open = true;
|
||||||
|
this.title = "修改试题";
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 提交按钮 */
|
||||||
|
submitForm() {
|
||||||
|
this.$refs["form"].validate(valid => {
|
||||||
|
if (valid) {
|
||||||
|
if (this.form.id != null) {
|
||||||
|
updateQuestion(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("修改成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
} else {
|
||||||
|
addQuestion(this.form).then(response => {
|
||||||
|
this.$modal.msgSuccess("新增成功");
|
||||||
|
this.open = false;
|
||||||
|
this.getList();
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
});
|
||||||
|
},
|
||||||
|
/** 删除按钮操作 */
|
||||||
|
handleDelete(row) {
|
||||||
|
const ids = row.id || this.ids;
|
||||||
|
this.$modal.confirm('是否确认删除试题库编号为"' + ids + '"的数据项?').then(function() {
|
||||||
|
return delQuestion(ids);
|
||||||
|
}).then(() => {
|
||||||
|
this.getList();
|
||||||
|
this.$modal.msgSuccess("删除成功");
|
||||||
|
}).catch(() => {});
|
||||||
|
},
|
||||||
|
/** 导出按钮操作 */
|
||||||
|
handleExport() {
|
||||||
|
this.download('examine/question/export', {
|
||||||
|
...this.queryParams
|
||||||
|
}, `question_${new Date().getTime()}.xlsx`)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
</script>
|
Loading…
Reference in New Issue
Block a user