diff --git a/.gitignore b/.gitignore index 549e00a2..2d80094a 100644 --- a/.gitignore +++ b/.gitignore @@ -1,8 +1,8 @@ -HELP.md target/ !.mvn/wrapper/maven-wrapper.jar !**/src/main/**/target/ !**/src/test/**/target/ +/logs/** ### STS ### .apt_generated diff --git a/cash-api/account-server/src/main/java/com/ysk/AccountApplication.java b/cash-api/account-server/src/main/java/com/ysk/AccountApplication.java index 763afaf2..e8014272 100644 --- a/cash-api/account-server/src/main/java/com/ysk/AccountApplication.java +++ b/cash-api/account-server/src/main/java/com/ysk/AccountApplication.java @@ -3,9 +3,11 @@ package com.ysk; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; +/** + * @author ww + */ @SpringBootApplication public class AccountApplication { - public static void main(String[] args) { SpringApplication.run(AccountApplication.class, args); } diff --git a/cash-api/account-server/src/main/resources/application.yml b/cash-api/account-server/src/main/resources/application.yml new file mode 100644 index 00000000..5788da9a --- /dev/null +++ b/cash-api/account-server/src/main/resources/application.yml @@ -0,0 +1,9 @@ +server: + port: 9100 + +spring: + application: + name: account-server + +logging: + config: classpath:logback.xml \ No newline at end of file diff --git a/cash-api/account-server/src/main/resources/logback.xml b/cash-api/account-server/src/main/resources/logback.xml new file mode 100644 index 00000000..a5faaf2f --- /dev/null +++ b/cash-api/account-server/src/main/resources/logback.xml @@ -0,0 +1,37 @@ + + + elAdmin + + + + + + + + ${log.pattern} + ${log.charset} + + + + + logs/account/logback.log + + + logs/account/logback/%d{yyyy-MM-dd}/logback.%i.log.gz + + 30 + 20MB + + + + ${p_file} + UTF-8 + + + + + + + + + \ No newline at end of file diff --git a/cash-api/order-server/src/main/resources/application.yml b/cash-api/order-server/src/main/resources/application.yml new file mode 100644 index 00000000..fba7e948 --- /dev/null +++ b/cash-api/order-server/src/main/resources/application.yml @@ -0,0 +1,9 @@ +server: + port: 9200 + +spring: + application: + name: order-server + +logging: + config: classpath:logback.xml \ No newline at end of file diff --git a/cash-api/order-server/src/main/resources/logback.xml b/cash-api/order-server/src/main/resources/logback.xml new file mode 100644 index 00000000..39acd478 --- /dev/null +++ b/cash-api/order-server/src/main/resources/logback.xml @@ -0,0 +1,37 @@ + + + elAdmin + + + + + + + + ${log.pattern} + ${log.charset} + + + + + logs/order/logback.log + + + logs/order/logback/%d{yyyy-MM-dd}/logback.%i.log.gz + + 30 + 20MB + + + + ${p_file} + UTF-8 + + + + + + + + + \ No newline at end of file diff --git a/cash-api/pom.xml b/cash-api/pom.xml index 5f3e2ea2..b8cefc90 100644 --- a/cash-api/pom.xml +++ b/cash-api/pom.xml @@ -24,4 +24,11 @@ UTF-8 + + + + org.springframework.boot + spring-boot-starter-web + + \ No newline at end of file diff --git a/cash-api/product-server/src/main/resources/application.yml b/cash-api/product-server/src/main/resources/application.yml new file mode 100644 index 00000000..1e4a9c14 --- /dev/null +++ b/cash-api/product-server/src/main/resources/application.yml @@ -0,0 +1,9 @@ +server: + port: 9300 + +spring: + application: + name: product-server + +logging: + config: classpath:logback.xml \ No newline at end of file diff --git a/cash-api/product-server/src/main/resources/logback.xml b/cash-api/product-server/src/main/resources/logback.xml new file mode 100644 index 00000000..3f9b3389 --- /dev/null +++ b/cash-api/product-server/src/main/resources/logback.xml @@ -0,0 +1,37 @@ + + + elAdmin + + + + + + + + ${log.pattern} + ${log.charset} + + + + + logs/product/logback.log + + + logs/product/logback/%d{yyyy-MM-dd}/logback.%i.log.gz + + 30 + 20MB + + + + ${p_file} + UTF-8 + + + + + + + + + \ No newline at end of file diff --git a/cash-api/system-server/src/main/resources/application.yml b/cash-api/system-server/src/main/resources/application.yml new file mode 100644 index 00000000..b6e8d2a0 --- /dev/null +++ b/cash-api/system-server/src/main/resources/application.yml @@ -0,0 +1,9 @@ +server: + port: 9400 + +spring: + application: + name: system-server + +logging: + config: classpath:logback.xml \ No newline at end of file diff --git a/cash-api/system-server/src/main/resources/logback.xml b/cash-api/system-server/src/main/resources/logback.xml new file mode 100644 index 00000000..712d1c64 --- /dev/null +++ b/cash-api/system-server/src/main/resources/logback.xml @@ -0,0 +1,37 @@ + + + elAdmin + + + + + + + + ${log.pattern} + ${log.charset} + + + + + logs/system/logback.log + + + logs/system/logback/%d{yyyy-MM-dd}/logback.%i.log.gz + + 30 + 20MB + + + + ${p_file} + UTF-8 + + + + + + + + + \ No newline at end of file diff --git a/cash-common/pom.xml b/cash-common/pom.xml index 6c57c7d7..a0c59538 100644 --- a/cash-common/pom.xml +++ b/cash-common/pom.xml @@ -17,5 +17,17 @@ 21 UTF-8 + + + cn.hutool + hutool-all + 5.8.26 + + + com.alibaba.fastjson2 + fastjson2 + 2.0.54 + + \ No newline at end of file diff --git a/cash-service/code-generator/pom.xml b/cash-service/code-generator/pom.xml new file mode 100644 index 00000000..34f01a44 --- /dev/null +++ b/cash-service/code-generator/pom.xml @@ -0,0 +1,38 @@ + + + 4.0.0 + + com.ysk + cash-service + 1.0.0 + + + code-generator + + + 21 + 21 + UTF-8 + + + + + com.mybatis-flex + mybatis-flex-codegen + 1.10.1 + + + com.zaxxer + HikariCP + 4.0.3 + + + + com.mysql + mysql-connector-j + 8.2.0 + + + \ No newline at end of file diff --git a/cash-service/code-generator/src/main/java/com/ysk/Main.java b/cash-service/code-generator/src/main/java/com/ysk/Main.java new file mode 100644 index 00000000..60a39ef5 --- /dev/null +++ b/cash-service/code-generator/src/main/java/com/ysk/Main.java @@ -0,0 +1,91 @@ +package com.ysk; + +import com.mybatisflex.codegen.Generator; +import com.mybatisflex.codegen.config.ColumnConfig; +import com.mybatisflex.codegen.config.GlobalConfig; +import com.zaxxer.hikari.HikariDataSource; + +/** + * @author ww + */ +public class Main { + public static void main(String[] args) { + //配置数据源 + HikariDataSource dataSource = new HikariDataSource(); + dataSource.setJdbcUrl("jdbc:mysql://127.0.0.1:3306/your-database?characterEncoding=utf-8"); + dataSource.setUsername("root"); + dataSource.setPassword("******"); + + //创建配置内容,两种风格都可以。 + GlobalConfig globalConfig = createGlobalConfigUseStyle1(); + //GlobalConfig globalConfig = createGlobalConfigUseStyle2(); + + //通过 datasource 和 globalConfig 创建代码生成器 + Generator generator = new Generator(dataSource, globalConfig); + + //生成代码 + generator.generate(); + } + + public static GlobalConfig createGlobalConfigUseStyle1() { + //创建配置内容 + GlobalConfig globalConfig = new GlobalConfig(); + + //设置根包 + globalConfig.setBasePackage("com.test"); + + //设置表前缀和只生成哪些表 + globalConfig.setTablePrefix("tb_"); + globalConfig.setGenerateTable("tb_account", "tb_account_session"); + + //设置生成 entity 并启用 Lombok + globalConfig.setEntityGenerateEnable(true); + globalConfig.setEntityWithLombok(true); + //设置项目的JDK版本,项目的JDK为14及以上时建议设置该项,小于14则可以不设置 + globalConfig.setEntityJdkVersion(17); + + //设置生成 mapper + globalConfig.setMapperGenerateEnable(true); + + //可以单独配置某个列 + ColumnConfig columnConfig = new ColumnConfig(); + columnConfig.setColumnName("tenant_id"); + columnConfig.setLarge(true); + columnConfig.setVersion(true); + globalConfig.setColumnConfig("tb_account", columnConfig); + + return globalConfig; + } + + public static GlobalConfig createGlobalConfigUseStyle2() { + //创建配置内容 + GlobalConfig globalConfig = new GlobalConfig(); + + //设置根包 + globalConfig.getPackageConfig() + .setBasePackage("com.test"); + + //设置表前缀和只生成哪些表,setGenerateTable 未配置时,生成所有表 + globalConfig.getStrategyConfig() + .setTablePrefix("tb_") + .setGenerateTable("tb_account", "tb_account_session"); + + //设置生成 entity 并启用 Lombok + globalConfig.enableEntity() + .setWithLombok(true) + .setJdkVersion(17); + + //设置生成 mapper + globalConfig.enableMapper(); + + //可以单独配置某个列 + ColumnConfig columnConfig = new ColumnConfig(); + columnConfig.setColumnName("tenant_id"); + columnConfig.setLarge(true); + columnConfig.setVersion(true); + globalConfig.getStrategyConfig() + .setColumnConfig("tb_account", columnConfig); + + return globalConfig; + } +} \ No newline at end of file diff --git a/cash-service/pom.xml b/cash-service/pom.xml index 727afd73..b1062303 100644 --- a/cash-service/pom.xml +++ b/cash-service/pom.xml @@ -17,6 +17,7 @@ order-service product-service system-service + code-generator @@ -25,4 +26,29 @@ UTF-8 + + + + com.ysk + cash-common + 1.0.0 + + + com.ysk + cash-sdk + 1.0.0 + + + + com.mybatis-flex + mybatis-flex-spring-boot3-starter + 1.10.6 + + + com.mybatis-flex + mybatis-flex-processor + 1.10.6 + provided + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 2e13828b..9d083e30 100644 --- a/pom.xml +++ b/pom.xml @@ -12,52 +12,27 @@ cash 1.0.0 pom - cash + + 收银机 cash - https://springdoc.cn/spring-boot-3-4-release-notes/ - - - - - - 1 - w - 123@example.com - CZG - https://guanwang - - cash-api cash-common cash-service cash-sdk - - HEAD - scm:git:https://e.coding.net/g-cphe0354/cashier/cashier_server.git - scm:git:ssh://https://e.coding.net/g-cphe0354/cashier/cashier_server.git - https://e.coding.net/g-cphe0354/cashier/cashier_server.git - + 21 2024.0.0 + org.springframework.boot spring-boot-starter-data-redis - - org.springframework.boot - spring-boot-starter-web - - - org.springframework.cloud - spring-cloud-starter - - org.projectlombok lombok @@ -69,17 +44,6 @@ test - - - - org.springframework.cloud - spring-cloud-dependencies - ${spring-cloud.version} - pom - import - - -