Commit 15e856c7ddb4a2af41d6c5314edadcc08e002374

Authored by zichun
1 parent ace58411

chore(mod): bootstrap spring boot skeleton REQ-MOD-001

backend/pom.xml 0 → 100644
  1 +<?xml version="1.0" encoding="UTF-8"?>
  2 +<project xmlns="http://maven.apache.org/POM/4.0.0"
  3 + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  4 + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  5 + <modelVersion>4.0.0</modelVersion>
  6 +
  7 + <parent>
  8 + <groupId>org.springframework.boot</groupId>
  9 + <artifactId>spring-boot-starter-parent</artifactId>
  10 + <version>3.2.5</version>
  11 + <relativePath/>
  12 + </parent>
  13 +
  14 + <groupId>com.xly.erp</groupId>
  15 + <artifactId>erp-backend</artifactId>
  16 + <version>0.1.0-SNAPSHOT</version>
  17 + <packaging>jar</packaging>
  18 + <name>erp-backend</name>
  19 + <description>小羚羊 ERP 后端</description>
  20 +
  21 + <properties>
  22 + <java.version>17</java.version>
  23 + <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
  24 + <mybatis-plus.version>3.5.7</mybatis-plus.version>
  25 + <mapstruct.version>1.5.5.Final</mapstruct.version>
  26 + <hutool.version>5.8.27</hutool.version>
  27 + <flyway.version>10.10.0</flyway.version>
  28 + <lombok.version>1.18.32</lombok.version>
  29 + </properties>
  30 +
  31 + <dependencies>
  32 + <dependency>
  33 + <groupId>org.springframework.boot</groupId>
  34 + <artifactId>spring-boot-starter-web</artifactId>
  35 + </dependency>
  36 + <dependency>
  37 + <groupId>org.springframework.boot</groupId>
  38 + <artifactId>spring-boot-starter-validation</artifactId>
  39 + </dependency>
  40 + <dependency>
  41 + <groupId>org.springframework.boot</groupId>
  42 + <artifactId>spring-boot-starter-security</artifactId>
  43 + </dependency>
  44 +
  45 + <dependency>
  46 + <groupId>com.baomidou</groupId>
  47 + <artifactId>mybatis-plus-spring-boot3-starter</artifactId>
  48 + <version>${mybatis-plus.version}</version>
  49 + </dependency>
  50 +
  51 + <dependency>
  52 + <groupId>org.flywaydb</groupId>
  53 + <artifactId>flyway-core</artifactId>
  54 + <version>${flyway.version}</version>
  55 + </dependency>
  56 + <dependency>
  57 + <groupId>org.flywaydb</groupId>
  58 + <artifactId>flyway-mysql</artifactId>
  59 + <version>${flyway.version}</version>
  60 + </dependency>
  61 +
  62 + <dependency>
  63 + <groupId>com.mysql</groupId>
  64 + <artifactId>mysql-connector-j</artifactId>
  65 + <scope>runtime</scope>
  66 + </dependency>
  67 +
  68 + <dependency>
  69 + <groupId>org.projectlombok</groupId>
  70 + <artifactId>lombok</artifactId>
  71 + <optional>true</optional>
  72 + </dependency>
  73 + <dependency>
  74 + <groupId>org.mapstruct</groupId>
  75 + <artifactId>mapstruct</artifactId>
  76 + <version>${mapstruct.version}</version>
  77 + </dependency>
  78 +
  79 + <dependency>
  80 + <groupId>cn.hutool</groupId>
  81 + <artifactId>hutool-all</artifactId>
  82 + <version>${hutool.version}</version>
  83 + </dependency>
  84 +
  85 + <dependency>
  86 + <groupId>org.springframework.boot</groupId>
  87 + <artifactId>spring-boot-starter-test</artifactId>
  88 + <scope>test</scope>
  89 + </dependency>
  90 + <dependency>
  91 + <groupId>org.springframework.security</groupId>
  92 + <artifactId>spring-security-test</artifactId>
  93 + <scope>test</scope>
  94 + </dependency>
  95 + </dependencies>
  96 +
  97 + <build>
  98 + <plugins>
  99 + <plugin>
  100 + <groupId>org.springframework.boot</groupId>
  101 + <artifactId>spring-boot-maven-plugin</artifactId>
  102 + <configuration>
  103 + <excludes>
  104 + <exclude>
  105 + <groupId>org.projectlombok</groupId>
  106 + <artifactId>lombok</artifactId>
  107 + </exclude>
  108 + </excludes>
  109 + </configuration>
  110 + </plugin>
  111 + <plugin>
  112 + <groupId>org.apache.maven.plugins</groupId>
  113 + <artifactId>maven-compiler-plugin</artifactId>
  114 + <configuration>
  115 + <source>${java.version}</source>
  116 + <target>${java.version}</target>
  117 + <annotationProcessorPaths>
  118 + <path>
  119 + <groupId>org.projectlombok</groupId>
  120 + <artifactId>lombok</artifactId>
  121 + <version>${lombok.version}</version>
  122 + </path>
  123 + <path>
  124 + <groupId>org.mapstruct</groupId>
  125 + <artifactId>mapstruct-processor</artifactId>
  126 + <version>${mapstruct.version}</version>
  127 + </path>
  128 + <path>
  129 + <groupId>org.projectlombok</groupId>
  130 + <artifactId>lombok-mapstruct-binding</artifactId>
  131 + <version>0.2.0</version>
  132 + </path>
  133 + </annotationProcessorPaths>
  134 + </configuration>
  135 + </plugin>
  136 + </plugins>
  137 + </build>
  138 +</project>
... ...
backend/src/main/java/com/xly/erp/ErpApplication.java 0 → 100644
  1 +package com.xly.erp;
  2 +
  3 +import org.mybatis.spring.annotation.MapperScan;
  4 +import org.springframework.boot.SpringApplication;
  5 +import org.springframework.boot.autoconfigure.SpringBootApplication;
  6 +
  7 +@SpringBootApplication
  8 +@MapperScan("com.xly.erp.module.**.mapper")
  9 +public class ErpApplication {
  10 + public static void main(String[] args) {
  11 + SpringApplication.run(ErpApplication.class, args);
  12 + }
  13 +}
... ...
backend/src/main/resources/application-test.yml 0 → 100644
  1 +spring:
  2 + flyway:
  3 + enabled: true
  4 + locations: filesystem:../sql/migrations
  5 + baseline-on-migrate: true
  6 + baseline-version: 1
  7 + baseline-description: "REQ-MOD-001 baseline (V1 already applied manually in A4)"
... ...
backend/src/main/resources/application.yml 0 → 100644
  1 +server:
  2 + port: 8080
  3 + servlet:
  4 + context-path: /
  5 +
  6 +spring:
  7 + profiles:
  8 + active: ${SPRING_PROFILES_ACTIVE:dev}
  9 + datasource:
  10 + url: jdbc:mysql://${DB_HOST}:${DB_PORT}/${DB_SCHEMA}?useUnicode=true&characterEncoding=utf8&useSSL=false&serverTimezone=Asia/Shanghai&allowPublicKeyRetrieval=true
  11 + username: ${DB_USER}
  12 + password: ${DB_PASSWORD}
  13 + driver-class-name: com.mysql.cj.jdbc.Driver
  14 + flyway:
  15 + enabled: true
  16 + locations: filesystem:../sql/migrations
  17 + baseline-on-migrate: true
  18 + baseline-version: 0
  19 + validate-on-migrate: true
  20 +
  21 +mybatis-plus:
  22 + configuration:
  23 + map-underscore-to-camel-case: false
  24 + global-config:
  25 + db-config:
  26 + id-type: auto
  27 +
  28 +erp:
  29 + jwt:
  30 + secret: ${JWT_SECRET}
  31 + expires-in-seconds: 7200
... ...
backend/src/test/java/com/xly/erp/ErpApplicationTest.java 0 → 100644
  1 +package com.xly.erp;
  2 +
  3 +import org.junit.jupiter.api.Test;
  4 +import org.springframework.boot.test.context.SpringBootTest;
  5 +import org.springframework.test.context.ActiveProfiles;
  6 +
  7 +@SpringBootTest
  8 +@ActiveProfiles("test")
  9 +class ErpApplicationTest {
  10 + @Test
  11 + void contextLoads() {
  12 + // Spring ApplicationContext 启动成功 + Flyway 完成 baseline / migrate 即视为通过
  13 + }
  14 +}
... ...
backend/src/test/resources/application-test.yml 0 → 100644
  1 +spring:
  2 + flyway:
  3 + enabled: true
  4 + locations: filesystem:../sql/migrations
  5 + baseline-on-migrate: true
  6 + baseline-version: 1
  7 + baseline-description: "REQ-MOD-001 baseline (V1 already applied manually in A4)"
... ...