| | |
| | | package com.ruoyi.web.controller.system;
|
| | |
|
| | | 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 com.ruoyi.common.core.domain.entity.SysDictType;
|
| | | import com.ruoyi.common.core.page.TableDataInfo;
|
| | | import com.ruoyi.common.enums.BusinessType;
|
| | | import com.ruoyi.common.utils.SecurityUtils;
|
| | | import com.ruoyi.common.utils.poi.ExcelUtil;
|
| | | import com.ruoyi.system.service.ISysDictTypeService;
|
| | |
|
| | |
| | |
|
| | | @Log(title = "字典类型", businessType = BusinessType.EXPORT)
|
| | | @PreAuthorize("@ss.hasPermi('system:dict:export')")
|
| | | @GetMapping("/export")
|
| | | public AjaxResult export(SysDictType dictType)
|
| | | @PostMapping("/export")
|
| | | public void export(HttpServletResponse response, SysDictType dictType)
|
| | | {
|
| | | List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
|
| | | ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
|
| | | return util.exportExcel(list, "字典类型");
|
| | | util.exportExcel(response, list, "字典类型");
|
| | | }
|
| | |
|
| | | /**
|
| | |
| | | {
|
| | | return AjaxResult.error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
| | | }
|
| | | dict.setCreateBy(SecurityUtils.getUsername());
|
| | | dict.setCreateBy(getUsername());
|
| | | return toAjax(dictTypeService.insertDictType(dict));
|
| | | }
|
| | |
|
| | |
| | | {
|
| | | return AjaxResult.error("修改字典'" + dict.getDictName() + "'失败,字典类型已存在");
|
| | | }
|
| | | dict.setUpdateBy(SecurityUtils.getUsername());
|
| | | dict.setUpdateBy(getUsername());
|
| | | return toAjax(dictTypeService.updateDictType(dict));
|
| | | }
|
| | |
|
| | |
| | | @DeleteMapping("/{dictIds}")
|
| | | public AjaxResult remove(@PathVariable Long[] dictIds)
|
| | | {
|
| | | return toAjax(dictTypeService.deleteDictTypeByIds(dictIds));
|
| | | dictTypeService.deleteDictTypeByIds(dictIds);
|
| | | return success();
|
| | | }
|
| | |
|
| | | /**
|
| | | * 清空缓存
|
| | | * 刷新字典缓存
|
| | | */
|
| | | @PreAuthorize("@ss.hasPermi('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();
|
| | | }
|
| | |
|