From 8b656907a346e1bb21f83b8731907633c37d6bb1 Mon Sep 17 00:00:00 2001
From: zhangli <123879394@qq.com>
Date: Mon, 7 Jul 2025 23:30:15 +0800
Subject: [PATCH] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E4=BB=A3=E7=A0=81=E7=94=9F?=
=?UTF-8?q?=E6=88=90=E7=B1=BB?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.gitignore | 1 +
.idea/.gitignore | 3 --
.idea/compiler.xml | 21 ----------
.idea/encodings.xml | 7 ----
.idea/inspectionProfiles/Project_Default.xml | 14 -------
.idea/jarRepositories.xml | 30 --------------
.idea/misc.xml | 14 -------
.idea/vcs.xml | 6 ---
Jenkinsfile | 1 -
src/main/resources/application.yml | 10 ++---
.../java/com/sczx/store/CodeGenerator.java | 41 +++++++++++++++++++
11 files changed, 47 insertions(+), 101 deletions(-)
delete mode 100644 .idea/.gitignore
delete mode 100644 .idea/compiler.xml
delete mode 100644 .idea/encodings.xml
delete mode 100644 .idea/inspectionProfiles/Project_Default.xml
delete mode 100644 .idea/jarRepositories.xml
delete mode 100644 .idea/misc.xml
delete mode 100644 .idea/vcs.xml
create mode 100644 src/test/java/com/sczx/store/CodeGenerator.java
diff --git a/.gitignore b/.gitignore
index 0d7f4db..a25437c 100644
--- a/.gitignore
+++ b/.gitignore
@@ -33,3 +33,4 @@ build/
.vscode/
logs/
src/main/resources/rebel.xml
+
diff --git a/.idea/.gitignore b/.idea/.gitignore
deleted file mode 100644
index 359bb53..0000000
--- a/.idea/.gitignore
+++ /dev/null
@@ -1,3 +0,0 @@
-# 默认忽略的文件
-/shelf/
-/workspace.xml
diff --git a/.idea/compiler.xml b/.idea/compiler.xml
deleted file mode 100644
index 8b85778..0000000
--- a/.idea/compiler.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
deleted file mode 100644
index aa00ffa..0000000
--- a/.idea/encodings.xml
+++ /dev/null
@@ -1,7 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
deleted file mode 100644
index ee2c34b..0000000
--- a/.idea/inspectionProfiles/Project_Default.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/jarRepositories.xml b/.idea/jarRepositories.xml
deleted file mode 100644
index 4bd2d0a..0000000
--- a/.idea/jarRepositories.xml
+++ /dev/null
@@ -1,30 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
deleted file mode 100644
index 132404b..0000000
--- a/.idea/misc.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
deleted file mode 100644
index 35eb1dd..0000000
--- a/.idea/vcs.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
diff --git a/Jenkinsfile b/Jenkinsfile
index 5b8dfb0..a30190b 100644
--- a/Jenkinsfile
+++ b/Jenkinsfile
@@ -59,7 +59,6 @@ pipeline {
--name \${CONTAINER_NAME} \
--network sczx-net \
-p 8082:8082 \
- -e SPRING_PROFILES_ACTIVE=test \
-e JAVA_OPTS="-Xms256m -Xmx512m -Duser.timezone=Asia/Shanghai" \
--restart always \
\${DOCKER_IMAGE}
diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml
index d109fa1..862e080 100644
--- a/src/main/resources/application.yml
+++ b/src/main/resources/application.yml
@@ -72,15 +72,15 @@ springdoc:
swagger-ui:
url: /v3/api-docs
path: /doc.html
- packages-to-scan: com.sczx.user.controller # 替换为你的 controller 包路径
+ packages-to-scan: com.sczx.store.controller # 替换为你的 controller 包路径
mybatis-plus:
mapper-locations: classpath*:mapper/**/*.xml
- type-aliases-package: com.sczx.user.entity # 实体类包路径
+ type-aliases-package: com.sczx.store.po # 实体类包路径
configuration:
mapUnderscoreToCamelCase: true
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl # 控制台打印 SQL(调试用)
-auth:
- secret-key: his-is-a-very-long-and-secure-secret-key-for-jwt-signing-please-dont-use-short-keys
- token-expiration: 86400000 # 24小时
+#auth:
+# secret-key: his-is-a-very-long-and-secure-secret-key-for-jwt-signing-please-dont-use-short-keys
+# token-expiration: 86400000 # 24小时
diff --git a/src/test/java/com/sczx/store/CodeGenerator.java b/src/test/java/com/sczx/store/CodeGenerator.java
new file mode 100644
index 0000000..42b726a
--- /dev/null
+++ b/src/test/java/com/sczx/store/CodeGenerator.java
@@ -0,0 +1,41 @@
+package com.sczx.store;
+
+import com.baomidou.mybatisplus.generator.FastAutoGenerator;
+import com.baomidou.mybatisplus.generator.config.DataSourceConfig;
+import com.baomidou.mybatisplus.generator.config.OutputFile;
+import com.baomidou.mybatisplus.generator.config.rules.DateType;
+import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
+
+import java.util.Collections;
+
+public class CodeGenerator {
+
+ private static final String parentPackage = "com.sczx.store";
+ private static final String jdbcUrl = "jdbc:mysql://115.190.8.52:3306/sczx?useUnicode=true&characterEncoding=UTF-8&useJDBCCompliantTimezoneShift=true&useLegacyDatetimeCode=false&useSSL=false&serverTimezone=Asia/Shanghai";
+ private static final String username = "sczx_user";
+ private static final String password = "Sczx123";
+ private static final String author = "zhangli";
+ public static void main(String[] args) {
+ DataSourceConfig.Builder DATA_SOURCE_CONFIG = new DataSourceConfig.Builder(jdbcUrl, username, password);
+
+ FastAutoGenerator.create(DATA_SOURCE_CONFIG)
+ // 全局配置
+ .globalConfig(builder -> builder.outputDir(System.getProperty("user.dir") + "/src/main/java")
+ .author(author).disableOpenDir().enableSwagger()
+ .dateType(DateType.TIME_PACK).commentDate("yyyy-MM-dd HH:mm:ss")
+ .fileOverride())
+ // 包配置
+ .packageConfig(builder -> builder.parent(parentPackage).entity("po.base").service("repository.base").serviceImpl("repository.base.impl").xml("")
+ .mapper("mapper.base").pathInfo(Collections.singletonMap(OutputFile.mapperXml, System.getProperty("user.dir") + "/src/main/resources/mapper/base")))
+
+ // 策略配置
+ .strategyConfig((scanner, builder) -> builder.addInclude(scanner.apply("请输入表名:"))
+ .addTablePrefix("t_"/*,"cd_"*/)//可支持多个,按逗号分隔
+ .entityBuilder().formatFileName("%sPO").enableLombok()
+ .mapperBuilder().formatMapperFileName("%sMapper").formatXmlFileName("%sMapper")
+ .controllerBuilder().formatFileName("%sController").enableRestStyle()
+ .serviceBuilder().formatServiceFileName("%sRepo").formatServiceImplFileName("%sRepoImpl"))
+ .templateEngine(new FreemarkerTemplateEngine())
+ .execute();
+ }
+}