From 40690ba8fe22a832d0777da4571b25d89d4ffe13 Mon Sep 17 00:00:00 2001 From: Bob <1248184508@qq.com> Date: Mon, 4 Nov 2024 15:33:30 +0800 Subject: [PATCH 1/3] =?UTF-8?q?fix/=E5=8F=AF=E6=9C=89=E5=8F=AF=E6=97=A0?= =?UTF-8?q?=E7=9A=84=E4=BF=AE=E5=A4=8D=EF=BC=8C=E6=89=8B=E5=8A=A8=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E7=A9=BA=E6=95=B0=E6=8D=AE=E5=BA=93=E7=9A=84=E6=83=85?= =?UTF-8?q?=E5=86=B5=E4=B8=8B=E8=B7=B3=E8=BF=87=E8=87=AA=E5=8A=A8=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E6=95=B0=E6=8D=AE=E5=BA=93=E6=9F=A5=E8=AF=A2=E4=B8=8D?= =?UTF-8?q?=E5=88=B0=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../init/ForumDataSourceInitializer.java | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/paicoding-web/src/main/java/com/github/paicoding/forum/web/config/init/ForumDataSourceInitializer.java b/paicoding-web/src/main/java/com/github/paicoding/forum/web/config/init/ForumDataSourceInitializer.java index 38bdb343..53c5e703 100644 --- a/paicoding-web/src/main/java/com/github/paicoding/forum/web/config/init/ForumDataSourceInitializer.java +++ b/paicoding-web/src/main/java/com/github/paicoding/forum/web/config/init/ForumDataSourceInitializer.java @@ -117,10 +117,28 @@ public class ForumDataSourceInitializer { Statement statement = connection.createStatement()) { // 查询数据库是否存在 ResultSet set = statement.executeQuery("select schema_name from information_schema.schemata where schema_name = '" + database + "'"); + String createDb = "CREATE DATABASE IF NOT EXISTS " + database; + String deleteDb = "DROP DATABASE IF EXISTS " + database; + Boolean shouldDbCreate = false; if (!set.next()) { - // 不存在时,创建数据库 - String createDb = "CREATE DATABASE IF NOT EXISTS " + database; - connection.setAutoCommit(false); + // 这种情况应该创建数据库 + shouldDbCreate = true; + } else { + // 如果数据库是空的,删除数据库并重新创建 + set = statement.executeQuery("select COUNT(*) from information_schema.tables where table_schema = '" + database + "'"); + // 如果数据库是空的 + set.next(); + if (set.getInt(1)==0) { + connection.setAutoCommit(false); + // 删除数据库 + statement.execute(deleteDb); + log.info("数据库({})为空,正在删除并重新创建", database); + // 这种情况应该重新创建数据库 + shouldDbCreate = true; + } + } + if (shouldDbCreate){ + // 创建数据库 statement.execute(createDb); connection.commit(); log.info("创建数据库({})成功", database); -- Gitee From a42a45fc4e6d380de033e2e425bc5f32822c9cd5 Mon Sep 17 00:00:00 2001 From: Bob <1248184508@qq.com> Date: Mon, 4 Nov 2024 15:33:30 +0800 Subject: [PATCH 2/3] =?UTF-8?q?fix/=E5=8F=AF=E6=9C=89=E5=8F=AF=E6=97=A0?= =?UTF-8?q?=E7=9A=84=E4=BF=AE=E5=A4=8D=EF=BC=8C=E6=89=8B=E5=8A=A8=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E7=A9=BA=E6=95=B0=E6=8D=AE=E5=BA=93=E7=9A=84=E6=83=85?= =?UTF-8?q?=E5=86=B5=E4=B8=8B=E8=B7=B3=E8=BF=87=E8=87=AA=E5=8A=A8=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E6=95=B0=E6=8D=AE=E5=BA=93=E6=9F=A5=E8=AF=A2=E4=B8=8D?= =?UTF-8?q?=E5=88=B0=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../init/ForumDataSourceInitializer.java | 24 ++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/paicoding-web/src/main/java/com/github/paicoding/forum/web/config/init/ForumDataSourceInitializer.java b/paicoding-web/src/main/java/com/github/paicoding/forum/web/config/init/ForumDataSourceInitializer.java index 38bdb343..53c5e703 100644 --- a/paicoding-web/src/main/java/com/github/paicoding/forum/web/config/init/ForumDataSourceInitializer.java +++ b/paicoding-web/src/main/java/com/github/paicoding/forum/web/config/init/ForumDataSourceInitializer.java @@ -117,10 +117,28 @@ public class ForumDataSourceInitializer { Statement statement = connection.createStatement()) { // 查询数据库是否存在 ResultSet set = statement.executeQuery("select schema_name from information_schema.schemata where schema_name = '" + database + "'"); + String createDb = "CREATE DATABASE IF NOT EXISTS " + database; + String deleteDb = "DROP DATABASE IF EXISTS " + database; + Boolean shouldDbCreate = false; if (!set.next()) { - // 不存在时,创建数据库 - String createDb = "CREATE DATABASE IF NOT EXISTS " + database; - connection.setAutoCommit(false); + // 这种情况应该创建数据库 + shouldDbCreate = true; + } else { + // 如果数据库是空的,删除数据库并重新创建 + set = statement.executeQuery("select COUNT(*) from information_schema.tables where table_schema = '" + database + "'"); + // 如果数据库是空的 + set.next(); + if (set.getInt(1)==0) { + connection.setAutoCommit(false); + // 删除数据库 + statement.execute(deleteDb); + log.info("数据库({})为空,正在删除并重新创建", database); + // 这种情况应该重新创建数据库 + shouldDbCreate = true; + } + } + if (shouldDbCreate){ + // 创建数据库 statement.execute(createDb); connection.commit(); log.info("创建数据库({})成功", database); -- Gitee From 27af994d8f1ddaf4cbd707e5094132edd44f1798 Mon Sep 17 00:00:00 2001 From: Bob <1248184508@qq.com> Date: Sat, 23 Nov 2024 22:43:23 +0800 Subject: [PATCH 3/3] =?UTF-8?q?style:=E8=B0=83=E6=95=B4=E8=83=8C=E6=99=AF?= =?UTF-8?q?=E5=9B=BE=E7=89=87=E6=98=BE=E7=A4=BA=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 将 article-item 和 side-column 组件中的背景图片显示方式从 auto 100% 改为 cover -这样可以确保背景图片在不同尺寸下都能完整显示,提升视觉效果 --- .../src/main/resources/static/css/components/article-item.css | 2 +- .../src/main/resources/static/css/components/side-column.css | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/paicoding-ui/src/main/resources/static/css/components/article-item.css b/paicoding-ui/src/main/resources/static/css/components/article-item.css index 6e02d2f7..04345c31 100644 --- a/paicoding-ui/src/main/resources/static/css/components/article-item.css +++ b/paicoding-ui/src/main/resources/static/css/components/article-item.css @@ -171,7 +171,7 @@ width: 100%; height: 100%; background-position: bottom; - background-size: auto 100%; + background-size: cover; background-repeat: no-repeat; border-radius: 50%; border-bottom-left-radius: 0; diff --git a/paicoding-ui/src/main/resources/static/css/components/side-column.css b/paicoding-ui/src/main/resources/static/css/components/side-column.css index 08ca0b0c..d152264d 100644 --- a/paicoding-ui/src/main/resources/static/css/components/side-column.css +++ b/paicoding-ui/src/main/resources/static/css/components/side-column.css @@ -664,7 +664,7 @@ .ebook-def-star { height: 16px; width: 92px; - background: url(../../img/star.png) no-repeat 0 / auto 100%; + background: url(../../img/star.png) no-repeat 0 / cover; position: relative; } @@ -676,7 +676,7 @@ .ebook-home-stars .ebook-def-star .ebook-cur-star { height: 16px; - background: url(../../img/star-lighten.png) no-repeat 0 / auto 100%; + background: url(../../img/star-lighten.png) no-repeat 0 / cover; position: absolute; left: 0; top: 0; -- Gitee