Commit 8409e753 authored by 月兔回旋于空中's avatar 月兔回旋于空中

结构 >> 继承swagger

parent d51bd81d
Pipeline #11087 failed with stages
in 3 minutes and 16 seconds
...@@ -6,7 +6,7 @@ plugins { ...@@ -6,7 +6,7 @@ plugins {
group = 'moe.mycard' group = 'moe.mycard'
version = '0.0.1-SNAPSHOT' version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17' sourceCompatibility = '11'
configurations { configurations {
compileOnly { compileOnly {
...@@ -15,21 +15,56 @@ configurations { ...@@ -15,21 +15,56 @@ configurations {
} }
repositories { repositories {
mavenLocal()
maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }
mavenCentral() mavenCentral()
} }
dependencies { dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-redis' // https://mvnrepository.com/artifact/com.google.guava/guava
implementation 'org.springframework.boot:spring-boot-starter-security' implementation group: 'com.google.guava', name: 'guava', version: '31.1-jre'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.2' // https://mvnrepository.com/artifact/io.springfox/springfox-boot-starter
compileOnly 'org.projectlombok:lombok' implementation group: 'io.springfox', name: 'springfox-boot-starter', version: '3.0.0'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'org.postgresql:postgresql'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor' // ----- Spring Boot
annotationProcessor 'org.projectlombok:lombok' implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '2.5.7'
testImplementation 'org.springframework.boot:spring-boot-starter-test' // https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-freemarker
testImplementation 'org.springframework.security:spring-security-test' // implementation group: 'org.springframework.boot', name: 'spring-boot-starter-freemarker', version: '2.5.7'
// ----- 日志打印工具 log4j
implementation group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.17.0'
implementation group: 'org.apache.logging.log4j', name: 'log4j-to-slf4j', version: '2.17.0'
// ----- 缓存中间件 Redis
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-data-redis', version: '2.5.8'
// ----- 序列化插件
implementation group: 'com.fasterxml.jackson.datatype', name: 'jackson-datatype-jsr310', version: '2.13.0'
// ----- ORM框架 Mybatis - Plus
implementation 'com.baomidou:mybatis-plus-boot-starter:3.5.1'
implementation 'com.baomidou:mybatis-plus-generator:3.5.2'
// ----- HTTP OkHttp
implementation 'com.squareup.okhttp3:okhttp:4.9.3'
implementation 'com.squareup.okio:okio:3.0.0'
// ----- MySQL Connector
implementation group: 'mysql', name: 'mysql-connector-java', version: '5.1.49'
// ----- 控制台彩色字体库
implementation 'org.fusesource.jansi:jansi:2.4.0'
// ----- Lombok 组件支持
annotationProcessor 'org.projectlombok:lombok:1.18.22'
compileOnly 'org.projectlombok:lombok:1.18.22'
// ----- 单元测试框架 junit
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.8.2'
testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine:5.8.2'
} }
tasks.named('test') { tasks.named('test') {
......
package moe.mycard.tabulator;
import com.baomidou.mybatisplus.generator.FastAutoGenerator;
import com.baomidou.mybatisplus.generator.config.OutputFile;
import com.baomidou.mybatisplus.generator.engine.FreemarkerTemplateEngine;
import java.util.Collections;
/** 代码生成器 */
public class MysqlGenerator {
public static void main(String[] args) {
try {
FastAutoGenerator.create("jdbc:mysql://localhost:3306/ygo_table", "root", "123456")
.globalConfig(
builder -> {
// 设置作者
builder
.author("SPiCa")
.enableSwagger() // 开启 swagger 模式
.outputDir(
"D:\\project\\web\\tabulator\\src\\main\\java\\moe\\mycard\\tabulator\\temp"); // 指定输出目录
})
.packageConfig(
builder -> {
builder
.parent("") // 设置父包名
.moduleName("") // 设置父包模块名
.entity("po")
.service("service")
.serviceImpl("service.impl")
.mapper("mapper")
.xml("mapper.xml")
.pathInfo(
Collections.singletonMap(
OutputFile.xml,
"D:\\project\\web\\tabulator\\src\\main\\resources\\mapper")); // 设置mapperXml生成路径
})
.strategyConfig(
builder -> {
builder
.addInclude("core_config") // 设置需要生成的表名
.addInclude("ta_log") // 设置需要生成的表名
.addInclude("ta_match") // 设置需要生成的表名
.addInclude("ta_participant") // 设置需要生成的表名
.addInclude("ta_seat_record") // 设置需要生成的表名
.addInclude("ta_tournament") // 设置需要生成的表名
.addInclude("ta_tournament_assign") // 设置需要生成的表名
.addInclude("ta_user") // 设置需要生成的表名
.addTablePrefix("ta_", "core_"); // 设置过滤表前缀
})
.templateEngine(new FreemarkerTemplateEngine()) // 使用Freemarker引擎模板,默认的是Velocity引擎模板
.execute();
} catch (Exception e) {
e.printStackTrace();
}
}
}
package moe.mycard.tabulator;
import org.springframework.context.annotation.Configuration;
import springfox.documentation.oas.annotations.EnableOpenApi;
@EnableOpenApi
@Configuration
public class SwaggerConfiguration {
}
\ No newline at end of file
...@@ -2,13 +2,13 @@ package moe.mycard.tabulator; ...@@ -2,13 +2,13 @@ package moe.mycard.tabulator;
import org.springframework.boot.SpringApplication; import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.security.servlet.SecurityAutoConfiguration; import springfox.documentation.oas.annotations.EnableOpenApi;
@SpringBootApplication(exclude = SecurityAutoConfiguration.class) @EnableOpenApi
@SpringBootApplication
public class TabulatorApplication { public class TabulatorApplication {
public static void main(String[] args) { public static void main(String[] args) {
SpringApplication.run(TabulatorApplication.class, args); SpringApplication.run(TabulatorApplication.class, args);
} }
} }
package moe.mycard.tabulator.controllers; package moe.mycard.tabulator.controllers;
import moe.mycard.tabulator.dto.PageSettings; import moe.mycard.tabulator.model.dto.PageSettings;
import moe.mycard.tabulator.dto.PaginatedReturnMessage; import moe.mycard.tabulator.model.dto.PaginatedReturnMessage;
import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController; import org.springframework.web.bind.annotation.RestController;
......
package moe.mycard.tabulator.dto; package moe.mycard.tabulator.model.dto;
public class BlankReturnMessage { public class BlankReturnMessage {
public Boolean success; public Boolean success;
......
package moe.mycard.tabulator.dto; package moe.mycard.tabulator.model.dto;
import lombok.Data; import lombok.Data;
......
package moe.mycard.tabulator.dto; package moe.mycard.tabulator.model.dto;
public interface PageSettingsWise public interface PageSettingsWise
{ {
......
package moe.mycard.tabulator.dto; package moe.mycard.tabulator.model.dto;
import lombok.Data;
import java.util.List; import java.util.List;
......
package moe.mycard.tabulator.dto; package moe.mycard.tabulator.model.dto;
public class ReturnMessage<T> extends BlankReturnMessage { public class ReturnMessage<T> extends BlankReturnMessage {
public T data; public T data;
......
...@@ -7,9 +7,21 @@ server: ...@@ -7,9 +7,21 @@ server:
force: true force: true
enabled: true enabled: true
charset: UTF-8 charset: UTF-8
spring: spring:
mvc:
pathmatch:
matching-strategy: ant-path-matcher
application:
name: springfox-swagger
datasource: datasource:
driver-class-name: org.postgresql.Driver driver-class-name: com.mysql.jdbc.Driver
url: jdbc:postgresql://${DB_HOST}:${DB_PORT}/${DB_NAME} url: jdbc:mysql://${IS_MYSQL_HOST:localhost}:${IS_MYSQL_PORT:3307}/${IS_MYSQL_DATABASE:ygo_table}?useUnicode=true&characterEncoding=utf8&useSSL=false&allowPublicKeyRetrieval=true
username: ${DB_USER} username: ${IS_MYSQL_USERNAME:root}
password: ${DB_PASS} password: ${IS_MYSQL_USERPASS:spica...}
# redis:
# host: ${IS_REDIS_HOST:10.1.1.122}
# port: ${IS_REDIS_PORT:6379}
# database: ${IS_REDIS_DATABASE:1}
# # password: ${IS_REDIS_PASS:null}
# timeout: 5000
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment