From 2a17e23ae4afccb6b2de5cdbcf35cdec0ed752f8 Mon Sep 17 00:00:00 2001 From: wangxy <1356089412@qq.com> Date: Tue, 2 Jul 2024 15:13:18 +0800 Subject: [PATCH] =?UTF-8?q?feat:=E8=80=83=E8=AF=95=E7=AE=A1=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../system/system/SysDictDataController.java | 40 ++++++++++--------- .../templates/system/elExam/exam/exam.html | 2 +- 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/system/SysDictDataController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/system/SysDictDataController.java index 46910df..b20f36d 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/system/SysDictDataController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/system/SysDictDataController.java @@ -1,6 +1,8 @@ package com.ruoyi.web.controller.system.system; import java.util.List; + +import io.swagger.annotations.ApiOperation; import org.apache.shiro.authz.annotation.RequiresPermissions; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; @@ -22,13 +24,12 @@ import com.ruoyi.system.service.ISysDictDataService; /** * 数据字典信息 - * + * * @author ruoyi */ @Controller @RequestMapping("/system/dict/data") -public class SysDictDataController extends BaseController -{ +public class SysDictDataController extends BaseController { private String prefix = "system/dict/data"; @Autowired @@ -36,16 +37,14 @@ public class SysDictDataController extends BaseController @RequiresPermissions("system:dict:view") @GetMapping() - public String dictData() - { + public String dictData() { return prefix + "/data"; } @PostMapping("/list") @RequiresPermissions("system:dict:list") @ResponseBody - public TableDataInfo list(SysDictData dictData) - { + public TableDataInfo list(SysDictData dictData) { startPage(); List list = dictDataService.selectDictDataList(dictData); return getDataTable(list); @@ -55,8 +54,7 @@ public class SysDictDataController extends BaseController @RequiresPermissions("system:dict:export") @PostMapping("/export") @ResponseBody - public AjaxResult export(SysDictData dictData) - { + public AjaxResult export(SysDictData dictData) { List list = dictDataService.selectDictDataList(dictData); ExcelUtil util = new ExcelUtil(SysDictData.class); return util.exportExcel(list, "字典数据"); @@ -66,8 +64,7 @@ public class SysDictDataController extends BaseController * 新增字典类型 */ @GetMapping("/add/{dictType}") - public String add(@PathVariable("dictType") String dictType, ModelMap mmap) - { + public String add(@PathVariable("dictType") String dictType, ModelMap mmap) { mmap.put("dictType", dictType); return prefix + "/add"; } @@ -79,8 +76,7 @@ public class SysDictDataController extends BaseController @RequiresPermissions("system:dict:add") @PostMapping("/add") @ResponseBody - public AjaxResult addSave(@Validated SysDictData dict) - { + public AjaxResult addSave(@Validated SysDictData dict) { dict.setCreateBy(getLoginName()); return toAjax(dictDataService.insertDictData(dict)); } @@ -90,8 +86,7 @@ public class SysDictDataController extends BaseController */ @RequiresPermissions("system:dict:edit") @GetMapping("/edit/{dictCode}") - public String edit(@PathVariable("dictCode") Long dictCode, ModelMap mmap) - { + public String edit(@PathVariable("dictCode") Long dictCode, ModelMap mmap) { mmap.put("dict", dictDataService.selectDictDataById(dictCode)); return prefix + "/edit"; } @@ -103,8 +98,7 @@ public class SysDictDataController extends BaseController @RequiresPermissions("system:dict:edit") @PostMapping("/edit") @ResponseBody - public AjaxResult editSave(@Validated SysDictData dict) - { + public AjaxResult editSave(@Validated SysDictData dict) { dict.setUpdateBy(getLoginName()); return toAjax(dictDataService.updateDictData(dict)); } @@ -113,9 +107,17 @@ public class SysDictDataController extends BaseController @RequiresPermissions("system:dict:remove") @PostMapping("/remove") @ResponseBody - public AjaxResult remove(String ids) - { + public AjaxResult remove(String ids) { dictDataService.deleteDictDataByIds(ids); return success(); } + + + @ApiOperation("根据类型查询字典值") + @PostMapping("/dataList") + @ResponseBody + public AjaxResult dataList(SysDictData dictData) { + List list = dictDataService.selectDictDataList(dictData); + return success(list); + } } diff --git a/ruoyi-admin/src/main/resources/templates/system/elExam/exam/exam.html b/ruoyi-admin/src/main/resources/templates/system/elExam/exam/exam.html index 722152b..488ded2 100644 --- a/ruoyi-admin/src/main/resources/templates/system/elExam/exam/exam.html +++ b/ruoyi-admin/src/main/resources/templates/system/elExam/exam/exam.html @@ -75,7 +75,7 @@ }, { field: 'openType', - title: '题目类型', + title: '考试类型', align: 'center', formatter: function(value, row, index) { return $.table.selectDictLabel(types, value);