| | |
| | | package com.ruoyi.system.controller;
|
| | |
|
| | | import java.util.List;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | | import jakarta.servlet.http.HttpServletResponse;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.validation.annotation.Validated;
|
| | | import org.springframework.web.bind.annotation.DeleteMapping;
|
| | |
| | | import org.springframework.web.bind.annotation.RequestBody;
|
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | | import com.ruoyi.common.core.constant.UserConstants;
|
| | | import com.ruoyi.common.core.utils.poi.ExcelUtil;
|
| | | import com.ruoyi.common.core.web.controller.BaseController;
|
| | | import com.ruoyi.common.core.web.domain.AjaxResult;
|
| | |
| | | @GetMapping(value = "/{dictId}")
|
| | | public AjaxResult getInfo(@PathVariable Long dictId)
|
| | | {
|
| | | return AjaxResult.success(dictTypeService.selectDictTypeById(dictId));
|
| | | return success(dictTypeService.selectDictTypeById(dictId));
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | @PostMapping
|
| | | public AjaxResult add(@Validated @RequestBody SysDictType dict)
|
| | | {
|
| | | if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
|
| | | if (!dictTypeService.checkDictTypeUnique(dict))
|
| | | {
|
| | | return AjaxResult.error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
| | | return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
| | | }
|
| | | dict.setCreateBy(SecurityUtils.getUsername());
|
| | | return toAjax(dictTypeService.insertDictType(dict));
|
| | |
| | | @PutMapping
|
| | | public AjaxResult edit(@Validated @RequestBody SysDictType dict)
|
| | | {
|
| | | if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
|
| | | if (!dictTypeService.checkDictTypeUnique(dict))
|
| | | {
|
| | | return AjaxResult.error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
| | | return error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
| | | }
|
| | | dict.setUpdateBy(SecurityUtils.getUsername());
|
| | | return toAjax(dictTypeService.updateDictType(dict));
|
| | |
| | | public AjaxResult refreshCache()
|
| | | {
|
| | | dictTypeService.resetDictCache();
|
| | | return AjaxResult.success();
|
| | | return success();
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | public AjaxResult optionselect()
|
| | | {
|
| | | List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
|
| | | return AjaxResult.success(dictTypes);
|
| | | return success(dictTypes);
|
| | | }
|
| | | }
|