From c39250182be9fbf4e3efdda9f81d33a5472fd60d Mon Sep 17 00:00:00 2001 From: DongZeLiang <2746733890@qq.com> Date: Fri, 29 Dec 2023 14:44:55 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 32 +++++++ pom.xml | 86 +++++++++++++++++++ .../java/com/muyu/AliOpenApiApplication.java | 16 ++++ src/main/resources/application.yml | 81 +++++++++++++++++ src/main/resources/data.sql | 0 src/main/resources/schema.sql | 0 src/test/java/com/muyu/Test.java | 12 +++ 7 files changed, 227 insertions(+) create mode 100644 .gitignore create mode 100644 pom.xml create mode 100644 src/main/java/com/muyu/AliOpenApiApplication.java create mode 100644 src/main/resources/application.yml create mode 100644 src/main/resources/data.sql create mode 100644 src/main/resources/schema.sql create mode 100644 src/test/java/com/muyu/Test.java diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..c6ad711 --- /dev/null +++ b/.gitignore @@ -0,0 +1,32 @@ +target/ +!.mvn/wrapper/maven-wrapper.jar +!**/src/main/**/target/ +!**/src/test/**/target/ + +### IntelliJ IDEA ### +/.idea + +### Eclipse ### +.apt_generated +.classpath +.factorypath +.project +.settings +.springBeans +.sts4-cache + +### NetBeans ### +/nbproject/private/ +/nbbuild/ +/dist/ +/nbdist/ +/.nb-gradle/ +build/ +!**/src/main/**/build/ +!**/src/test/**/build/ + +### VS Code ### +.vscode/ + +### Mac OS ### +.DS_Store diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..199c014 --- /dev/null +++ b/pom.xml @@ -0,0 +1,86 @@ + + + 4.0.0 + + com.muyu + AliOpenApi + 1.0-SNAPSHOT + + + org.springframework.boot + spring-boot-starter-parent + 2.7.15 + + + + 17 + 17 + UTF-8 + 3.5.1 + + + + + + org.springframework.boot + spring-boot-starter-web + + + + org.springframework.boot + spring-boot-starter-test + test + + + + org.projectlombok + lombok + + + + + com.baomidou + mybatis-plus-boot-starter + ${mybatisplus.version} + + + com.baomidou + mybatis-plus-generator + ${mybatisplus.version} + + + + + com.h2database + h2 + + + + com.alibaba.fastjson2 + fastjson2 + 2.0.42 + + + + + com.dtflys.forest + forest-spring-boot-starter + 1.5.33 + + + + com.alibaba + fastjson + 1.2.73 + + + + + org.apache.commons + commons-lang3 + + + + diff --git a/src/main/java/com/muyu/AliOpenApiApplication.java b/src/main/java/com/muyu/AliOpenApiApplication.java new file mode 100644 index 0000000..f62778b --- /dev/null +++ b/src/main/java/com/muyu/AliOpenApiApplication.java @@ -0,0 +1,16 @@ +package com.muyu; + +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * @author DongZl + * @description: 启动类 + * @Date 2023-12-29 下午 02:39 + */ +@SpringBootApplication +public class AliOpenApiApplication { + public static void main (String[] args) { + SpringApplication.run(AliOpenApiApplication.class, args); + } +} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml new file mode 100644 index 0000000..cce1bba --- /dev/null +++ b/src/main/resources/application.yml @@ -0,0 +1,81 @@ +server: + port: 81 + + datasource: + username: muyu + password: 123456 + # 如果需要数据本地化,则改成 file 方式 + # jdbc:h2:mem:testDB;DB_CLOSE_DELAY=-1 + url: jdbc:h2:file:~/vehicle/ali/openapi;AUTO_SERVER=TRUE;DB_CLOSE_DELAY=-1 + driver-class-name: org.h2.Driver + h2: + # 开启这个配置就可以通过 web 页面访问了,例如:http://localhost:8080/springboot-h2/h2-console + console: + enabled: true + settings: + # 开启h2 console 跟踪 方便调试 默认 false + trace: true + # 允许console 远程访问 默认false + web-allow-others: true + # h2 访问路径上下文 + path: /h2-console + sql: + init: + schema-locations: classpath:schema.sql + data-locations: classpath:data.sql + mode: always + continue-on-error: true + + +# mybatis-plus 配置 +mybatis-plus: + mapper-locations: classpath*:/com.muyu.mapper/**/*.xml + #实体扫描,多个package用逗号或者分号分隔 + typeAliasesPackage: com.dmo.entity + global-config: + #数据库相关配置 + db-config: + #主键类型 AUTO:"数据库ID自增", INPUT:"用户输入ID", ID_WORKER:"全局唯一ID (数字类型唯一ID)", UUID:"全局唯一ID UUID"; + id-type: AUTO + #字段策略 IGNORED:"忽略判断",NOT_NULL:"非 NULL 判断"),NOT_EMPTY:"非空判断" + field-strategy: NOT_NULL + #驼峰下划线转换 + column-underline: true + logic-delete-value: -1 + logic-not-delete-value: 0 + #原生配置 + configuration: + # 打印sql +# log-impl: org.apache.ibatis.logging.stdout.StdOutImpl + map-underscore-to-camel-case: true + cache-enabled: false + call-setters-on-nulls: true + jdbc-type-for-null: 'null' + +# 日志输出配置 +logging: + level: + com.muyu: DEBUG + com.muyu.service: DEBUG + com.muyu.mapper: DEBUG + com.muyu.vehicle: DEBUG + root: INFO + org: + springframework: + security: WARN + web: ERROR + file: + path: ./logs + name: './logs/AliyunOpenApi.log' + pattern: + file: '%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L - %msg%n' + console: '%d{yyyy-MM-dd HH:mm:ss.SSS} [%thread] %-5level %logger{50}:%L - %msg%n' +# http调用框架 +forest: + max-connections: 1000 # 连接池最大连接数 + connect-timeout: 3000 # 连接超时时间,单位为毫秒 + read-timeout: 3000 # 数据读取超时时间,单位为毫秒 + variables: + adminHost: ${mqtt.admin.host} + adminTopicUri: ${mqtt.admin.topic-uri} + log-enabled: false diff --git a/src/main/resources/data.sql b/src/main/resources/data.sql new file mode 100644 index 0000000..e69de29 diff --git a/src/main/resources/schema.sql b/src/main/resources/schema.sql new file mode 100644 index 0000000..e69de29 diff --git a/src/test/java/com/muyu/Test.java b/src/test/java/com/muyu/Test.java new file mode 100644 index 0000000..87df48a --- /dev/null +++ b/src/test/java/com/muyu/Test.java @@ -0,0 +1,12 @@ +package com.muyu; + +import org.springframework.boot.test.context.SpringBootTest; + +/** + * @author DongZl + * @description: 测试 + * @Date 2023-12-29 下午 02:41 + */ +@SpringBootTest(classes = AliOpenApiApplication.class) +public class Test { +}