parent
a063aeb0e0
commit
4bc853477a
|
|
@ -1,8 +1,8 @@
|
|||
HELP.md
|
||||
target/
|
||||
!.mvn/wrapper/maven-wrapper.jar
|
||||
!**/src/main/**/target/
|
||||
!**/src/test/**/target/
|
||||
/logs/**
|
||||
|
||||
### STS ###
|
||||
.apt_generated
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,9 @@
|
|||
server:
|
||||
port: 9100
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: account-server
|
||||
|
||||
logging:
|
||||
config: classpath:logback.xml
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="30 seconds" debug="false">
|
||||
<contextName>elAdmin</contextName>
|
||||
<property name="log.charset" value="utf-8" />
|
||||
<property name="log.pattern" value="%yellow(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %msg%n" />
|
||||
<!--写入文件格式-->
|
||||
<property name="p_file" value="%d | [%thread] %-5level %c [%L] - %msg %n"/>
|
||||
<!--输出到控制台-->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
<charset>${log.charset}</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
<!--按天生成日志-->
|
||||
<appender name="logFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>logs/account/logback.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!--生成日志文件名称-->
|
||||
<fileNamePattern>logs/account/logback/%d{yyyy-MM-dd}/logback.%i.log.gz</fileNamePattern>
|
||||
<!--日志文件保留天数-->
|
||||
<MaxHistory>30</MaxHistory>
|
||||
<maxFileSize>20MB</maxFileSize>
|
||||
</rollingPolicy>
|
||||
<!-- 日志输出格式 -->
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<pattern>${p_file}</pattern>
|
||||
<charset>UTF-8</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!--普通日志输出到控制台-->
|
||||
<root level="info">
|
||||
<appender-ref ref="console" />
|
||||
<appender-ref ref="logFile"/>
|
||||
</root>
|
||||
</configuration>
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
server:
|
||||
port: 9200
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: order-server
|
||||
|
||||
logging:
|
||||
config: classpath:logback.xml
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="30 seconds" debug="false">
|
||||
<contextName>elAdmin</contextName>
|
||||
<property name="log.charset" value="utf-8" />
|
||||
<property name="log.pattern" value="%yellow(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %msg%n" />
|
||||
<!--写入文件格式-->
|
||||
<property name="p_file" value="%d | [%thread] %-5level %c [%L] - %msg %n"/>
|
||||
<!--输出到控制台-->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
<charset>${log.charset}</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
<!--按天生成日志-->
|
||||
<appender name="logFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>logs/order/logback.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!--生成日志文件名称-->
|
||||
<fileNamePattern>logs/order/logback/%d{yyyy-MM-dd}/logback.%i.log.gz</fileNamePattern>
|
||||
<!--日志文件保留天数-->
|
||||
<MaxHistory>30</MaxHistory>
|
||||
<maxFileSize>20MB</maxFileSize>
|
||||
</rollingPolicy>
|
||||
<!-- 日志输出格式 -->
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<pattern>${p_file}</pattern>
|
||||
<charset>UTF-8</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!--普通日志输出到控制台-->
|
||||
<root level="info">
|
||||
<appender-ref ref="console" />
|
||||
<appender-ref ref="logFile"/>
|
||||
</root>
|
||||
</configuration>
|
||||
|
|
@ -24,4 +24,11 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
server:
|
||||
port: 9300
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: product-server
|
||||
|
||||
logging:
|
||||
config: classpath:logback.xml
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="30 seconds" debug="false">
|
||||
<contextName>elAdmin</contextName>
|
||||
<property name="log.charset" value="utf-8" />
|
||||
<property name="log.pattern" value="%yellow(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %msg%n" />
|
||||
<!--写入文件格式-->
|
||||
<property name="p_file" value="%d | [%thread] %-5level %c [%L] - %msg %n"/>
|
||||
<!--输出到控制台-->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
<charset>${log.charset}</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
<!--按天生成日志-->
|
||||
<appender name="logFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>logs/product/logback.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!--生成日志文件名称-->
|
||||
<fileNamePattern>logs/product/logback/%d{yyyy-MM-dd}/logback.%i.log.gz</fileNamePattern>
|
||||
<!--日志文件保留天数-->
|
||||
<MaxHistory>30</MaxHistory>
|
||||
<maxFileSize>20MB</maxFileSize>
|
||||
</rollingPolicy>
|
||||
<!-- 日志输出格式 -->
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<pattern>${p_file}</pattern>
|
||||
<charset>UTF-8</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!--普通日志输出到控制台-->
|
||||
<root level="info">
|
||||
<appender-ref ref="console" />
|
||||
<appender-ref ref="logFile"/>
|
||||
</root>
|
||||
</configuration>
|
||||
|
|
@ -0,0 +1,9 @@
|
|||
server:
|
||||
port: 9400
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: system-server
|
||||
|
||||
logging:
|
||||
config: classpath:logback.xml
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<configuration scan="true" scanPeriod="30 seconds" debug="false">
|
||||
<contextName>elAdmin</contextName>
|
||||
<property name="log.charset" value="utf-8" />
|
||||
<property name="log.pattern" value="%yellow(%d{yyyy-MM-dd HH:mm:ss.SSS}) %green([%thread]) %highlight(%-5level) %boldMagenta(%logger{36}) - %msg%n" />
|
||||
<!--写入文件格式-->
|
||||
<property name="p_file" value="%d | [%thread] %-5level %c [%L] - %msg %n"/>
|
||||
<!--输出到控制台-->
|
||||
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
|
||||
<encoder>
|
||||
<pattern>${log.pattern}</pattern>
|
||||
<charset>${log.charset}</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
<!--按天生成日志-->
|
||||
<appender name="logFile" class="ch.qos.logback.core.rolling.RollingFileAppender">
|
||||
<file>logs/system/logback.log</file>
|
||||
<rollingPolicy class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
|
||||
<!--生成日志文件名称-->
|
||||
<fileNamePattern>logs/system/logback/%d{yyyy-MM-dd}/logback.%i.log.gz</fileNamePattern>
|
||||
<!--日志文件保留天数-->
|
||||
<MaxHistory>30</MaxHistory>
|
||||
<maxFileSize>20MB</maxFileSize>
|
||||
</rollingPolicy>
|
||||
<!-- 日志输出格式 -->
|
||||
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
|
||||
<pattern>${p_file}</pattern>
|
||||
<charset>UTF-8</charset>
|
||||
</encoder>
|
||||
</appender>
|
||||
|
||||
<!--普通日志输出到控制台-->
|
||||
<root level="info">
|
||||
<appender-ref ref="console" />
|
||||
<appender-ref ref="logFile"/>
|
||||
</root>
|
||||
</configuration>
|
||||
|
|
@ -17,5 +17,17 @@
|
|||
<maven.compiler.target>21</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.8.26</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.alibaba.fastjson2</groupId>
|
||||
<artifactId>fastjson2</artifactId>
|
||||
<version>2.0.54</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
</project>
|
||||
|
|
@ -0,0 +1,38 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||
<modelVersion>4.0.0</modelVersion>
|
||||
<parent>
|
||||
<groupId>com.ysk</groupId>
|
||||
<artifactId>cash-service</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</parent>
|
||||
|
||||
<artifactId>code-generator</artifactId>
|
||||
|
||||
<properties>
|
||||
<maven.compiler.source>21</maven.compiler.source>
|
||||
<maven.compiler.target>21</maven.compiler.target>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>com.mybatis-flex</groupId>
|
||||
<artifactId>mybatis-flex-codegen</artifactId>
|
||||
<version>1.10.1</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.zaxxer</groupId>
|
||||
<artifactId>HikariCP</artifactId>
|
||||
<version>4.0.3</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
<version>8.2.0</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
|
@ -17,6 +17,7 @@
|
|||
<module>order-service</module>
|
||||
<module>product-service</module>
|
||||
<module>system-service</module>
|
||||
<module>code-generator</module>
|
||||
</modules>
|
||||
|
||||
<properties>
|
||||
|
|
@ -25,4 +26,29 @@
|
|||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.ysk</groupId>
|
||||
<artifactId>cash-common</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.ysk</groupId>
|
||||
<artifactId>cash-sdk</artifactId>
|
||||
<version>1.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.mybatis-flex</groupId>
|
||||
<artifactId>mybatis-flex-spring-boot3-starter</artifactId>
|
||||
<version>1.10.6</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mybatis-flex</groupId>
|
||||
<artifactId>mybatis-flex-processor</artifactId>
|
||||
<version>1.10.6</version>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</project>
|
||||
44
pom.xml
44
pom.xml
|
|
@ -12,52 +12,27 @@
|
|||
<artifactId>cash</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<packaging>pom</packaging>
|
||||
<name>cash</name>
|
||||
|
||||
<name>收银机</name>
|
||||
<description>cash</description>
|
||||
|
||||
<url>https://springdoc.cn/spring-boot-3-4-release-notes/</url>
|
||||
<licenses>
|
||||
<license/>
|
||||
</licenses>
|
||||
<developers>
|
||||
<developer>
|
||||
<id>1</id>
|
||||
<name>w</name>
|
||||
<email>123@example.com</email>
|
||||
<organization>CZG</organization>
|
||||
<organizationUrl>https://guanwang</organizationUrl>
|
||||
</developer>
|
||||
</developers>
|
||||
<modules>
|
||||
<module>cash-api</module>
|
||||
<module>cash-common</module>
|
||||
<module>cash-service</module>
|
||||
<module>cash-sdk</module>
|
||||
</modules>
|
||||
<scm>
|
||||
<tag>HEAD</tag>
|
||||
<connection>scm:git:https://e.coding.net/g-cphe0354/cashier/cashier_server.git</connection>
|
||||
<developerConnection>scm:git:ssh://https://e.coding.net/g-cphe0354/cashier/cashier_server.git</developerConnection>
|
||||
<url>https://e.coding.net/g-cphe0354/cashier/cashier_server.git</url>
|
||||
</scm>
|
||||
|
||||
<properties>
|
||||
<java.version>21</java.version>
|
||||
<spring-cloud.version>2024.0.0</spring-cloud.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-data-redis</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-starter</artifactId>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
|
|
@ -69,17 +44,6 @@
|
|||
<scope>test</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<dependencyManagement>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.cloud</groupId>
|
||||
<artifactId>spring-cloud-dependencies</artifactId>
|
||||
<version>${spring-cloud.version}</version>
|
||||
<type>pom</type>
|
||||
<scope>import</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
</dependencyManagement>
|
||||
|
||||
<build>
|
||||
<plugins>
|
||||
|
|
|
|||
Loading…
Reference in New Issue