2 Komitmen 856b67461f ... 6b43614e65

Pembuat SHA1 Pesan Tanggal
  liyang 6b43614e65 feat(adm-diagram): 名称长度限制 2 tahun lalu
  liyang 05baeb47f7 feat(adm-diagram): 名称长度限制 2 tahun lalu

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

@@ -115,6 +115,12 @@ public class DiagramController {
                                             @RequestParam String projectId,
                                             @RequestParam String groupCode) {
         Diagram diagram = diagramManager.fromMapData(params);
+
+        if (diagram.getName() == null || diagram.getName().length() < 3
+                || diagram.getName().length() > 15) {
+            throw new BusinessException(ResponseCode.A0400.getCode(), "名称长度不能小于3,不能超过15");
+        }
+
         diagram.setGroupCode(groupCode);
         diagram.setProjectId(projectId);
 
@@ -277,6 +283,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")));
     }