From 8e9329546893b80e54ab39d84cf6bb15c6eec81a Mon Sep 17 00:00:00 2001
From: Wang Chen Chen <932560435@qq.com>
Date: Wed, 22 Nov 2023 14:04:51 +0800
Subject: [PATCH] =?UTF-8?q?1.=E4=BF=AE=E5=A4=8D=20=E5=B9=B3=E5=8F=B0web-ui?=
=?UTF-8?q?=EF=BC=8C=E9=BB=98=E8=AE=A4=E9=A1=B9=E7=9B=AE=E5=8F=AF=E4=BB=A5?=
=?UTF-8?q?=E5=88=A0=E9=99=A4=202.=E5=88=A0=E9=99=A4=E9=A1=B9=E7=9B=AE?=
=?UTF-8?q?=E6=97=B6=EF=BC=8C=E5=88=A0=E9=99=A4=E6=89=80=E6=9C=89=E5=8C=85?=
=?UTF-8?q?=E5=90=AB=E9=A1=B9=E7=9B=AEID=EF=BC=8C=E6=95=B0=E6=8D=AE?=
=?UTF-8?q?=E5=BA=93=E8=A1=A8=E4=B8=AD=E7=9A=84=E6=95=B0=E6=8D=AE?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
platform-web-ui/src/views/project/list/index.vue | 8 ++++++--
.../xaaef/molly/corems/mapper/CmsProjectMapper.java | 12 +++++++++++-
.../corems/service/impl/CmsProjectServiceImpl.java | 13 +++++++++++--
.../src/main/resources/mapper/CmsProjectMapper.xml | 12 ++++++++++++
4 files changed, 40 insertions(+), 5 deletions(-)
diff --git a/platform-web-ui/src/views/project/list/index.vue b/platform-web-ui/src/views/project/list/index.vue
index f2214fb..1892d7a 100644
--- a/platform-web-ui/src/views/project/list/index.vue
+++ b/platform-web-ui/src/views/project/list/index.vue
@@ -73,8 +73,12 @@
- 重置密码
- 删除
+
+ 重置密码
+
+
+ 删除
+
diff --git a/server/molly-cms/src/main/java/com/xaaef/molly/corems/mapper/CmsProjectMapper.java b/server/molly-cms/src/main/java/com/xaaef/molly/corems/mapper/CmsProjectMapper.java
index 23e0de3..a6b76ca 100644
--- a/server/molly-cms/src/main/java/com/xaaef/molly/corems/mapper/CmsProjectMapper.java
+++ b/server/molly-cms/src/main/java/com/xaaef/molly/corems/mapper/CmsProjectMapper.java
@@ -4,6 +4,7 @@ import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.xaaef.molly.corems.entity.CmsProject;
import com.xaaef.molly.corems.entity.TenantAndProject;
+import org.apache.ibatis.annotations.Param;
import java.util.Collection;
import java.util.Set;
@@ -28,8 +29,17 @@ public interface CmsProjectMapper extends BaseMapper {
Set selectListTableNamesByNotIncludeColumn(String column);
+ // 查询 所有的包含 project_id 的表
+ @InterceptorIgnore(tenantLine = "true")
+ Set selectListTableNamesByIncludeColumn(String column);
+
+
+ // 删除项目
+ @InterceptorIgnore(tenantLine = "true")
+ int deleteByProjectId(@Param("tableName") Set tableName, @Param("projectId") Long projectId);
+
+
// 根据 租户的数据名称 查询 项目列表。如: molly_master 、molly_google
Set selectListByTenantDbName(Collection tenantDbNameList);
-
}
diff --git a/server/molly-cms/src/main/java/com/xaaef/molly/corems/service/impl/CmsProjectServiceImpl.java b/server/molly-cms/src/main/java/com/xaaef/molly/corems/service/impl/CmsProjectServiceImpl.java
index 026f7c3..38dec67 100644
--- a/server/molly-cms/src/main/java/com/xaaef/molly/corems/service/impl/CmsProjectServiceImpl.java
+++ b/server/molly-cms/src/main/java/com/xaaef/molly/corems/service/impl/CmsProjectServiceImpl.java
@@ -22,10 +22,12 @@ import org.springframework.stereotype.Service;
import java.util.Collection;
import java.util.List;
import java.util.Optional;
+import java.util.Set;
import java.util.stream.Collectors;
import static com.xaaef.molly.auth.jwt.JwtSecurityUtils.*;
import static com.xaaef.molly.common.consts.ConfigName.PROJECT_DEFAULT_PASSWORD;
+import static com.xaaef.molly.common.consts.MbpConst.PROJECT_ID;
/**
@@ -171,11 +173,18 @@ public class CmsProjectServiceImpl extends BaseServiceImpl tableNames = baseMapper.selectListTableNamesByIncludeColumn(PROJECT_ID);
+ // 删除 此项目 在所有表中的数据
+ if (!tableNames.isEmpty()) {
+ baseMapper.deleteByProjectId(tableNames, dbProject.getProjectId());
+ }
+ // 租户 删除 此项目
tenantService.tenantDelProjectId(TenantUtils.getTenantId(), dbProject.getProjectId());
return flag2;
}
diff --git a/server/molly-cms/src/main/resources/mapper/CmsProjectMapper.xml b/server/molly-cms/src/main/resources/mapper/CmsProjectMapper.xml
index 224f5c9..bfd4e3e 100644
--- a/server/molly-cms/src/main/resources/mapper/CmsProjectMapper.xml
+++ b/server/molly-cms/src/main/resources/mapper/CmsProjectMapper.xml
@@ -16,6 +16,18 @@
+
+
+
+
+
+ DELETE FROM ${item} WHERE `project_id` = #{projectId};
+
+
+
+