Selaa lähdekoodia

feat(adm-diagram): 名称长度限制

liyang 2 vuotta sitten
vanhempi
commit
05baeb47f7

+ 7 - 0
adm-business/adm-diagram/src/main/java/com/persagy/adm/diagram/controller/DiagramController.java

@@ -277,6 +277,13 @@ public class DiagramController {
     @ApiOperation("系统图状态变更")
     @PostMapping("/update/name")
     public CommonResult<Boolean> updateName(@RequestBody Map<String, String> params) {
+        if (params == null) {
+            throw new BusinessException(ResponseCode.A0400.getCode(), "请求参数为空");
+        }
+        String name = params.get("name");
+        if (StrUtil.isBlank(name) || name.length() < 3 || name.length() > 15) {
+            throw new BusinessException(ResponseCode.A0400.getCode(), "名称长度不能小于3,不能超过15");
+        }
         return ResultHelper.single(dataStrategy.updateName(params.get("name"), params.get("id")));
     }