| | |
| | | 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.R; |
| | | import com.ruoyi.common.core.domain.PageQuery; |
| | | import com.ruoyi.common.core.domain.entity.SysDictType; |
| | | import com.ruoyi.common.core.page.TableDataInfo; |
| | |
| | | @ApiOperation("查询字典类型详细") |
| | | @SaCheckPermission("system:dict:query") |
| | | @GetMapping(value = "/{dictId}") |
| | | public AjaxResult<SysDictType> getInfo(@ApiParam("字典ID") @PathVariable Long dictId) { |
| | | return AjaxResult.success(dictTypeService.selectDictTypeById(dictId)); |
| | | public R<SysDictType> getInfo(@ApiParam("字典ID") @PathVariable Long dictId) { |
| | | return R.ok(dictTypeService.selectDictTypeById(dictId)); |
| | | } |
| | | |
| | | /** |
| | |
| | | @SaCheckPermission("system:dict:add") |
| | | @Log(title = "字典类型", businessType = BusinessType.INSERT) |
| | | @PostMapping |
| | | public AjaxResult<Void> add(@Validated @RequestBody SysDictType dict) { |
| | | public R<Void> add(@Validated @RequestBody SysDictType dict) { |
| | | if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) { |
| | | return AjaxResult.error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在"); |
| | | return R.fail("新增字典'" + dict.getDictName() + "'失败,字典类型已存在"); |
| | | } |
| | | return toAjax(dictTypeService.insertDictType(dict)); |
| | | } |
| | |
| | | @SaCheckPermission("system:dict:edit") |
| | | @Log(title = "字典类型", businessType = BusinessType.UPDATE) |
| | | @PutMapping |
| | | public AjaxResult<Void> edit(@Validated @RequestBody SysDictType dict) { |
| | | public R<Void> edit(@Validated @RequestBody SysDictType dict) { |
| | | if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) { |
| | | return AjaxResult.error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在"); |
| | | return R.fail("修改字典'" + dict.getDictName() + "'失败,字典类型已存在"); |
| | | } |
| | | return toAjax(dictTypeService.updateDictType(dict)); |
| | | } |
| | |
| | | @SaCheckPermission("system:dict:remove") |
| | | @Log(title = "字典类型", businessType = BusinessType.DELETE) |
| | | @DeleteMapping("/{dictIds}") |
| | | public AjaxResult<Void> remove(@ApiParam("字典ID串") @PathVariable Long[] dictIds) { |
| | | public R<Void> remove(@ApiParam("字典ID串") @PathVariable Long[] dictIds) { |
| | | dictTypeService.deleteDictTypeByIds(dictIds); |
| | | return success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | @SaCheckPermission("system:dict:remove") |
| | | @Log(title = "字典类型", businessType = BusinessType.CLEAN) |
| | | @DeleteMapping("/refreshCache") |
| | | public AjaxResult<Void> refreshCache() { |
| | | public R<Void> refreshCache() { |
| | | dictTypeService.resetDictCache(); |
| | | return AjaxResult.success(); |
| | | return R.ok(); |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | @ApiOperation("获取字典选择框列表") |
| | | @GetMapping("/optionselect") |
| | | public AjaxResult<List<SysDictType>> optionselect() { |
| | | public R<List<SysDictType>> optionselect() { |
| | | List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll(); |
| | | return AjaxResult.success(dictTypes); |
| | | return R.ok(dictTypes); |
| | | } |
| | | } |