|
|
|
@ -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<SysDictData> 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<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
|
|
|
|
ExcelUtil<SysDictData> util = new ExcelUtil<SysDictData>(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<SysDictData> list = dictDataService.selectDictDataList(dictData);
|
|
|
|
|
return success(list);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|