Browse Source

fix bug:修复更新图标签及名称总是提示存在相同的问题

lijie 2 years ago
parent
commit
ae6f749ce5

+ 8 - 4
labsl/src/main/kotlin/com/persagy/labsl/service/impl/GraphServiceImpl.kt

@@ -443,7 +443,8 @@ open class GraphServiceImpl : ServiceImpl<GraphMapper?, GraphEntity?>(), GraphSe
             val entity = list(KtQueryWrapper(GraphEntity())
                     .eq(StrUtil.isNotBlank(Opts.projectId),GraphEntity::projectId, Opts.projectId!!)
                     .eq(StrUtil.isNotBlank(content.categoryId),GraphEntity::categoryId, content.categoryId!!)
-                    .eq(StrUtil.isNotBlank(content.name),GraphEntity::name, content.name!!))
+                    .eq(StrUtil.isNotBlank(content.name),GraphEntity::name, content.name!!)
+                    .ne(StrUtil.isNotBlank(content.graphId),GraphEntity::graphId, content.graphId))
             if (CollUtil.isNotEmpty(entity)) {
                 sBaseResponse.result = SResponseType.failure
                 sBaseResponse.message = "图名称已经存在"
@@ -452,7 +453,8 @@ open class GraphServiceImpl : ServiceImpl<GraphMapper?, GraphEntity?>(), GraphSe
             val entity1 = graphPubService.list(KtQueryWrapper(GraphPubEntity())
                     .eq(StrUtil.isNotBlank(Opts.projectId),GraphPubEntity::projectId, Opts.projectId!!)
                     .eq(StrUtil.isNotBlank(content.categoryId),GraphPubEntity::categoryId, content.categoryId!!)
-                    .eq(StrUtil.isNotBlank(content.name),GraphPubEntity::name, content.name!!))
+                    .eq(StrUtil.isNotBlank(content.name),GraphPubEntity::name, content.name!!)
+                    .ne(StrUtil.isNotBlank(content.graphId),GraphPubEntity::graphId, content.graphId))
             if (CollUtil.isNotEmpty(entity1)) {
                 sBaseResponse.result = SResponseType.failure
                 sBaseResponse.message = "同一分类下已发布图名称已存在"
@@ -477,7 +479,8 @@ open class GraphServiceImpl : ServiceImpl<GraphMapper?, GraphEntity?>(), GraphSe
             val entity = list(KtQueryWrapper(GraphEntity())
                     .eq(StrUtil.isNotBlank(Opts.projectId),GraphEntity::projectId, Opts.projectId!!)
                     .eq(StrUtil.isNotBlank(content.categoryId),GraphEntity::categoryId, content.categoryId!!)
-                    .eq(StrUtil.isNotBlank(content.name),GraphEntity::name, content.name!!))
+                    .eq(StrUtil.isNotBlank(content.name),GraphEntity::name, content.name!!)
+                    .ne(StrUtil.isNotBlank(content.graphId),GraphEntity::graphId, content.graphId))
             if (CollUtil.isNotEmpty(entity)) {
                 sBaseResponse.result = SResponseType.failure
                 sBaseResponse.message = "图名称已经存在"
@@ -486,7 +489,8 @@ open class GraphServiceImpl : ServiceImpl<GraphMapper?, GraphEntity?>(), GraphSe
             val entity1 = graphPubService.list(KtQueryWrapper(GraphPubEntity())
                     .eq(StrUtil.isNotBlank(Opts.projectId),GraphPubEntity::projectId, Opts.projectId!!)
                     .eq(StrUtil.isNotBlank(content.categoryId),GraphPubEntity::categoryId, content.categoryId!!)
-                    .eq(StrUtil.isNotBlank(content.name),GraphPubEntity::name, content.name!!))
+                    .eq(StrUtil.isNotBlank(content.name),GraphPubEntity::name, content.name!!)
+                    .ne(StrUtil.isNotBlank(content.graphId),GraphPubEntity::graphId, content.graphId))
             if (CollUtil.isNotEmpty(entity1)) {
                 sBaseResponse.result = SResponseType.failure
                 sBaseResponse.message = "同一分类下已发布图名称已存在"