From 54095a7983caf1f908df001e484e065e17fbc4a4 Mon Sep 17 00:00:00 2001 From: xusd Date: Mon, 6 May 2024 17:06:52 +0800 Subject: [PATCH] =?UTF-8?q?=E8=80=83=E6=A0=B8=E8=AF=84=E4=BC=B0-=E8=AF=95?= =?UTF-8?q?=E9=A2=98=E5=BA=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../examine/ExamQuestionBankController.java | 115 +++++ .../examine/domain/ExamQuestionBank.java | 71 +++ .../mapper/ExamQuestionBankMapper.java | 61 +++ .../service/ExamQuestionBankServiceImpl.java | 102 +++++ .../service/IExamQuestionBankService.java | 61 +++ .../mapper/ExamQuestionBankMapper.xml | 106 +++++ inspur-ui/src/api/examine/question.js | 53 +++ .../src/views/examine/question/index.vue | 419 ++++++++++++++++++ 8 files changed, 988 insertions(+) create mode 100644 inspur-service/inspur-admin/src/main/java/com/inspur/web/controller/examine/ExamQuestionBankController.java create mode 100644 inspur-service/inspur-examine/src/main/java/com/inspur/examine/domain/ExamQuestionBank.java create mode 100644 inspur-service/inspur-examine/src/main/java/com/inspur/examine/mapper/ExamQuestionBankMapper.java create mode 100644 inspur-service/inspur-examine/src/main/java/com/inspur/examine/service/ExamQuestionBankServiceImpl.java create mode 100644 inspur-service/inspur-examine/src/main/java/com/inspur/examine/service/IExamQuestionBankService.java create mode 100644 inspur-service/inspur-examine/src/main/resources/mapper/ExamQuestionBankMapper.xml create mode 100644 inspur-ui/src/api/examine/question.js create mode 100644 inspur-ui/src/views/examine/question/index.vue diff --git a/inspur-service/inspur-admin/src/main/java/com/inspur/web/controller/examine/ExamQuestionBankController.java b/inspur-service/inspur-admin/src/main/java/com/inspur/web/controller/examine/ExamQuestionBankController.java new file mode 100644 index 0000000..d2a6cae --- /dev/null +++ b/inspur-service/inspur-admin/src/main/java/com/inspur/web/controller/examine/ExamQuestionBankController.java @@ -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 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 list = examQuestionBankService.selectExamQuestionBankList(examQuestionBank); + ExcelUtil util = new ExcelUtil(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)); + } +} diff --git a/inspur-service/inspur-examine/src/main/java/com/inspur/examine/domain/ExamQuestionBank.java b/inspur-service/inspur-examine/src/main/java/com/inspur/examine/domain/ExamQuestionBank.java new file mode 100644 index 0000000..62dfaa4 --- /dev/null +++ b/inspur-service/inspur-examine/src/main/java/com/inspur/examine/domain/ExamQuestionBank.java @@ -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; +} diff --git a/inspur-service/inspur-examine/src/main/java/com/inspur/examine/mapper/ExamQuestionBankMapper.java b/inspur-service/inspur-examine/src/main/java/com/inspur/examine/mapper/ExamQuestionBankMapper.java new file mode 100644 index 0000000..8c5c900 --- /dev/null +++ b/inspur-service/inspur-examine/src/main/java/com/inspur/examine/mapper/ExamQuestionBankMapper.java @@ -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 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); +} diff --git a/inspur-service/inspur-examine/src/main/java/com/inspur/examine/service/ExamQuestionBankServiceImpl.java b/inspur-service/inspur-examine/src/main/java/com/inspur/examine/service/ExamQuestionBankServiceImpl.java new file mode 100644 index 0000000..1c1dcee --- /dev/null +++ b/inspur-service/inspur-examine/src/main/java/com/inspur/examine/service/ExamQuestionBankServiceImpl.java @@ -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 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); + } +} diff --git a/inspur-service/inspur-examine/src/main/java/com/inspur/examine/service/IExamQuestionBankService.java b/inspur-service/inspur-examine/src/main/java/com/inspur/examine/service/IExamQuestionBankService.java new file mode 100644 index 0000000..895ff7e --- /dev/null +++ b/inspur-service/inspur-examine/src/main/java/com/inspur/examine/service/IExamQuestionBankService.java @@ -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 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); +} diff --git a/inspur-service/inspur-examine/src/main/resources/mapper/ExamQuestionBankMapper.xml b/inspur-service/inspur-examine/src/main/resources/mapper/ExamQuestionBankMapper.xml new file mode 100644 index 0000000..d7ac4ab --- /dev/null +++ b/inspur-service/inspur-examine/src/main/resources/mapper/ExamQuestionBankMapper.xml @@ -0,0 +1,106 @@ + + + + + + + + + + + + + + + + + + + + + + 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 + + + + + + + + insert into exam_question_bank + + 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, + + + #{id}, + #{examType}, + #{examLevel}, + #{questionType}, + #{questionTitle}, + #{questionOptions}, + #{questionAnswer}, + #{questionAnswerAnalysis}, + #{status}, + #{createBy}, + #{createTime}, + #{updateBy}, + #{updateTime}, + + + + + update exam_question_bank + + exam_type = #{examType}, + exam_level = #{examLevel}, + question_type = #{questionType}, + question_title = #{questionTitle}, + question_options = #{questionOptions}, + question_answer = #{questionAnswer}, + question_answer_analysis = #{questionAnswerAnalysis}, + status = #{status}, + create_by = #{createBy}, + create_time = #{createTime}, + update_by = #{updateBy}, + update_time = #{updateTime}, + + where id = #{id} + + + + delete from exam_question_bank where id = #{id} + + + + delete from exam_question_bank where id in + + #{id} + + + \ No newline at end of file diff --git a/inspur-ui/src/api/examine/question.js b/inspur-ui/src/api/examine/question.js new file mode 100644 index 0000000..c615437 --- /dev/null +++ b/inspur-ui/src/api/examine/question.js @@ -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 + }) +} diff --git a/inspur-ui/src/views/examine/question/index.vue b/inspur-ui/src/views/examine/question/index.vue new file mode 100644 index 0000000..42a0bd0 --- /dev/null +++ b/inspur-ui/src/views/examine/question/index.vue @@ -0,0 +1,419 @@ + + +