From 200170e5f3cd25c16bb9a891b96320af96f8edb3 Mon Sep 17 00:00:00 2001
From: 陆继保 <lubao0120@163.com>
Date: 星期二, 29 六月 2021 15:04:25 +0800
Subject: [PATCH] update ruoyi-common/src/main/java/com/ruoyi/common/utils/DictUtils.java.
---
ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java | 256 ++++++++++++++++++++++++--------------------------
1 files changed, 124 insertions(+), 132 deletions(-)
diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java
index 3185f41..e2e0625 100644
--- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java
+++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/system/SysDictTypeController.java
@@ -1,132 +1,124 @@
-package com.ruoyi.web.controller.system;
-
-import java.util.List;
-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 org.springframework.web.bind.annotation.PathVariable;
-import org.springframework.web.bind.annotation.PostMapping;
-import org.springframework.web.bind.annotation.PutMapping;
-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.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;
-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;
-
-/**
- * 鏁版嵁瀛楀吀淇℃伅
- *
- * @author ruoyi
- */
-@RestController
-@RequestMapping("/system/dict/type")
-public class SysDictTypeController extends BaseController
-{
- @Autowired
- private ISysDictTypeService dictTypeService;
-
- @PreAuthorize("@ss.hasPermi('system:dict:list')")
- @GetMapping("/list")
- public TableDataInfo list(SysDictType dictType)
- {
- startPage();
- List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
- return getDataTable(list);
- }
-
- @Log(title = "瀛楀吀绫诲瀷", businessType = BusinessType.EXPORT)
- @PreAuthorize("@ss.hasPermi('system:dict:export')")
- @GetMapping("/export")
- public AjaxResult export(SysDictType dictType)
- {
- List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
- ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
- return util.exportExcel(list, "瀛楀吀绫诲瀷");
- }
-
- /**
- * 鏌ヨ瀛楀吀绫诲瀷璇︾粏
- */
- @PreAuthorize("@ss.hasPermi('system:dict:query')")
- @GetMapping(value = "/{dictId}")
- public AjaxResult getInfo(@PathVariable Long dictId)
- {
- return AjaxResult.success(dictTypeService.selectDictTypeById(dictId));
- }
-
- /**
- * 鏂板瀛楀吀绫诲瀷
- */
- @PreAuthorize("@ss.hasPermi('system:dict:add')")
- @Log(title = "瀛楀吀绫诲瀷", businessType = BusinessType.INSERT)
- @PostMapping
- public AjaxResult add(@Validated @RequestBody SysDictType dict)
- {
- if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
- {
- return AjaxResult.error("鏂板瀛楀吀'" + dict.getDictName() + "'澶辫触锛屽瓧鍏哥被鍨嬪凡瀛樺湪");
- }
- dict.setCreateBy(SecurityUtils.getUsername());
- return toAjax(dictTypeService.insertDictType(dict));
- }
-
- /**
- * 淇敼瀛楀吀绫诲瀷
- */
- @PreAuthorize("@ss.hasPermi('system:dict:edit')")
- @Log(title = "瀛楀吀绫诲瀷", businessType = BusinessType.UPDATE)
- @PutMapping
- public AjaxResult edit(@Validated @RequestBody SysDictType dict)
- {
- if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
- {
- return AjaxResult.error("淇敼瀛楀吀'" + dict.getDictName() + "'澶辫触锛屽瓧鍏哥被鍨嬪凡瀛樺湪");
- }
- dict.setUpdateBy(SecurityUtils.getUsername());
- return toAjax(dictTypeService.updateDictType(dict));
- }
-
- /**
- * 鍒犻櫎瀛楀吀绫诲瀷
- */
- @PreAuthorize("@ss.hasPermi('system:dict:remove')")
- @Log(title = "瀛楀吀绫诲瀷", businessType = BusinessType.DELETE)
- @DeleteMapping("/{dictIds}")
- public AjaxResult remove(@PathVariable Long[] dictIds)
- {
- dictTypeService.deleteDictTypeByIds(dictIds);
- return success();
- }
-
- /**
- * 鍒锋柊瀛楀吀缂撳瓨
- */
- @PreAuthorize("@ss.hasPermi('system:dict:remove')")
- @Log(title = "瀛楀吀绫诲瀷", businessType = BusinessType.CLEAN)
- @DeleteMapping("/refreshCache")
- public AjaxResult refreshCache()
- {
- dictTypeService.resetDictCache();
- return AjaxResult.success();
- }
-
- /**
- * 鑾峰彇瀛楀吀閫夋嫨妗嗗垪琛�
- */
- @GetMapping("/optionselect")
- public AjaxResult optionselect()
- {
- List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
- return AjaxResult.success(dictTypes);
- }
-}
+package com.ruoyi.web.controller.system;
+
+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;
+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;
+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.*;
+
+import java.util.List;
+
+/**
+ * 鏁版嵁瀛楀吀淇℃伅
+ *
+ * @author ruoyi
+ */
+@RestController
+@RequestMapping("/system/dict/type")
+public class SysDictTypeController extends BaseController
+{
+ @Autowired
+ private ISysDictTypeService dictTypeService;
+
+ @PreAuthorize("@ss.hasPermi('system:dict:list')")
+ @GetMapping("/list")
+ public TableDataInfo list(SysDictType dictType)
+ {
+ return dictTypeService.selectPageDictTypeList(dictType);
+ }
+
+ @Log(title = "瀛楀吀绫诲瀷", businessType = BusinessType.EXPORT)
+ @PreAuthorize("@ss.hasPermi('system:dict:export')")
+ @GetMapping("/export")
+ public AjaxResult export(SysDictType dictType)
+ {
+ List<SysDictType> list = dictTypeService.selectDictTypeList(dictType);
+ ExcelUtil<SysDictType> util = new ExcelUtil<SysDictType>(SysDictType.class);
+ return util.exportExcel(list, "瀛楀吀绫诲瀷");
+ }
+
+ /**
+ * 鏌ヨ瀛楀吀绫诲瀷璇︾粏
+ */
+ @PreAuthorize("@ss.hasPermi('system:dict:query')")
+ @GetMapping(value = "/{dictId}")
+ public AjaxResult getInfo(@PathVariable Long dictId)
+ {
+ return AjaxResult.success(dictTypeService.selectDictTypeById(dictId));
+ }
+
+ /**
+ * 鏂板瀛楀吀绫诲瀷
+ */
+ @PreAuthorize("@ss.hasPermi('system:dict:add')")
+ @Log(title = "瀛楀吀绫诲瀷", businessType = BusinessType.INSERT)
+ @PostMapping
+ public AjaxResult add(@Validated @RequestBody SysDictType dict)
+ {
+ if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
+ {
+ return AjaxResult.error("鏂板瀛楀吀'" + dict.getDictName() + "'澶辫触锛屽瓧鍏哥被鍨嬪凡瀛樺湪");
+ }
+ dict.setCreateBy(SecurityUtils.getUsername());
+ return toAjax(dictTypeService.insertDictType(dict));
+ }
+
+ /**
+ * 淇敼瀛楀吀绫诲瀷
+ */
+ @PreAuthorize("@ss.hasPermi('system:dict:edit')")
+ @Log(title = "瀛楀吀绫诲瀷", businessType = BusinessType.UPDATE)
+ @PutMapping
+ public AjaxResult edit(@Validated @RequestBody SysDictType dict)
+ {
+ if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
+ {
+ return AjaxResult.error("淇敼瀛楀吀'" + dict.getDictName() + "'澶辫触锛屽瓧鍏哥被鍨嬪凡瀛樺湪");
+ }
+ dict.setUpdateBy(SecurityUtils.getUsername());
+ return toAjax(dictTypeService.updateDictType(dict));
+ }
+
+ /**
+ * 鍒犻櫎瀛楀吀绫诲瀷
+ */
+ @PreAuthorize("@ss.hasPermi('system:dict:remove')")
+ @Log(title = "瀛楀吀绫诲瀷", businessType = BusinessType.DELETE)
+ @DeleteMapping("/{dictIds}")
+ public AjaxResult remove(@PathVariable Long[] dictIds)
+ {
+ dictTypeService.deleteDictTypeByIds(dictIds);
+ return success();
+ }
+
+ /**
+ * 鍒锋柊瀛楀吀缂撳瓨
+ */
+ @PreAuthorize("@ss.hasPermi('system:dict:remove')")
+ @Log(title = "瀛楀吀绫诲瀷", businessType = BusinessType.CLEAN)
+ @DeleteMapping("/refreshCache")
+ public AjaxResult refreshCache()
+ {
+ dictTypeService.resetDictCache();
+ return AjaxResult.success();
+ }
+
+ /**
+ * 鑾峰彇瀛楀吀閫夋嫨妗嗗垪琛�
+ */
+ @GetMapping("/optionselect")
+ public AjaxResult optionselect()
+ {
+ List<SysDictType> dictTypes = dictTypeService.selectDictTypeAll();
+ return AjaxResult.success(dictTypes);
+ }
+}
--
Gitblit v1.9.3