3.1 初始化后端项目
This commit is contained in:
parent
963e332c9a
commit
e911d4c912
72
.gitignore
vendored
Normal file
72
.gitignore
vendored
Normal file
@ -0,0 +1,72 @@
|
||||
# ========== IDEA ==========
|
||||
# IntelliJ IDEA 项目文件
|
||||
.idea/
|
||||
# IDEA 模块文件
|
||||
*.iml
|
||||
*.iws
|
||||
# IDEA 生成的工作区文件
|
||||
workspace.xml
|
||||
# 代码样式、运行配置等
|
||||
.idea/**/workspace.xml
|
||||
.idea/**/tasks.xml
|
||||
.idea/dictionaries
|
||||
.idea/vcs.xml
|
||||
# 防止提交本地历史
|
||||
.idea/**/localHistory/
|
||||
|
||||
# ========== 编译输出 ==========
|
||||
# Maven 默认输出目录
|
||||
target/
|
||||
# Gradle 默认输出目录
|
||||
build/
|
||||
|
||||
# ========== 操作系统 ==========
|
||||
# Windows 缓存文件
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
# macOS 缓存文件
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
# Linux 缓存文件
|
||||
*~
|
||||
|
||||
# ========== 日志和临时文件 ==========
|
||||
*.log
|
||||
*.tmp
|
||||
*.temp
|
||||
*.swp
|
||||
|
||||
# ========== Test 输出 ==========
|
||||
test-output/
|
||||
surefire-reports/
|
||||
failsafe-reports/
|
||||
|
||||
# ========== 依赖管理 ==========
|
||||
# Maven 本地仓库
|
||||
.mvn/repository/
|
||||
# Gradle 缓存(可选)
|
||||
.gradle/
|
||||
|
||||
# ========== 打包文件 ==========
|
||||
# Spring Boot 可执行包
|
||||
*.jar
|
||||
*.war
|
||||
# Spring Boot 可执行包目录
|
||||
BOOT-INF/
|
||||
|
||||
# ========== IDE 外插件 ==========
|
||||
# Lombok 插件生成文件
|
||||
*.class
|
||||
# JRebel 缓存
|
||||
rebel.xml
|
||||
|
||||
# ========== 其它 ==========
|
||||
# 环境变量文件(如包含敏感配置)
|
||||
*.env
|
||||
# Docker 相关
|
||||
docker-compose.override.yml
|
||||
|
||||
# 如果你用到 IDEA 自带的 File-Based Storage(8+版本默认),可以添加:
|
||||
# .idea/.name
|
||||
# .idea/gradle.xml
|
104
pom.xml
Normal file
104
pom.xml
Normal file
@ -0,0 +1,104 @@
|
||||
<?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>edu.whut</groupId>
|
||||
<artifactId>smile-picture-backend</artifactId>
|
||||
<version>0.0.1-SNAPSHOT</version>
|
||||
<name>smile-picture-backend</name>
|
||||
<description>smile-picture-backend</description>
|
||||
<properties>
|
||||
<java.version>17</java.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||
<spring-boot.version>2.7.6</spring-boot.version>
|
||||
</properties>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-web</artifactId>
|
||||
</dependency>
|
||||
<!-- 切面编程 -->
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-aop</artifactId>
|
||||
</dependency>
|
||||
<!-- 数据库操作:https://mp.baomidou.com/ -->
|
||||
<dependency>
|
||||
<groupId>com.baomidou</groupId>
|
||||
<artifactId>mybatis-plus-boot-starter</artifactId>
|
||||
<version>3.5.9</version>
|
||||
</dependency>
|
||||
<!-- 工具库:https://doc.hutool.cn/pages/index/ -->
|
||||
<dependency>
|
||||
<groupId>cn.hutool</groupId>
|
||||
<artifactId>hutool-all</artifactId>
|
||||
<version>5.8.26</version>
|
||||
</dependency>
|
||||
<!-- 接口文档:https://doc.xiaominfo.com/docs/quick-start#spring-boot-2-->
|
||||
<dependency>
|
||||
<groupId>com.github.xiaoymin</groupId>
|
||||
<artifactId>knife4j-openapi2-spring-boot-starter</artifactId>
|
||||
<version>4.4.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.mysql</groupId>
|
||||
<artifactId>mysql-connector-j</artifactId>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.projectlombok</groupId>
|
||||
<artifactId>lombok</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-starter-test</artifactId>
|
||||
<scope>test</scope>
|
||||
</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>17</source>
|
||||
<target>17</target>
|
||||
<encoding>UTF-8</encoding>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<plugin>
|
||||
<groupId>org.springframework.boot</groupId>
|
||||
<artifactId>spring-boot-maven-plugin</artifactId>
|
||||
<version>${spring-boot.version}</version>
|
||||
<configuration>
|
||||
<mainClass>edu.whut.smilepicturebackend.SmilePictureBackendApplication</mainClass>
|
||||
<skip>true</skip>
|
||||
</configuration>
|
||||
<executions>
|
||||
<execution>
|
||||
<id>repackage</id>
|
||||
<goals>
|
||||
<goal>repackage</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
@ -0,0 +1,13 @@
|
||||
package edu.whut.smilepicturebackend;
|
||||
|
||||
import org.springframework.boot.SpringApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
|
||||
@SpringBootApplication
|
||||
public class SmilePictureBackendApplication {
|
||||
|
||||
public static void main(String[] args) {
|
||||
SpringApplication.run(SmilePictureBackendApplication.class, args);
|
||||
}
|
||||
|
||||
}
|
39
src/main/resources/application.yml
Normal file
39
src/main/resources/application.yml
Normal file
@ -0,0 +1,39 @@
|
||||
server:
|
||||
port: 8100
|
||||
servlet:
|
||||
context-path: /api
|
||||
|
||||
spring:
|
||||
application:
|
||||
name: smile-picture-backend
|
||||
# 数据库配置
|
||||
datasource:
|
||||
driver-class-name: com.mysql.cj.jdbc.Driver
|
||||
url: jdbc:mysql://localhost:3306/smile-picture
|
||||
username: root
|
||||
password: 123456
|
||||
|
||||
mybatis-plus:
|
||||
configuration:
|
||||
# MyBatis 配置
|
||||
map-underscore-to-camel-case: true #是否开启驼峰转换
|
||||
# 仅在开发环境打印日志
|
||||
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
|
||||
global-config:
|
||||
enable-sql-runner: true
|
||||
db-config:
|
||||
logic-delete-field: isDelete # 全局逻辑删除的实体字段名 删除操作时表中数据不会被物理删除,只会设置isDelete为1
|
||||
logic-delete-value: 1 # 逻辑已删除值(默认为 1)
|
||||
logic-not-delete-value: 0 # 逻辑未删除值(默认为 0)
|
||||
|
||||
# 接口文档配置
|
||||
knife4j:
|
||||
enable: true
|
||||
openapi:
|
||||
title: 接口文档
|
||||
version: 1.0
|
||||
group:
|
||||
default:
|
||||
api-rule: package
|
||||
api-rule-resources:
|
||||
- edu.whut.smilepicturebackend.controller #接口地址
|
Loading…
x
Reference in New Issue
Block a user