| | |
| | | import org.springframework.web.bind.annotation.RequestMapping;
|
| | | import org.springframework.web.bind.annotation.RestController;
|
| | | import com.ruoyi.common.annotation.Log;
|
| | | import com.ruoyi.common.constant.UserConstants;
|
| | | import com.ruoyi.common.core.controller.BaseController;
|
| | | import com.ruoyi.common.core.domain.AjaxResult;
|
| | | import com.ruoyi.common.core.domain.entity.SysDictType;
|
| | |
| | | @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(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(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);
|
| | | }
|
| | | }
|