First Commit

This commit is contained in:
ShouChen 2022-01-12 14:58:19 +08:00
commit cf7170c4c3
11 changed files with 447 additions and 0 deletions

35
.gitignore vendored Normal file
View File

@ -0,0 +1,35 @@
HELP.md
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**
!**/src/test/**
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
### VS Code ###
.vscode/
### Custom ###
logs
InventoryProMax.db

34
README.md Normal file
View File

@ -0,0 +1,34 @@
# InventoryProMax
![](https://img.shields.io/badge/Springboot-2.3.7-green)
![](https://img.shields.io/badge/Java-11-red)
![](https://img.shields.io/badge/MAVEN-3-blue)
## 描述
本项目是一款仓储管理系统,核心模块是仓储管理,附加销售管理及人员管理等模块。
## 技术栈
项目后端使用SpringBoot-2.3.7开发前端使用Vue-3框架开发。
<table style="text-align: center">
<tr>
<th></th>
<th style="text-align: center">名称</th>
<th style="text-align: center">版本</th>
<th style="text-align: center">描述</th>
</tr>
<tr>
<td rowspan="2">后端</td>
<td>SpringBoot</td>
<td>2.3.7-Release</td>
<td>一个轻量级的IoC控制反转容器框架</td>
</tr>
<tr>
<td>Mybatis</td>
<td>3.5.6</td>
<td>持久层框架</td>
</tr>
</table>

124
pom.xml Normal file
View File

@ -0,0 +1,124 @@
<?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 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>icu.mmmc</groupId>
<artifactId>InventoryProMax</artifactId>
<version>0.0.1-SNAPSHOT</version>
<name>InventoryProMax</name>
<description>仓储管理ProMax</description>
<properties>
<java.version>1.8</java.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<spring-boot.version>2.3.7.RELEASE</spring-boot.version>
</properties>
<dependencies>
<!-- <dependency>-->
<!-- <groupId>org.springframework.boot</groupId>-->
<!-- <artifactId>spring-boot-starter-security</artifactId>-->
<!-- </dependency>-->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
</dependency>
<dependency>
<groupId>org.mybatis.spring.boot</groupId>
<artifactId>mybatis-spring-boot-starter</artifactId>
<version>2.2.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.junit.vintage</groupId>
<artifactId>junit-vintage-engine</artifactId>
</exclusion>
</exclusions>
</dependency>
<!-- <dependency>-->
<!-- <groupId>org.springframework.security</groupId>-->
<!-- <artifactId>spring-security-test</artifactId>-->
<!-- <scope>test</scope>-->
<!-- </dependency>-->
<dependency>
<groupId>org.xerial</groupId>
<artifactId>sqlite-jdbc</artifactId>
<version>3.34.0</version>
</dependency>
<dependency>
<groupId>io.github.yedaxia</groupId>
<artifactId>japidocs</artifactId>
<version>1.4.4</version>
</dependency>
<dependency>
<groupId>com.github.pagehelper</groupId>
<artifactId>pagehelper-spring-boot-starter</artifactId>
<version>1.4.1</version>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
<optional>true</optional>
</dependency>
</dependencies>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-dependencies</artifactId>
<version>${spring-boot.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
<encoding>UTF-8</encoding>
</configuration>
</plugin>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>2.3.7.RELEASE</version>
<configuration>
<mainClass>icu.mmmc.InventoryProMax.InventoryProMaxApplication</mainClass>
<excludes>
<exclude>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-configuration-processor</artifactId>
</exclude>
</excludes>
</configuration>
<executions>
<execution>
<id>repackage</id>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,22 @@
package icu.mmmc.InventoryProMax;
import io.github.yedaxia.apidocs.Docs;
import io.github.yedaxia.apidocs.DocsConfig;
import io.github.yedaxia.apidocs.plugin.markdown.MarkdownDocPlugin;
/**
* @author shouchen
*/
public class GenApiDocs {
public static void main(String[] args) {
DocsConfig config = new DocsConfig();
config.setProjectPath("./");
config.setProjectName("InventoryProMax");
config.setApiVersion("V1.0");
config.setDocsPath("./api-docs");
config.setAutoGenerate(Boolean.TRUE);
config.addPlugin(new MarkdownDocPlugin());
Docs.buildHtmlDocs(config);
System.out.println("completed!");
}
}

View File

@ -0,0 +1,23 @@
package icu.mmmc.InventoryProMax;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
/**
* 项目启动类
*
* @author shouchen
*/
@SpringBootApplication
@ServletComponentScan
public class InventoryProMaxApplication {
private static final Logger LOGGER = LoggerFactory.getLogger(InventoryProMaxApplication.class);
public static void main(String[] args) {
SpringApplication.run(InventoryProMaxApplication.class, args);
LOGGER.info("done");
}
}

View File

@ -0,0 +1,80 @@
package icu.mmmc.InventoryProMax.configuration;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.stereotype.Component;
import org.sqlite.SQLiteConfig;
import org.sqlite.SQLiteDataSource;
import javax.sql.DataSource;
/**
* 数据库配置
*
* @author shouchen
*/
@Configuration
public class DatabaseConfiguration {
private static final Logger LOGGER = LoggerFactory.getLogger(DatabaseConfiguration.class);
private static final String DB_TYPE_SQLITE = "sqlite";
private DbProperties dbProperties;
@Autowired
public void setDbProperties(DbProperties dbProperties) {
this.dbProperties = dbProperties;
}
@Bean
public DataSource initDataSource() throws Exception {
if (DB_TYPE_SQLITE.equalsIgnoreCase(dbProperties.getType())) {
return initSqliteDataSource();
} else {
throw new Exception("无数据库!");
}
}
/**
* SQLite数据库配置
*
* @return SQLite数据库连接池
*/
private DataSource initSqliteDataSource() {
SQLiteConfig config = new SQLiteConfig();
config.setSynchronous(SQLiteConfig.SynchronousMode.NORMAL);
config.setJournalMode(SQLiteConfig.JournalMode.TRUNCATE);
config.setEncoding(SQLiteConfig.Encoding.UTF8);
config.setTransactionMode(SQLiteConfig.TransactionMode.IMMEDIATE);
config.enforceForeignKeys(true);
SQLiteDataSource sqLiteDataSource = new SQLiteDataSource(config);
sqLiteDataSource.setUrl(dbProperties.getUrl());
LOGGER.info("SQLite数据库配置完毕");
return sqLiteDataSource;
}
@Component
@ConfigurationProperties(prefix = "database")
public static class DbProperties {
private String type;
private String url;
public void setType(String type) {
this.type = type;
}
public String getType() {
return type;
}
public void setUrl(String url) {
this.url = url;
}
public String getUrl() {
return url;
}
}
}

View File

@ -0,0 +1,18 @@
package icu.mmmc.InventoryProMax.controller;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
@Controller
public class Demo {
@GetMapping(value = "/demo")
@ResponseBody
public String demo(HttpServletRequest request, HttpServletResponse response) throws IOException {
return "hello";
}
}

View File

@ -0,0 +1,20 @@
package icu.mmmc.InventoryProMax.filter;
import javax.servlet.*;
import javax.servlet.annotation.WebFilter;
import java.io.IOException;
import java.nio.charset.StandardCharsets;
/**
* @author shouchen
*/
@WebFilter(urlPatterns = "/*")
public class EncodingFilter implements Filter {
@Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain)
throws IOException, ServletException {
request.setCharacterEncoding(StandardCharsets.UTF_8.name());
response.setCharacterEncoding(StandardCharsets.UTF_8.name());
chain.doFilter(request, response);
}
}

View File

@ -0,0 +1,36 @@
# 应用名称
spring.application.name=InventoryProMax
# 应用服务 WEB 访问端口
server.port=8080
#证书名字
#server.ssl.key-store=
#密钥库密码
#server.ssl.key-store-password=
#server.ssl.keyStoreType=
#数据库连接池
database.type=sqlite
database.url=jdbc:sqlite:InventoryProMax.db
#spring.datasource.driver-class-name=org.sqlite.JDBC
#spring.datasource.url=
#spring.datasource.username=root
#spring.datasource.password=root
#spring.datasource.type=com.zaxxer.hikari.HikariDataSource
#spring.datasource.type=org.sqlite.SQLiteDataSource
#spring.datasource.hikari.minimum-idle=10
#spring.datasource.hikari.maximum-pool-size=50
#spring.datasource.hikari.auto-commit=true
#spring.datasource.hikari.idle-timeout=30000
#spring.datasource.hikari.pool-name=HikariCP
#spring.datasource.hikari.max-lifetime=1800000
#spring.datasource.hikari.connection-timeout=30000
#spring.datasource.hikari.connection-test-query=SELECT 1
#上传文件大小限制
spring.servlet.multipart.max-file-size=10MB
spring.servlet.multipart.max-request-size=100MB
#下面这些内容是为了让MyBatis映射
#指定Mybatis的Mapper文件
mybatis.mapper-locations=classpath:mappers/*xml
#指定Mybatis的实体目录
mybatis.type-aliases-package=icu.mmmc.InventoryProMax.entity

42
src/main/resources/logback.xml Executable file
View File

@ -0,0 +1,42 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="false" scanPeriod="60 seconds"
debug="false">
<property name="LOG_HOME" value="logs" />
<property name="LOG_pattern1" value="%d{yyyy-MM-dd HH:mm:ss} [%magenta(%t):%c %L] %highlight(%-5p) -> %m%n" />
<property name="LOG_pattern2" value="%d{yyyy-MM-dd HH:mm:ss} [%t:%c %L] %-5p -> %m%n" />
<appender name="Console"
class="ch.qos.logback.core.ConsoleAppender">
<!-- 输出的格式 -->
<encoder
class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<pattern>${LOG_pattern1}</pattern>
</encoder>
</appender>
<appender name="File"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<append>true</append>
<encoder>
<!--指定日志内容格式 -->
<pattern>${LOG_pattern2}</pattern>
<charset>utf8</charset>
</encoder>
<rollingPolicy
class="ch.qos.logback.core.rolling.SizeAndTimeBasedRollingPolicy">
<fileNamePattern>${LOG_HOME}/%d{yyyy-MM-dd}.%i.log</fileNamePattern>
<!--日志最大保存90天 -->
<maxHistory>90</maxHistory>
<!--日志最大的文件大小 -->
<maxFileSize>16MB</maxFileSize>
<!--日志最大保存100MB -->
<totalSizeCap>256MB</totalSizeCap>
</rollingPolicy>
</appender>
<root level="INFO">
<!--ref表示具体的appender name -->
<appender-ref ref="Console" />
<appender-ref ref="File" />
</root>
</configuration>

View File

@ -0,0 +1,13 @@
package icu.mmmc.InventoryProMax;
import org.junit.jupiter.api.Test;
import org.springframework.boot.test.context.SpringBootTest;
@SpringBootTest
class InventoryProMaxApplicationTests {
@Test
void contextLoads() {
}
}