From 81147fa427b1653f7eadb3878e8aa3fee3b632fc Mon Sep 17 00:00:00 2001 From: zhangyuhang Date: Sun, 3 Nov 2024 14:54:50 +0800 Subject: [PATCH] =?UTF-8?q?[Bug]=20[dinky-admin]=20Fix=20the=20issue=20of?= =?UTF-8?q?=20primary=20key=20generation=20strategy=20=E2=80=A6=20(#3895)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dinky-admin/src/main/java/org/dinky/data/model/Resources.java | 2 +- .../org/dinky/service/resource/impl/ResourceServiceImpl.java | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/dinky-admin/src/main/java/org/dinky/data/model/Resources.java b/dinky-admin/src/main/java/org/dinky/data/model/Resources.java index 5a00c3032e..ecbc133b4a 100644 --- a/dinky-admin/src/main/java/org/dinky/data/model/Resources.java +++ b/dinky-admin/src/main/java/org/dinky/data/model/Resources.java @@ -54,7 +54,7 @@ @AllArgsConstructor public class Resources extends Model { - @TableId(type = IdType.ASSIGN_ID) + @TableId(type = IdType.AUTO) @ApiModelProperty(value = "ID", dataType = "Integer", example = "1", notes = "Unique identifier for the resource") private Integer id; diff --git a/dinky-admin/src/main/java/org/dinky/service/resource/impl/ResourceServiceImpl.java b/dinky-admin/src/main/java/org/dinky/service/resource/impl/ResourceServiceImpl.java index e10c1ec7c4..5f9b5db87f 100644 --- a/dinky-admin/src/main/java/org/dinky/service/resource/impl/ResourceServiceImpl.java +++ b/dinky-admin/src/main/java/org/dinky/service/resource/impl/ResourceServiceImpl.java @@ -86,6 +86,8 @@ public boolean syncRemoteDirectoryStructure() { x.setType(resources.getType()); x.setUserId(resources.getUserId()); } + x.setId(Math.abs(x.getId())); + x.setPid(Math.abs(x.getPid())); }) .collect(Collectors.toList()); // not delete root directory