| | |
| | | package com.ruoyi.system.controller;
|
| | |
|
| | | import java.io.IOException;
|
| | | import java.util.List;
|
| | | import javax.servlet.http.HttpServletResponse;
|
| | | import org.springframework.beans.factory.annotation.Autowired;
|
| | | import org.springframework.security.access.prepost.PreAuthorize;
|
| | | import org.springframework.validation.annotation.Validated;
|
| | | import org.springframework.web.bind.annotation.DeleteMapping;
|
| | | import org.springframework.web.bind.annotation.GetMapping;
|
| | |
| | | import com.ruoyi.common.core.web.page.TableDataInfo;
|
| | | import com.ruoyi.common.log.annotation.Log;
|
| | | import com.ruoyi.common.log.enums.BusinessType;
|
| | | import com.ruoyi.common.security.annotation.RequiresPermissions;
|
| | | import com.ruoyi.common.security.utils.SecurityUtils;
|
| | | import com.ruoyi.system.domain.SysDictType;
|
| | | import com.ruoyi.system.api.domain.SysDictType;
|
| | | import com.ruoyi.system.service.ISysDictTypeService;
|
| | |
|
| | | /**
|
| | |
| | | @Autowired
|
| | | private ISysDictTypeService dictTypeService;
|
| | |
|
| | | @PreAuthorize("@ss.hasPermi('system:dict:list')")
|
| | | @RequiresPermissions("system:dict:list")
|
| | | @GetMapping("/list")
|
| | | public TableDataInfo list(SysDictType dictType)
|
| | | {
|
| | |
| | | }
|
| | |
|
| | | @Log(title = "字典类型", businessType = BusinessType.EXPORT)
|
| | | @PreAuthorize("@ss.hasPermi('system:dict:export')")
|
| | | @RequiresPermissions("system:dict:export")
|
| | | @PostMapping("/export")
|
| | | public void export(HttpServletResponse response, SysDictType dictType) throws IOException
|
| | | public void export(HttpServletResponse response, SysDictType dictType)
|
| | | {
|
| | | List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
| | | ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
|
| | |
| | | /**
|
| | | * 查询字典类型详细
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:dict:query')")
|
| | | @RequiresPermissions("system:dict:query")
|
| | | @GetMapping(value = "/{dictId}")
|
| | | public AjaxResult getInfo(@PathVariable Long dictId)
|
| | | {
|
| | |
| | | /**
|
| | | * 新增字典类型
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:dict:add')")
|
| | | @RequiresPermissions("system:dict:add")
|
| | | @Log(title = "字典类型", businessType = BusinessType.INSERT)
|
| | | @PostMapping
|
| | | public AjaxResult add(@Validated @RequestBody SysDictType dict)
|
| | |
| | | /**
|
| | | * 修改字典类型
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:dict:edit')")
|
| | | @RequiresPermissions("system:dict:edit")
|
| | | @Log(title = "字典类型", businessType = BusinessType.UPDATE)
|
| | | @PutMapping
|
| | | public AjaxResult edit(@Validated @RequestBody SysDictType dict)
|
| | |
| | | /**
|
| | | * 删除字典类型
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
| | | @RequiresPermissions("system:dict:remove")
|
| | | @Log(title = "字典类型", businessType = BusinessType.DELETE)
|
| | | @DeleteMapping("/{dictIds}")
|
| | | public AjaxResult remove(@PathVariable Long[] dictIds)
|
| | | {
|
| | | return toAjax(dictTypeService.deleteDictTypeByIds(dictIds));
|
| | | dictTypeService.deleteDictTypeByIds(dictIds);
|
| | | return success();
|
| | | }
|
| | |
|
| | | /**
|
| | | * 清空缓存
|
| | | * 刷新字典缓存
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('system:dict:remove')")
|
| | | @RequiresPermissions("system:dict:remove")
|
| | | @Log(title = "字典类型", businessType = BusinessType.CLEAN)
|
| | | @DeleteMapping("/clearCache")
|
| | | public AjaxResult clearCache()
|
| | | @DeleteMapping("/refreshCache")
|
| | | public AjaxResult refreshCache()
|
| | | {
|
| | | dictTypeService.clearCache();
|
| | | dictTypeService.resetDictCache();
|
| | | return AjaxResult.success();
|
| | | }
|
| | |
|