Pārlūkot izejas kodu

添加字典名称校验

wyyay 2 gadi atpakaļ
vecāks
revīzija
b79c92c429

+ 5 - 3
hazard-admin/src/main/java/com/ozs/web/controller/system/SysDictTypeController.java

@@ -112,9 +112,11 @@ public class SysDictTypeController extends BaseController {
     @PostMapping
     @PostMapping
     public AjaxResult add(@Validated @RequestBody SysDictType dict)
     public AjaxResult add(@Validated @RequestBody SysDictType dict)
     {
     {
-        if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict)))
-        {
-            return error("新增字典'" + dict.getDictName() + "'失败,字典类型已存在");
+        if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictTypeUnique(dict))) {
+            return error("新增字典'" + dict.getDictType() + "'失败,字典类型已存在");
+        }
+        if (UserConstants.NOT_UNIQUE.equals(dictTypeService.checkDictNameUnique(dict))) {
+            return error("新增字典'" + dict.getDictName() + "'失败,字典名称已存在");
         }
         }
         dict.setCreateBy(getUsername());
         dict.setCreateBy(getUsername());
         return toAjax(dictTypeService.insertDictType(dict));
         return toAjax(dictTypeService.insertDictType(dict));