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 {
group = 'moe.mycard'
version = '0.0.1-SNAPSHOT'
sourceCompatibility = '17'
sourceCompatibility = '11'
configurations {
compileOnly {
......@@ -15,21 +15,56 @@ configurations {
}
repositories {
mavenLocal()
maven { url 'https://maven.aliyun.com/nexus/content/groups/public/' }
mavenCentral()
}
dependencies {
implementation 'org.springframework.boot:spring-boot-starter-data-redis'
implementation 'org.springframework.boot:spring-boot-starter-security'
implementation 'org.springframework.boot:spring-boot-starter-web'
implementation 'org.mybatis.spring.boot:mybatis-spring-boot-starter:2.2.2'
compileOnly 'org.projectlombok:lombok'
developmentOnly 'org.springframework.boot:spring-boot-devtools'
runtimeOnly 'org.postgresql:postgresql'
annotationProcessor 'org.springframework.boot:spring-boot-configuration-processor'
annotationProcessor 'org.projectlombok:lombok'
testImplementation 'org.springframework.boot:spring-boot-starter-test'
testImplementation 'org.springframework.security:spring-security-test'
// https://mvnrepository.com/artifact/com.google.guava/guava
implementation group: 'com.google.guava', name: 'guava', version: '31.1-jre'
// https://mvnrepository.com/artifact/io.springfox/springfox-boot-starter
implementation group: 'io.springfox', name: 'springfox-boot-starter', version: '3.0.0'
// ----- Spring Boot
implementation group: 'org.springframework.boot', name: 'spring-boot-starter-web', version: '2.5.7'
// https://mvnrepository.com/artifact/org.springframework.boot/spring-boot-starter-freemarker
// 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') {
......
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;
import org.springframework.boot.SpringApplication;
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 static void main(String[] args) {
SpringApplication.run(TabulatorApplication.class, args);
}
}
package moe.mycard.tabulator.controllers;
import moe.mycard.tabulator.dto.PageSettings;
import moe.mycard.tabulator.dto.PaginatedReturnMessage;
import moe.mycard.tabulator.model.dto.PageSettings;
import moe.mycard.tabulator.model.dto.PaginatedReturnMessage;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
......
package moe.mycard.tabulator.dto;
package moe.mycard.tabulator.model.dto;
public class BlankReturnMessage {
public Boolean success;
......
package moe.mycard.tabulator.dto;
package moe.mycard.tabulator.model.dto;
import lombok.Data;
......
package moe.mycard.tabulator.dto;
package moe.mycard.tabulator.model.dto;
public interface PageSettingsWise
{
......
package moe.mycard.tabulator.dto;
import lombok.Data;
package moe.mycard.tabulator.model.dto;
import java.util.List;
......
package moe.mycard.tabulator.dto;
package moe.mycard.tabulator.model.dto;
public class ReturnMessage<T> extends BlankReturnMessage {
public T data;
......
......@@ -7,9 +7,21 @@ server:
force: true
enabled: true
charset: UTF-8
spring:
mvc:
pathmatch:
matching-strategy: ant-path-matcher
application:
name: springfox-swagger
datasource:
driver-class-name: org.postgresql.Driver
url: jdbc:postgresql://${DB_HOST}:${DB_PORT}/${DB_NAME}
username: ${DB_USER}
password: ${DB_PASS}
driver-class-name: com.mysql.jdbc.Driver
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: ${IS_MYSQL_USERNAME:root}
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