From 281f83aced1516664d09e4aec2f0a562532c1284 Mon Sep 17 00:00:00 2001 From: klaokai <573984425@qq.com> Date: Tue, 10 Sep 2024 10:10:38 +0800 Subject: [PATCH 01/11] =?UTF-8?q?feat=EF=BC=88=E5=A2=9E=E5=8A=A0=E6=8E=92?= =?UTF-8?q?=E5=BA=8F=EF=BC=89:=20=E5=8D=87=E7=BA=A7=E4=BE=9D=E8=B5=96?= =?UTF-8?q?=E7=89=88=E6=9C=AC=EF=BC=8C=E5=B9=B6=E5=A2=9E=E5=8A=A0=E6=8E=92?= =?UTF-8?q?=E5=BA=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 19 +++++++++++++------ .../MybatisPlusToolsApplication.java | 12 ++++++++++++ .../generatorui/service/DatabaseService.java | 3 +++ 3 files changed, 28 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index f92ea9f..2586517 100644 --- a/pom.xml +++ b/pom.xml @@ -35,8 +35,8 @@ 1.8 - 2.7.8 - 3.5.3.1 + 2.7.18 + 3.5.7 @@ -64,7 +64,7 @@ cn.hutool hutool-core - 5.8.12 + 5.8.19 com.baomidou @@ -117,6 +117,13 @@ org.springframework.boot spring-boot-starter-test test + + + + org.junit.vintage + junit-vintage-engine + + mysql @@ -130,7 +137,7 @@ maven-compiler-plugin - 3.8.1 + 3.10.0 ${java.version} ${java.version} @@ -158,7 +165,7 @@ org.apache.maven.plugins maven-javadoc-plugin - 3.2.0 + 3.10.0 UTF-8 UTF-8 @@ -177,7 +184,7 @@ org.apache.maven.plugins maven-source-plugin - 3.2.1 + 3.3.1 package diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/MybatisPlusToolsApplication.java b/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/MybatisPlusToolsApplication.java index 92046a3..c7913b1 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/MybatisPlusToolsApplication.java +++ b/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/MybatisPlusToolsApplication.java @@ -40,7 +40,10 @@ public static void run(GeneratorConfig generatorConfig) { if (Strings.isNullOrEmpty(generatorConfig.getJdbcUrl())) { throw new IllegalArgumentException("jdbcUrl必须要设置"); } + //本项目的综合配置 MybatisPlusToolsApplication.generatorConfig = generatorConfig; + + //启动MyBatis Map props = Maps.newHashMap(); new SpringApplicationBuilder() .properties(props) @@ -48,6 +51,11 @@ public static void run(GeneratorConfig generatorConfig) { .run(); } + /** + * 通过注入一个WebServerFactoryCustomizer来达到修改服务器端口的目的 + * @param config + * @return + */ @Bean public WebServerFactoryCustomizer containerConfig(GeneratorConfig config) { return factory -> { @@ -60,6 +68,10 @@ public WebServerFactoryCustomizer container }; } + /** + * 注入项目配置 + * @return 项目配置的对象 + */ @Bean public GeneratorConfig generatorConfig() { return MybatisPlusToolsApplication.generatorConfig; diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/service/DatabaseService.java b/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/service/DatabaseService.java index 73f5056..d30eb49 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/service/DatabaseService.java +++ b/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/service/DatabaseService.java @@ -10,6 +10,7 @@ import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.stereotype.Service; +import java.util.Comparator; import java.util.List; import java.util.Map; import java.util.Objects; @@ -28,6 +29,7 @@ public class DatabaseService { public List getTablesFromDb() { IDbQuery dbQuery = dbQueryHolder.getDbQuery(dataSourceConfig.getDbType()); + //利用jdbcTemplate来查询数据库表信息,然后组装信息 List> results = jdbcTemplate.queryForList(getTableSql()); List tableInfos = Lists.newArrayList(); for (Map table : results) { @@ -36,6 +38,7 @@ public List getTablesFromDb() { tableInfo.setComment((String) table.get(dbQuery.tableComment())); tableInfos.add(tableInfo); } + tableInfos.sort(Comparator.comparing(TableInfo::getName)); return tableInfos; } From a96e4f2b9c7cc7cfc36edc932c637fbb6eb1d41e Mon Sep 17 00:00:00 2001 From: klaokai <573984425@qq.com> Date: Tue, 10 Sep 2024 10:36:52 +0800 Subject: [PATCH 02/11] =?UTF-8?q?chore=EF=BC=88=E5=8D=87=E7=BA=A7=E7=89=88?= =?UTF-8?q?=E6=9C=AC=EF=BC=89:=20=E5=8D=87=E7=BA=A7=E4=BE=9D=E8=B5=96?= =?UTF-8?q?=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/pom.xml b/pom.xml index 2586517..bab32c1 100644 --- a/pom.xml +++ b/pom.xml @@ -89,29 +89,29 @@ org.projectlombok lombok - 1.18.24 + 1.18.34 provided org.dom4j dom4j - 2.1.3 + 2.1.4 com.alibaba druid - 1.2.15 + 1.2.23 com.github.jsqlparser jsqlparser - 4.4 + 4.6 com.github.javaparser javaparser-symbol-solver-core - 3.24.10 + 3.26.1 org.springframework.boot @@ -128,7 +128,7 @@ mysql mysql-connector-java - 8.0.30 + 8.0.33 test From e0e40385370348b2d6081d61a54f09699ad9b1a7 Mon Sep 17 00:00:00 2001 From: klaokai <573984425@qq.com> Date: Tue, 10 Sep 2024 13:46:39 +0800 Subject: [PATCH 03/11] =?UTF-8?q?chore=EF=BC=88=E5=8D=87=E7=BA=A7sql?= =?UTF-8?q?=E8=A7=A3=E6=9E=90=E5=99=A8=E7=89=88=E6=9C=AC=EF=BC=89:=20?= =?UTF-8?q?=E5=8D=87=E7=BA=A7=E4=BE=9D=E8=B5=96=E7=89=88=E6=9C=AC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pom.xml | 2 +- .../service/SqlGeneratorService.java | 3 +- .../sqlparser/DynamicParamSqlEnhancer.java | 15 ++-- .../sqlparser/SelectConditionParser.java | 37 +++++----- .../generatorui/sqlparser/WhereParser.java | 14 +--- src/test/java/TestSqlParser.java | 73 +++++++++++++++++-- 6 files changed, 99 insertions(+), 45 deletions(-) diff --git a/pom.xml b/pom.xml index bab32c1..f6f09aa 100644 --- a/pom.xml +++ b/pom.xml @@ -106,7 +106,7 @@ com.github.jsqlparser jsqlparser - 4.6 + 4.9 com.github.javaparser diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/service/SqlGeneratorService.java b/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/service/SqlGeneratorService.java index 7395df3..0f588bb 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/service/SqlGeneratorService.java +++ b/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/service/SqlGeneratorService.java @@ -33,6 +33,7 @@ import java.io.File; import java.io.IOException; +import java.nio.charset.StandardCharsets; import java.util.*; import static com.github.davidfantasy.mybatisplus.generatorui.dto.Constant.DOT_JAVA; @@ -75,7 +76,7 @@ public void genMapperMethod(GenDtoFromSqlReq params) throws Exception { if (Strings.isNullOrEmpty(params.getSql())) { throw new ServiceException("数据源SQL不能为空"); } - String decodedSql = new String(decoder.decode(params.getSql()), "UTF-8"); + String decodedSql = new String(decoder.decode(params.getSql()), StandardCharsets.UTF_8); if (!decodedSql.trim().toLowerCase().startsWith("select")) { throw new ServiceException("只能通过查询语句生成DTO对象,请检查SQL"); } diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/sqlparser/DynamicParamSqlEnhancer.java b/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/sqlparser/DynamicParamSqlEnhancer.java index 4d91b44..cb8138f 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/sqlparser/DynamicParamSqlEnhancer.java +++ b/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/sqlparser/DynamicParamSqlEnhancer.java @@ -6,9 +6,14 @@ import com.github.davidfantasy.mybatisplus.generatorui.common.ServiceException; import com.google.common.base.Strings; import lombok.extern.slf4j.Slf4j; +import net.sf.jsqlparser.expression.LongValue; +import net.sf.jsqlparser.expression.operators.relational.ComparisonOperator; +import net.sf.jsqlparser.expression.operators.relational.EqualsTo; import net.sf.jsqlparser.parser.CCJSqlParser; +import net.sf.jsqlparser.parser.CCJSqlParserUtil; +import net.sf.jsqlparser.schema.Column; import net.sf.jsqlparser.statement.Statement; -import net.sf.jsqlparser.statement.select.Select; +import net.sf.jsqlparser.statement.select.*; import java.util.List; import java.util.regex.Pattern; @@ -16,7 +21,7 @@ @Slf4j public class DynamicParamSqlEnhancer { - private DbType dbType; + private final DbType dbType; public DynamicParamSqlEnhancer(DbType dbType) { this.dbType = dbType; @@ -35,10 +40,10 @@ public List parseSqlDynamicConditions(String sql) { try { CCJSqlParser ccjSqlParser = new CCJSqlParser(sql); Statement statement = ccjSqlParser.Statement(); - if (statement instanceof Select) { + if (statement instanceof PlainSelect) { SelectConditionParser parser = new SelectConditionParser(); - Select select = (Select) statement; - select.getSelectBody().accept(parser); + PlainSelect select = (PlainSelect) statement; + select.accept(parser); return parser.getParsedConditions(); } else { throw new ServiceException("只能处理SQL查询语句"); diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/sqlparser/SelectConditionParser.java b/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/sqlparser/SelectConditionParser.java index 8ac8f48..fb0caa7 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/sqlparser/SelectConditionParser.java +++ b/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/sqlparser/SelectConditionParser.java @@ -1,18 +1,19 @@ package com.github.davidfantasy.mybatisplus.generatorui.sqlparser; +import lombok.extern.slf4j.Slf4j; import net.sf.jsqlparser.expression.Expression; import net.sf.jsqlparser.schema.Table; import net.sf.jsqlparser.statement.select.*; -import net.sf.jsqlparser.statement.values.ValuesStatement; import java.util.List; /** * 解析子查询以及自身的where条件部分 */ +@Slf4j public class SelectConditionParser implements SelectVisitor, FromItemVisitor { - private WhereParser whereConditionParser = new WhereParser(); + private final WhereParser whereConditionParser = new WhereParser(); public List getParsedConditions() { return whereConditionParser.getConditions(); @@ -23,21 +24,7 @@ public void visit(Table tableName) { } @Override - public void visit(SubSelect subSelect) { - subSelect.getSelectBody().accept(this); - } - - @Override - public void visit(SubJoin subjoin) { - subjoin.getLeft().accept(this); - } - - @Override - public void visit(LateralSubSelect lateralSubSelect) { - } - - @Override - public void visit(ValuesList valuesList) { + public void visit(ParenthesedSelect parenthesedSelect) { } @Override @@ -45,7 +32,8 @@ public void visit(TableFunction tableFunction) { } @Override - public void visit(ParenthesisFromItem aThis) { + public void visit(ParenthesedFromItem parenthesedFromItem) { + parenthesedFromItem.accept(this); } @Override @@ -59,7 +47,7 @@ public void visit(PlainSelect plainSelect) { @Override public void visit(SetOperationList setOpList) { - for (SelectBody sb : setOpList.getSelects()) { + for (Select sb : setOpList.getSelects()) { sb.accept(this); } } @@ -69,6 +57,15 @@ public void visit(WithItem withItem) { } @Override - public void visit(ValuesStatement aThis) { + public void visit(Values values) { + } + + @Override + public void visit(LateralSubSelect lateralSubSelect) { + lateralSubSelect.accept((SelectVisitor) this); + } + + @Override + public void visit(TableStatement tableStatement) { } } diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/sqlparser/WhereParser.java b/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/sqlparser/WhereParser.java index cb5fce4..749d71f 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/sqlparser/WhereParser.java +++ b/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/sqlparser/WhereParser.java @@ -1,15 +1,12 @@ package com.github.davidfantasy.mybatisplus.generatorui.sqlparser; import com.google.common.collect.Lists; -import lombok.extern.slf4j.Slf4j; import net.sf.jsqlparser.expression.BinaryExpression; import net.sf.jsqlparser.expression.Expression; import net.sf.jsqlparser.expression.ExpressionVisitorAdapter; import net.sf.jsqlparser.expression.operators.conditional.AndExpression; import net.sf.jsqlparser.expression.operators.conditional.OrExpression; import net.sf.jsqlparser.expression.operators.relational.*; -import net.sf.jsqlparser.statement.select.PlainSelect; -import net.sf.jsqlparser.statement.select.SubSelect; import java.util.List; @@ -24,7 +21,7 @@ public class WhereParser extends ExpressionVisitorAdapter { /** * 所有解析到的符合规则的where条件,用于进一步匹配 */ - private List conditions = Lists.newArrayList(); + private final List conditions = Lists.newArrayList(); public List getConditions() { return conditions; @@ -32,7 +29,6 @@ public List getConditions() { @Override public void visit(AndExpression expr) { - parseLogicOperator(expr, "AND"); } @@ -87,16 +83,10 @@ public void visit(InExpression expr) { parseCommonOperator(expr.getLeftExpression(), expr.getRightExpression(), "in"); } else { currentLogicOp = ""; - expr.getRightItemsList().accept(this); + expr.getRightExpression().accept(this); } } - @Override - public void visit(SubSelect subSelect) { - PlainSelect ps = (PlainSelect) subSelect.getSelectBody(); - ps.getWhere().accept(this); - } - private void parseLogicOperator(BinaryExpression binaryExpression, String operator) { binaryExpression.getLeftExpression().accept(this); currentLogicOp = operator; diff --git a/src/test/java/TestSqlParser.java b/src/test/java/TestSqlParser.java index 8b792e2..4ed1a1b 100644 --- a/src/test/java/TestSqlParser.java +++ b/src/test/java/TestSqlParser.java @@ -1,10 +1,19 @@ +import cn.hutool.core.collection.CollUtil; +import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.ReUtil; -import com.baomidou.mybatisplus.annotation.DbType; import com.baomidou.mybatisplus.generator.config.DataSourceConfig; import com.github.davidfantasy.mybatisplus.generatorui.sqlparser.ConditionExpr; import com.github.davidfantasy.mybatisplus.generatorui.sqlparser.DynamicParamSqlEnhancer; import com.google.common.collect.Lists; -import org.assertj.core.api.Assertions; +import net.sf.jsqlparser.JSQLParserException; +import net.sf.jsqlparser.expression.LongValue; +import net.sf.jsqlparser.expression.operators.relational.ComparisonOperator; +import net.sf.jsqlparser.expression.operators.relational.EqualsTo; +import net.sf.jsqlparser.parser.CCJSqlParserUtil; +import net.sf.jsqlparser.schema.Column; +import net.sf.jsqlparser.schema.Table; +import net.sf.jsqlparser.statement.select.*; +import org.junit.jupiter.api.Assertions; import org.junit.jupiter.api.Test; import java.util.List; @@ -53,16 +62,19 @@ public void testConditionParse() { " AND confirm_time BETWEEN '#{startTime}' AND '#{endTime}'"; System.out.println(sql); List conditions = enhancer.parseSqlDynamicConditions(sql); - Assertions.assertThat(conditions.size()).isEqualTo(5); + Assertions.assertEquals(conditions.size(), 5); List dParams = Lists.newArrayList(); conditions.forEach((condition) -> { String dynamicSql = enhancer.toDynamicSql(condition).trim(); System.out.println(dynamicSql); dParams.addAll(condition.getParamNames()); - Assertions.assertThat(getCorrectDsql().contains(dynamicSql)).isTrue(); - Assertions.assertThat(ReUtil.contains(Pattern.compile(condition.getFindPattern(), Pattern.CASE_INSENSITIVE), sql)).isTrue(); + Assertions.assertTrue(getCorrectDsql().contains(dynamicSql)); + Assertions.assertTrue(ReUtil.contains(Pattern.compile(condition.getFindPattern(), Pattern.CASE_INSENSITIVE), sql)); }); - Assertions.assertThat(dParams).contains("orderCode", "city", "customerIds", "creator", "startTime", "endTime"); + Assertions.assertTrue( + CollUtil.containsAll( + dParams, + CollectionUtil.newArrayList("orderCode", "city", "customerIds", "creator", "startTime", "endTime"))); } @Test @@ -78,5 +90,54 @@ public void testSqlParser2() { }); } + @Test + public void testSqlParser3() throws JSQLParserException { + String sqlStr = " SELECT *\n" + + " FROM ( SELECT 1 )\n" + + " UNION ALL\n" + + " SELECT *\n" + + " FROM ( VALUES 1, 2, 3 )\n" + + " UNION ALL\n" + + " VALUES ( 1, 2, 3 ) )"; + ParenthesedSelect parenthesedSelect = (ParenthesedSelect) CCJSqlParserUtil.parse(sqlStr); + SetOperationList setOperationList = parenthesedSelect.getSetOperationList(); + + PlainSelect select1 = (PlainSelect) setOperationList.getSelect(0); + PlainSelect subSelect1 = ((ParenthesedSelect) select1.getFromItem()).getPlainSelect(); + org.junit.jupiter.api.Assertions.assertEquals(1L, subSelect1.getSelectItem(0).getExpression(LongValue.class).getValue()); + + Values values = (Values) setOperationList.getSelect(2); + Assertions.assertEquals(3, values.getExpressions().size()); + + } + + @Test + public void testSqlParser4() { + String sqlStr = "select 1 from dual where a=b"; + + PlainSelect select = null; + try { + select = (PlainSelect) CCJSqlParserUtil.parse(sqlStr); + } catch (JSQLParserException e) { + e.printStackTrace(); + } + + SelectItem selectItem = + select.getSelectItems().get(0); + Assertions.assertEquals( + new LongValue(1) + , selectItem.getExpression()); + + Table table = (Table) select.getFromItem(); + Assertions.assertEquals("dual", table.getName()); + + ComparisonOperator equalsTo = (ComparisonOperator) select.getWhere(); + Column a = (Column) equalsTo.getLeftExpression(); + Column b = (Column) equalsTo.getRightExpression(); + Assertions.assertEquals("a", a.getColumnName()); + Assertions.assertEquals("b", b.getColumnName()); + + } + } From c48623e06986f9698ce1977b131ab4cc312e31d8 Mon Sep 17 00:00:00 2001 From: klaokai <573984425@qq.com> Date: Tue, 10 Sep 2024 13:48:16 +0800 Subject: [PATCH 04/11] =?UTF-8?q?fix=EF=BC=88=E4=BF=AE=E6=AD=A3=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E4=B8=AD=E7=9A=84sql=E8=AF=AD=E5=8F=A5=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/test/java/TestSqlParser.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/test/java/TestSqlParser.java b/src/test/java/TestSqlParser.java index 4ed1a1b..be5deb0 100644 --- a/src/test/java/TestSqlParser.java +++ b/src/test/java/TestSqlParser.java @@ -92,7 +92,7 @@ public void testSqlParser2() { @Test public void testSqlParser3() throws JSQLParserException { - String sqlStr = " SELECT *\n" + + String sqlStr = "( SELECT *\n" + " FROM ( SELECT 1 )\n" + " UNION ALL\n" + " SELECT *\n" + From 952813e58589ddeac84fca9db52ffe20f6f497f0 Mon Sep 17 00:00:00 2001 From: klaokai <573984425@qq.com> Date: Tue, 10 Sep 2024 13:59:05 +0800 Subject: [PATCH 05/11] =?UTF-8?q?fix=EF=BC=88=E4=BF=AE=E6=AD=A3=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E4=B8=AD=E7=9A=84=E5=AD=90=E6=9F=A5=E8=AF=A2=E6=B2=A1?= =?UTF-8?q?=E8=A2=AB=E8=A7=A3=E6=9E=90=E7=9A=84=E9=97=AE=E9=A2=98=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../mybatisplus/generatorui/sqlparser/SelectConditionParser.java | 1 + src/test/java/TestSqlParser.java | 1 + 2 files changed, 2 insertions(+) diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/sqlparser/SelectConditionParser.java b/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/sqlparser/SelectConditionParser.java index fb0caa7..d7ed7e2 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/sqlparser/SelectConditionParser.java +++ b/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/sqlparser/SelectConditionParser.java @@ -25,6 +25,7 @@ public void visit(Table tableName) { @Override public void visit(ParenthesedSelect parenthesedSelect) { + parenthesedSelect.getSetOperationList().accept((SelectVisitor) this); } @Override diff --git a/src/test/java/TestSqlParser.java b/src/test/java/TestSqlParser.java index be5deb0..78ef772 100644 --- a/src/test/java/TestSqlParser.java +++ b/src/test/java/TestSqlParser.java @@ -84,6 +84,7 @@ public void testSqlParser2() { .build(); DynamicParamSqlEnhancer enhancer = new DynamicParamSqlEnhancer(dsc.getDbType()); List conditions = enhancer.parseSqlDynamicConditions(sql); + Assertions.assertEquals(conditions.size(), 4); conditions.forEach((condition) -> { String dynamicSql = enhancer.toDynamicSql(condition).trim(); System.out.println(dynamicSql); From 78c58c361f478d765a8932bff1cdcef167c7b866 Mon Sep 17 00:00:00 2001 From: klaokai <573984425@qq.com> Date: Wed, 11 Sep 2024 09:33:40 +0800 Subject: [PATCH 06/11] =?UTF-8?q?refactor=EF=BC=88=E4=BB=BF=E7=85=A7Spring?= =?UTF-8?q?Doc=E7=BB=93=E6=9E=84=E8=BF=9B=E8=A1=8C=E6=94=B9=E9=80=A0?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pom.xml | 85 + .../MybatisPlusToolsApplication.java | 66 +- .../common}/ApplicationConfigure.java | 39 +- .../generatorui/common}/GeneratorConfig.java | 9 +- .../common}/ProjectPathResolver.java | 21 +- .../generatorui/common/api}/Result.java | 5 +- .../generatorui/common/api}/ResultCode.java | 2 +- .../common/api}/ResultGenerator.java | 2 +- .../common/api}/ServiceException.java | 2 +- .../common}/configurer/WebConfigurer.java | 2 +- .../configurer/WebControllerAdvice.java | 8 +- .../SpringDocConfigProperties.java | 1511 +++++++++++++++++ .../configuration/SpringDocConfiguration.java | 64 + .../core/providers/SpringWebProvider.java | 55 + .../common/core/utils/Constants.java | 420 +++++ .../common/core/utils/JsonUtil.java | 64 + .../generatorui/common/core/utils/OSUtil.java | 24 + .../common/core/utils/PathUtil.java | 41 + .../common/core/utils/SpringDocUtils.java | 58 + .../common}/dbquery/DbQueryHolder.java | 2 +- .../common}/dbquery/SqlServerQuery.java | 2 +- .../generatorui/common}/dto/Constant.java | 2 +- .../generatorui/common}/dto/DtoFieldInfo.java | 2 +- .../common/dto/ElementPosition.java | 5 + .../generatorui/common}/dto/GenDtoConfig.java | 2 +- .../common}/dto/GenDtoFromSqlReq.java | 2 +- .../generatorui/common}/dto/GenSetting.java | 2 +- .../common}/dto/JavaClassMethodInfo.java | 2 +- .../common}/dto/MapperElement.java | 2 +- .../common}/dto/MpgGenCodeDto.java | 2 +- .../common}/dto/OutputFileInfo.java | 5 +- .../generatorui/common}/dto/TableInfo.java | 2 +- .../generatorui/common}/dto/UserConfig.java | 6 +- .../common}/mbp/BeetlTemplateEngine.java | 6 +- .../generatorui/common}/mbp/MbpGenerator.java | 22 +- .../common}/mbp/NameConverter.java | 8 +- .../common}/mbp/TemplateVaribleInjecter.java | 2 +- .../common}/service/AutoCompleteService.java | 8 +- .../common}/service/DatabaseService.java | 6 +- .../common}/service/JavaClassParser.java | 12 +- .../common}/service/MapperXmlParser.java | 8 +- .../service/OutputFileInfoService.java | 18 +- .../common}/service/SqlGeneratorService.java | 22 +- .../common}/service/UserConfigStore.java | 20 +- .../common}/sqlparser/ConditionExpr.java | 2 +- .../sqlparser/DynamicParamSqlEnhancer.java | 22 +- .../sqlparser/SelectConditionParser.java | 6 +- .../common}/sqlparser/WhereParser.java | 12 +- .../common}/strategy/ControllerStrategy.java | 2 +- .../common}/strategy/EntityStrategy.java | 2 +- .../common}/strategy/MapperStrategy.java | 2 +- .../common}/strategy/MapperXmlStrategy.java | 2 +- .../common}/strategy/ServiceImplStrategy.java | 2 +- .../common}/strategy/ServiceStrategy.java | 2 +- .../generatorui/common}/util/JsonUtil.java | 2 +- .../generatorui/common}/util/OSUtil.java | 2 +- .../generatorui/common}/util/PathUtil.java | 2 +- .../common}/util/TemplateUtil.java | 4 +- .../main/resources/META-INF/spring.factories | 3 + .../resources/codetpls/controller.java.btl | 0 .../src}/main/resources/codetpls/dto.btl | 0 .../main/resources/codetpls/entity.java.btl | 0 .../main/resources/codetpls/mapper.java.btl | 0 .../main/resources/codetpls/mapper.xml.btl | 0 .../main/resources/codetpls/mapperMethods.btl | 0 .../main/resources/codetpls/resultMap.btl | 0 .../main/resources/codetpls/service.java.btl | 0 .../resources/codetpls/serviceImpl.java.btl | 0 .../public/_nuxt/09694b79d33cba9c2850.js | 0 .../public/_nuxt/27503bae7f340bb103e0.js | 0 .../public/_nuxt/27503bae7f340bb103e0.js.map | 0 .../public/_nuxt/4d665454dfb48fc57305.js | 0 .../public/_nuxt/52cc4ad706f1ab56fd67.js | 0 .../public/_nuxt/77f28fc3ed6d061a9232.js | 0 .../public/_nuxt/7b68d0166b8d500e2875.js | 0 .../public/_nuxt/86adaf226d0c8490dad4.js | 0 .../public/_nuxt/9d53f74ea8103025e271.js | 0 .../src}/main/resources/public/_nuxt/LICENSES | 0 .../public/_nuxt/cf49cb65f4df44b6a375.js | 0 .../public/_nuxt/cf49cb65f4df44b6a375.js.map | 0 .../public/_nuxt/e5273501af6c8ff2839e.js | 0 .../resources/public/_nuxt/fonts/535877f.woff | Bin .../resources/public/_nuxt/fonts/674f50d.eot | Bin .../resources/public/_nuxt/fonts/732389d.ttf | Bin .../public/_nuxt/fonts/af7ae50.woff2 | Bin .../resources/public/_nuxt/fonts/b06871f.ttf | Bin .../resources/public/_nuxt/fonts/fee66e7.woff | Bin .../resources/public/_nuxt/img/acf3dcb.svg | 0 .../resources/public/_nuxt/img/af9195e.png | Bin .../src}/main/resources/public/index.html | 0 .../public/libs/adminlte/adminlte.min.css | 0 .../public/libs/adminlte/adminlte.min.js | 0 .../libs/bootstrap/css/bootstrap.min.css | 0 .../libs/bootstrap/css/bootstrap.min.css.map | 0 .../public/libs/bootstrap/js/bootstrap.min.js | 0 .../font-awesome/css/font-awesome.min.css | 4 + .../libs/font-awesome/fonts/FontAwesome.otf | Bin .../fonts/fontawesome-webfont.eot | Bin .../fonts/fontawesome-webfont.svg | 0 .../fonts/fontawesome-webfont.ttf | Bin .../fonts/fontawesome-webfont.woff | Bin .../fonts/fontawesome-webfont.woff2 | Bin .../public/libs/jquery.fullscreen-min.js | 0 .../main/resources/public/libs/jquery.min.js | 0 .../resources/application-test.properties | 4 + .../pom.xml | 48 + .../api/api}/AutoCompleteController.java | 10 +- .../webmvc/api/api}/DatabaseController.java | 10 +- .../api/api}/MbpGeneratorController.java | 10 +- .../api/MultipleOpenApiActuatorResource.java | 27 + .../webmvc/api/api/OpenApiWebMvcResource.java | 25 + .../api/api}/OutputFileInfoController.java | 18 +- .../api/api}/SqlGeneratorController.java | 12 +- .../webmvc/api/api}/TemplateController.java | 18 +- .../core/RouterFunctionWebMvcProvider.java | 41 + .../core/SpringDocWebMvcConfiguration.java | 60 + .../webmvc/api/core/SpringWebMvcProvider.java | 112 ++ .../main/resources/META-INF/spring.factories | 2 + .../pom.xml | 38 + .../generatorui/webmvc/ui/SwaggerConfig.java | 55 + .../generatorui/webmvc/ui/SwaggerUiHome.java | 64 + .../main/resources/META-INF/spring.factories | 2 + .../pom.xml | 75 + .../generatorui/ControllerPrinter.java | 51 + .../generatorui/ServerApplication.java | 35 + .../src/main/resources/application.yaml | 17 + .../generatorui/AbstractCommonTest.java | 35 + .../generatorui/AbstractSpringDocTest.java | 73 + .../generatorui}/TestApplication.java | 12 +- .../generatorui}/TestSqlParser.java | 6 +- .../generatorui/app2/SpringDocApp2Test.java | 29 + .../generatorui/app3/SpringDocApp3Test.java | 39 + .../resources/application-test.properties | 5 + .../src/test/resources/logback-test.xml | 5 + .../src/test/resources/results/app2.json | 1 + .../src/test/resources/results/app3.json | 1 + mybatis-plus-generator-ui-tests/pom.xml | 18 + pom.xml | 94 +- .../generatorui/dto/ElementPosition.java | 5 - src/main/resources/application.yml | 0 .../font-awesome/css/font-awesome.min.css | 4 - 141 files changed, 3474 insertions(+), 306 deletions(-) create mode 100644 mybatis-plus-generator-ui-starter-common/pom.xml rename {src => mybatis-plus-generator-ui-starter-common/src}/main/java/com/github/davidfantasy/mybatisplus/generatorui/MybatisPlusToolsApplication.java (56%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/ApplicationConfigure.java (66%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/GeneratorConfig.java (87%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/ProjectPathResolver.java (89%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/api}/Result.java (86%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/api}/ResultCode.java (84%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/api}/ResultGenerator.java (91%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/api}/ServiceException.java (85%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/configurer/WebConfigurer.java (94%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/configurer/WebControllerAdvice.java (81%) create mode 100644 mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/SpringDocConfigProperties.java create mode 100644 mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/SpringDocConfiguration.java create mode 100644 mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/providers/SpringWebProvider.java create mode 100644 mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/Constants.java create mode 100644 mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/JsonUtil.java create mode 100644 mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/OSUtil.java create mode 100644 mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/PathUtil.java create mode 100644 mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/SpringDocUtils.java rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/dbquery/DbQueryHolder.java (93%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/dbquery/SqlServerQuery.java (90%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/dto/Constant.java (93%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/dto/DtoFieldInfo.java (94%) create mode 100644 mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/ElementPosition.java rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/dto/GenDtoConfig.java (97%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/dto/GenDtoFromSqlReq.java (67%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/dto/GenSetting.java (91%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/dto/JavaClassMethodInfo.java (83%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/dto/MapperElement.java (78%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/dto/MpgGenCodeDto.java (69%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/dto/OutputFileInfo.java (91%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/dto/TableInfo.java (62%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/dto/UserConfig.java (94%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/mbp/BeetlTemplateEngine.java (94%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/mbp/MbpGenerator.java (94%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/mbp/NameConverter.java (88%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/mbp/TemplateVaribleInjecter.java (75%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/service/AutoCompleteService.java (87%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/service/DatabaseService.java (91%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/service/JavaClassParser.java (83%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/service/MapperXmlParser.java (91%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/service/OutputFileInfoService.java (84%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/service/SqlGeneratorService.java (94%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/service/UserConfigStore.java (90%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/sqlparser/ConditionExpr.java (96%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/sqlparser/DynamicParamSqlEnhancer.java (83%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/sqlparser/SelectConditionParser.java (85%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/sqlparser/WhereParser.java (81%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/strategy/ControllerStrategy.java (90%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/strategy/EntityStrategy.java (96%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/strategy/MapperStrategy.java (78%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/strategy/MapperXmlStrategy.java (78%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/strategy/ServiceImplStrategy.java (79%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/strategy/ServiceStrategy.java (78%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/util/JsonUtil.java (96%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/util/OSUtil.java (89%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/util/PathUtil.java (94%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui => mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common}/util/TemplateUtil.java (85%) create mode 100644 mybatis-plus-generator-ui-starter-common/src/main/resources/META-INF/spring.factories rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/codetpls/controller.java.btl (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/codetpls/dto.btl (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/codetpls/entity.java.btl (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/codetpls/mapper.java.btl (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/codetpls/mapper.xml.btl (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/codetpls/mapperMethods.btl (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/codetpls/resultMap.btl (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/codetpls/service.java.btl (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/codetpls/serviceImpl.java.btl (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/public/_nuxt/09694b79d33cba9c2850.js (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/public/_nuxt/27503bae7f340bb103e0.js (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/public/_nuxt/27503bae7f340bb103e0.js.map (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/public/_nuxt/4d665454dfb48fc57305.js (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/public/_nuxt/52cc4ad706f1ab56fd67.js (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/public/_nuxt/77f28fc3ed6d061a9232.js (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/public/_nuxt/7b68d0166b8d500e2875.js (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/public/_nuxt/86adaf226d0c8490dad4.js (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/public/_nuxt/9d53f74ea8103025e271.js (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/public/_nuxt/LICENSES (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/public/_nuxt/cf49cb65f4df44b6a375.js (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/public/_nuxt/cf49cb65f4df44b6a375.js.map (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/public/_nuxt/e5273501af6c8ff2839e.js (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/public/_nuxt/fonts/535877f.woff (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/public/_nuxt/fonts/674f50d.eot (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/public/_nuxt/fonts/732389d.ttf (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/public/_nuxt/fonts/af7ae50.woff2 (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/public/_nuxt/fonts/b06871f.ttf (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/public/_nuxt/fonts/fee66e7.woff (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/public/_nuxt/img/acf3dcb.svg (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/public/_nuxt/img/af9195e.png (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/public/index.html (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/public/libs/adminlte/adminlte.min.css (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/public/libs/adminlte/adminlte.min.js (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/public/libs/bootstrap/css/bootstrap.min.css (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/public/libs/bootstrap/css/bootstrap.min.css.map (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/public/libs/bootstrap/js/bootstrap.min.js (100%) create mode 100644 mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/font-awesome/css/font-awesome.min.css rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/public/libs/font-awesome/fonts/FontAwesome.otf (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.eot (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.svg (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.ttf (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.woff (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.woff2 (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/public/libs/jquery.fullscreen-min.js (100%) rename {src => mybatis-plus-generator-ui-starter-common/src}/main/resources/public/libs/jquery.min.js (100%) create mode 100644 mybatis-plus-generator-ui-starter-common/src/test/resources/application-test.properties create mode 100644 mybatis-plus-generator-ui-starter-webmvc-api/pom.xml rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui/controller => mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api}/AutoCompleteController.java (65%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui/controller => mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api}/DatabaseController.java (60%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui/controller => mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api}/MbpGeneratorController.java (63%) create mode 100644 mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api/MultipleOpenApiActuatorResource.java create mode 100644 mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api/OpenApiWebMvcResource.java rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui/controller => mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api}/OutputFileInfoController.java (85%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui/controller => mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api}/SqlGeneratorController.java (62%) rename {src/main/java/com/github/davidfantasy/mybatisplus/generatorui/controller => mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api}/TemplateController.java (81%) create mode 100644 mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/core/RouterFunctionWebMvcProvider.java create mode 100644 mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/core/SpringDocWebMvcConfiguration.java create mode 100644 mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/core/SpringWebMvcProvider.java create mode 100644 mybatis-plus-generator-ui-starter-webmvc-api/src/main/resources/META-INF/spring.factories create mode 100644 mybatis-plus-generator-ui-starter-webmvc-ui/pom.xml create mode 100644 mybatis-plus-generator-ui-starter-webmvc-ui/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/ui/SwaggerConfig.java create mode 100644 mybatis-plus-generator-ui-starter-webmvc-ui/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/ui/SwaggerUiHome.java create mode 100644 mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/META-INF/spring.factories create mode 100644 mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/pom.xml create mode 100644 mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/ControllerPrinter.java create mode 100644 mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/ServerApplication.java create mode 100644 mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/main/resources/application.yaml create mode 100644 mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/AbstractCommonTest.java create mode 100644 mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/AbstractSpringDocTest.java rename {src/test/java => mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui}/TestApplication.java (72%) rename {src/test/java => mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui}/TestSqlParser.java (96%) create mode 100644 mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/app2/SpringDocApp2Test.java create mode 100644 mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/app3/SpringDocApp3Test.java create mode 100644 mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/resources/application-test.properties create mode 100644 mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/resources/logback-test.xml create mode 100644 mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/resources/results/app2.json create mode 100644 mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/resources/results/app3.json create mode 100644 mybatis-plus-generator-ui-tests/pom.xml delete mode 100644 src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dto/ElementPosition.java delete mode 100644 src/main/resources/application.yml delete mode 100644 src/main/resources/public/libs/font-awesome/css/font-awesome.min.css diff --git a/mybatis-plus-generator-ui-starter-common/pom.xml b/mybatis-plus-generator-ui-starter-common/pom.xml new file mode 100644 index 0000000..855edcb --- /dev/null +++ b/mybatis-plus-generator-ui-starter-common/pom.xml @@ -0,0 +1,85 @@ + + + + com.github.davidfantasy + mybatis-plus-generator-ui + 2.0.5 + + 4.0.0 + mybatis-plus-generator-ui-starter-common + mybatis-plus-generator-ui-starter-common + mybatis-plus-generator-ui-starter-common + + + org.springframework.boot + spring-boot-starter + + + + org.springframework.boot + spring-boot-starter-test + test + + + org.springframework.boot + spring-boot-actuator-autoconfigure + + + com.google.guava + guava + 32.0.0-jre + + + org.springframework.boot + spring-boot-starter-jdbc + + + com.baomidou + mybatis-plus-generator + ${mybatis-plus.version} + + + com.baomidou + mybatis-plus-annotation + ${mybatis-plus.version} + + + com.baomidou + mybatis-plus-core + ${mybatis-plus.version} + + + com.ibeetl + beetl + 3.15.4.RELEASE + + + org.projectlombok + lombok + 1.18.34 + provided + + + org.dom4j + dom4j + 2.1.4 + + + + com.alibaba + druid + 1.2.23 + + + com.github.jsqlparser + jsqlparser + 4.9 + + + com.github.javaparser + javaparser-symbol-solver-core + 3.26.1 + + + diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/MybatisPlusToolsApplication.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/MybatisPlusToolsApplication.java similarity index 56% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/MybatisPlusToolsApplication.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/MybatisPlusToolsApplication.java index c7913b1..4328eae 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/MybatisPlusToolsApplication.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/MybatisPlusToolsApplication.java @@ -1,5 +1,6 @@ package com.github.davidfantasy.mybatisplus.generatorui; +import com.github.davidfantasy.mybatisplus.generatorui.common.GeneratorConfig; import com.google.common.base.Strings; import com.google.common.collect.Maps; import lombok.extern.slf4j.Slf4j; @@ -12,6 +13,7 @@ import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; +import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import java.util.Map; @@ -36,7 +38,7 @@ public class MybatisPlusToolsApplication { private static GeneratorConfig generatorConfig; - public static void run(GeneratorConfig generatorConfig) { + public static void run(Class clazz, String[] args, GeneratorConfig generatorConfig) { if (Strings.isNullOrEmpty(generatorConfig.getJdbcUrl())) { throw new IllegalArgumentException("jdbcUrl必须要设置"); } @@ -45,38 +47,46 @@ public static void run(GeneratorConfig generatorConfig) { //启动MyBatis Map props = Maps.newHashMap(); + props.put("spring.datasource.url", generatorConfig.getJdbcUrl()); + props.put("spring.datasource.driver-class-name", generatorConfig.getDriverClassName()); + props.put("spring.datasource.username", generatorConfig.getUserName()); + props.put("spring.datasource.password", generatorConfig.getPassword()); new SpringApplicationBuilder() .properties(props) - .sources(MybatisPlusToolsApplication.class) - .run(); + .sources(clazz) + .run(args); } - /** - * 通过注入一个WebServerFactoryCustomizer来达到修改服务器端口的目的 - * @param config - * @return - */ - @Bean - public WebServerFactoryCustomizer containerConfig(GeneratorConfig config) { - return factory -> { - if (config.getPort() != null) { - factory.setPort(MybatisPlusToolsApplication.generatorConfig.getPort()); - } else { - factory.setPort(8080); - } - factory.setContextPath(""); - }; - } - - /** - * 注入项目配置 - * @return 项目配置的对象 - */ - @Bean - public GeneratorConfig generatorConfig() { - return MybatisPlusToolsApplication.generatorConfig; - } + @Configuration + public static class MainConfigutration { + /** + * 通过注入一个WebServerFactoryCustomizer来达到修改服务器端口的目的 + * + * @param config + * @return + */ + @Bean + public WebServerFactoryCustomizer containerConfig(GeneratorConfig config) { + return factory -> { + if (config.getPort() != null) { + factory.setPort(MybatisPlusToolsApplication.generatorConfig.getPort()); + } else { + factory.setPort(8080); + } + factory.setContextPath(""); + }; + } + /** + * 注入项目配置 + * + * @return 项目配置的对象 + */ + @Bean + public GeneratorConfig generatorConfig() { + return MybatisPlusToolsApplication.generatorConfig; + } + } } diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/ApplicationConfigure.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/ApplicationConfigure.java similarity index 66% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/ApplicationConfigure.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/ApplicationConfigure.java index 549971a..a84f2fd 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/ApplicationConfigure.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/ApplicationConfigure.java @@ -1,15 +1,19 @@ -package com.github.davidfantasy.mybatisplus.generatorui; +package com.github.davidfantasy.mybatisplus.generatorui.common; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.generator.config.DataSourceConfig; -import com.github.davidfantasy.mybatisplus.generatorui.mbp.BeetlTemplateEngine; -import com.github.davidfantasy.mybatisplus.generatorui.service.UserConfigStore; -import com.github.davidfantasy.mybatisplus.generatorui.sqlparser.DynamicParamSqlEnhancer; +import com.github.davidfantasy.mybatisplus.generatorui.common.mbp.BeetlTemplateEngine; +import com.github.davidfantasy.mybatisplus.generatorui.common.service.UserConfigStore; +import com.github.davidfantasy.mybatisplus.generatorui.common.sqlparser.DynamicParamSqlEnhancer; import com.zaxxer.hikari.HikariDataSource; +import org.springframework.beans.factory.ObjectProvider; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.jdbc.core.JdbcTemplate; +import javax.sql.DataSource; + @Configuration public class ApplicationConfigure { @@ -18,6 +22,22 @@ public ProjectPathResolver projectPathResolver(GeneratorConfig config) { return new ProjectPathResolver(config.getBasePackage()); } + /** + * 如果没有,就主动注入一个 + * + * @param config + * @return + */ + @ConditionalOnMissingBean(DataSource.class) + @Bean + public DataSource dataSource(GeneratorConfig config) { + HikariDataSource ds = new HikariDataSource(); + ds.setJdbcUrl(config.getJdbcUrl()); + ds.setUsername(config.getUserName()); + ds.setPassword(config.getPassword()); + ds.setDriverClassName(config.getDriverClassName()); + return ds; + } /** * 这里的DataSourceConfig仅用于获取tablesql,查询数据库元数据,和代码生成无关 @@ -35,15 +55,14 @@ public DataSourceConfig mbpDsConfig(GeneratorConfig config) { * 用于查询数据库元数据 */ @Bean - public JdbcTemplate jdbcTemplate(GeneratorConfig config) { + public JdbcTemplate jdbcTemplate(GeneratorConfig config, ObjectProvider dataSources) { if (StrUtil.isBlank(config.getJdbcUrl())) { throw new IllegalArgumentException("必须指定jdbcUrl用于创建数据源"); } - HikariDataSource ds = new HikariDataSource(); - ds.setJdbcUrl(config.getJdbcUrl()); - ds.setUsername(config.getUserName()); - ds.setPassword(config.getPassword()); - ds.setDriverClassName(config.getDriverClassName()); + DataSource ds = dataSources.getIfAvailable(); + if (ds == null) { + ds = dataSource(config); + } return new JdbcTemplate(ds); } diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/GeneratorConfig.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/GeneratorConfig.java similarity index 87% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/GeneratorConfig.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/GeneratorConfig.java index 0e082d0..0d64066 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/GeneratorConfig.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/GeneratorConfig.java @@ -1,16 +1,13 @@ -package com.github.davidfantasy.mybatisplus.generatorui; +package com.github.davidfantasy.mybatisplus.generatorui.common; -import com.baomidou.mybatisplus.annotation.DbType; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.generator.config.ITypeConvert; import com.baomidou.mybatisplus.generator.config.rules.DateType; -import com.github.davidfantasy.mybatisplus.generatorui.mbp.NameConverter; -import com.github.davidfantasy.mybatisplus.generatorui.mbp.TemplateVaribleInjecter; +import com.github.davidfantasy.mybatisplus.generatorui.common.mbp.NameConverter; +import com.github.davidfantasy.mybatisplus.generatorui.common.mbp.TemplateVaribleInjecter; import lombok.Builder; import lombok.Data; -import java.util.Objects; - @Builder @Data public class GeneratorConfig { diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/ProjectPathResolver.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/ProjectPathResolver.java similarity index 89% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/ProjectPathResolver.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/ProjectPathResolver.java index 390decd..0545e5e 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/ProjectPathResolver.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/ProjectPathResolver.java @@ -1,8 +1,8 @@ -package com.github.davidfantasy.mybatisplus.generatorui; +package com.github.davidfantasy.mybatisplus.generatorui.common; -import com.github.davidfantasy.mybatisplus.generatorui.common.ServiceException; -import com.github.davidfantasy.mybatisplus.generatorui.util.OSUtil; -import com.github.davidfantasy.mybatisplus.generatorui.util.PathUtil; +import com.github.davidfantasy.mybatisplus.generatorui.common.api.ServiceException; +import com.github.davidfantasy.mybatisplus.generatorui.common.core.utils.OSUtil; +import com.github.davidfantasy.mybatisplus.generatorui.common.util.PathUtil; import com.google.common.base.Strings; import lombok.Getter; import lombok.extern.slf4j.Slf4j; @@ -12,22 +12,23 @@ import java.net.URLDecoder; import java.util.regex.Pattern; -import static com.github.davidfantasy.mybatisplus.generatorui.dto.Constant.*; +import static com.github.davidfantasy.mybatisplus.generatorui.common.dto.Constant.PACKAGE_JAVA_PREFIX; +import static com.github.davidfantasy.mybatisplus.generatorui.common.dto.Constant.PACKAGE_RESOURCES_PREFIX; @Getter @Slf4j public class ProjectPathResolver { + private final String basePackage; + + private final Pattern packagePattern = Pattern.compile("[a-zA-Z]+[0-9a-zA-Z_]*(\\.[a-zA-Z]+[0-9a-zA-Z_]*)*"); + private String sourcePath; private String resourcePath; private String baseProjectPath; - private final String basePackage; - - private final Pattern packagePattern = Pattern.compile("[a-zA-Z]+[0-9a-zA-Z_]*(\\.[a-zA-Z]+[0-9a-zA-Z_]*)*"); - public ProjectPathResolver(String basePackage) { this.basePackage = basePackage; ClassLoader contextLoader = Thread.currentThread().getContextClassLoader(); @@ -112,7 +113,7 @@ public String convertPathToPackage(String path) { } String packageStr = path.replace(File.separator, "."); if (packageStr.startsWith(".")) { - packageStr = packageStr.substring(1, packageStr.length()); + packageStr = packageStr.substring(1); } return packageStr; } diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/Result.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/api/Result.java similarity index 86% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/Result.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/api/Result.java index ae63fdd..d2d2211 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/Result.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/api/Result.java @@ -1,6 +1,5 @@ -package com.github.davidfantasy.mybatisplus.generatorui.common; - -import com.github.davidfantasy.mybatisplus.generatorui.util.JsonUtil; +package com.github.davidfantasy.mybatisplus.generatorui.common.api; +import com.github.davidfantasy.mybatisplus.generatorui.common.core.utils.JsonUtil; /** * 统一API响应结果封装 diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/ResultCode.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/api/ResultCode.java similarity index 84% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/ResultCode.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/api/ResultCode.java index 1193c40..fef9233 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/ResultCode.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/api/ResultCode.java @@ -1,4 +1,4 @@ -package com.github.davidfantasy.mybatisplus.generatorui.common; +package com.github.davidfantasy.mybatisplus.generatorui.common.api; /** * 响应码枚举,参考HTTP状态码的语义 diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/ResultGenerator.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/api/ResultGenerator.java similarity index 91% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/ResultGenerator.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/api/ResultGenerator.java index 47e9864..c6a4321 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/ResultGenerator.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/api/ResultGenerator.java @@ -1,4 +1,4 @@ -package com.github.davidfantasy.mybatisplus.generatorui.common; +package com.github.davidfantasy.mybatisplus.generatorui.common.api; /** * 响应结果生成工具 diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/ServiceException.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/api/ServiceException.java similarity index 85% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/ServiceException.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/api/ServiceException.java index c8a2f30..bdc804c 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/ServiceException.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/api/ServiceException.java @@ -1,4 +1,4 @@ -package com.github.davidfantasy.mybatisplus.generatorui.common; +package com.github.davidfantasy.mybatisplus.generatorui.common.api; /** * 服务(业务)异常如“ 账号或密码错误 ”,该异常只做INFO级别的日志记录 @see WebMvcConfigurer diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/configurer/WebConfigurer.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/configurer/WebConfigurer.java similarity index 94% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/configurer/WebConfigurer.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/configurer/WebConfigurer.java index 8950c45..3f88c7e 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/configurer/WebConfigurer.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/configurer/WebConfigurer.java @@ -1,4 +1,4 @@ -package com.github.davidfantasy.mybatisplus.generatorui.configurer; +package com.github.davidfantasy.mybatisplus.generatorui.common.configurer; import org.springframework.boot.web.server.ErrorPage; import org.springframework.boot.web.server.ErrorPageRegistrar; diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/configurer/WebControllerAdvice.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/configurer/WebControllerAdvice.java similarity index 81% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/configurer/WebControllerAdvice.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/configurer/WebControllerAdvice.java index e38cae9..529d9fc 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/configurer/WebControllerAdvice.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/configurer/WebControllerAdvice.java @@ -1,8 +1,8 @@ -package com.github.davidfantasy.mybatisplus.generatorui.configurer; +package com.github.davidfantasy.mybatisplus.generatorui.common.configurer; -import com.github.davidfantasy.mybatisplus.generatorui.common.Result; -import com.github.davidfantasy.mybatisplus.generatorui.common.ResultCode; -import com.github.davidfantasy.mybatisplus.generatorui.common.ServiceException; +import com.github.davidfantasy.mybatisplus.generatorui.common.api.Result; +import com.github.davidfantasy.mybatisplus.generatorui.common.api.ResultCode; +import com.github.davidfantasy.mybatisplus.generatorui.common.api.ServiceException; import lombok.extern.slf4j.Slf4j; import org.springframework.web.bind.annotation.ControllerAdvice; import org.springframework.web.bind.annotation.ExceptionHandler; diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/SpringDocConfigProperties.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/SpringDocConfigProperties.java new file mode 100644 index 0000000..3623af3 --- /dev/null +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/SpringDocConfigProperties.java @@ -0,0 +1,1511 @@ +/* + * + * * + * * * + * * * * Copyright 2019-2022 the original author or authors. + * * * * + * * * * Licensed under the Apache License, Version 2.0 (the "License"); + * * * * you may not use this file except in compliance with the License. + * * * * You may obtain a copy of the License at + * * * * + * * * * https://www.apache.org/licenses/LICENSE-2.0 + * * * * + * * * * Unless required by applicable law or agreed to in writing, software + * * * * distributed under the License is distributed on an "AS IS" BASIS, + * * * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * * * See the License for the specific language governing permissions and + * * * * limitations under the License. + * * * + * * + * + */ + +package com.github.davidfantasy.mybatisplus.generatorui.common.core.configuration; + +import com.github.davidfantasy.mybatisplus.generatorui.common.core.utils.Constants; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Lazy; +import org.springframework.http.MediaType; + +import java.util.ArrayList; +import java.util.List; + +/** + * The type Spring doc config properties. + * + * @author bnasslahsen + */ +@Lazy(false) +@Configuration(proxyBeanMethods = false) +@ConfigurationProperties(prefix = Constants.SPRINGDOC_PREFIX) +@ConditionalOnProperty(name = Constants.SPRINGDOC_ENABLED, matchIfMissing = true) +public class SpringDocConfigProperties { + + /** + * The Show actuator. + */ + private boolean showActuator; + + /** + * The Webjars. + */ + private Webjars webjars = new Webjars(); + + /** + * The Api docs. + */ + private ApiDocs apiDocs = new ApiDocs(); + + /** + * The Packages to scan. + */ + private List packagesToScan; + + /** + * The Packages to exclude. + */ + private List packagesToExclude; + + /** + * The Paths to match. + */ + private List pathsToMatch; + + /** + * The Paths to exclude. + */ + private List pathsToExclude; + + /** + * The Produces to match. + */ + private List producesToMatch; + + /** + * The Headers to match. + */ + private List headersToMatch; + + /** + * The Consumes to match. + */ + private List consumesToMatch; + + /** + * The Cache. + */ + private Cache cache = new Cache(); + + /** + * The Group configs. + */ + private List groupConfigs = new ArrayList<>(); + + /** + * The Auto tag classes. + */ + private boolean autoTagClasses = true; + + /** + * The Model and view allowed. + */ + private boolean modelAndViewAllowed; + + /** + * The Override with generic response. + */ + private Boolean overrideWithGenericResponse; + + /** + * The Remove broken reference definitions. + */ + private boolean removeBrokenReferenceDefinitions = true; + + /** + * The Writer with default pretty printer. + */ + private boolean writerWithDefaultPrettyPrinter; + + /** + * The Writer with order by keys. + */ + private boolean writerWithOrderByKeys; + + /** + * The Default consumes media type. + */ + private String defaultConsumesMediaType = MediaType.APPLICATION_JSON_VALUE; + + /** + * The Default produces media type. + */ + private String defaultProducesMediaType = MediaType.ALL_VALUE; + + /** + * Use fully qualified name + */ + private boolean useFqn; + + /** + * The Show login endpoint. + */ + private boolean showLoginEndpoint; + + /** + * Allow for pre-loading OpenAPI + */ + private boolean preLoadingEnabled; + + /** + * If set to true, exposes the swagger-ui on the actuator management port. + */ + private boolean useManagementPort; + + /** + * The Disable i18n. + */ + private boolean disableI18n; + + /** + * The Show spring cloud functions. + */ + private boolean showSpringCloudFunctions; + + /** + * The param default flatten + */ + private boolean defaultFlatParamObject; + + /** + * convert query param to form data when consumes is multipart/form-data + */ + private boolean defaultSupportFormData; + + /** + * The model Converters + */ + private ModelConverters modelConverters = new ModelConverters(); + + /** + * The Sort converter. + */ + private ModelConverters.SortConverter sortConverter = new ModelConverters.SortConverter(); + + /** + * The Nullable request parameter enabled. + */ + private boolean nullableRequestParameterEnabled; + + /** + * The Show oauth2 endpoints. + */ + private boolean showOauth2Endpoints; + + /** + * Gets override with generic response. + * + * @return the override with generic response + */ + public Boolean getOverrideWithGenericResponse() { + return overrideWithGenericResponse; + } + + /** + * Is nullable request parameter enabled boolean. + * + * @return the boolean + */ + public boolean isNullableRequestParameterEnabled() { + return nullableRequestParameterEnabled; + } + + /** + * Sets nullable request parameter enabled. + * + * @param nullableRequestParameterEnabled the nullable request parameter enabled + */ + public void setNullableRequestParameterEnabled(boolean nullableRequestParameterEnabled) { + this.nullableRequestParameterEnabled = nullableRequestParameterEnabled; + } + + /** + * Is default support form data boolean. + * + * @return the boolean + */ + public boolean isDefaultSupportFormData() { + return defaultSupportFormData; + } + + /** + * Sets default support form data. + * + * @param defaultSupportFormData the default support form data + */ + public void setDefaultSupportFormData(boolean defaultSupportFormData) { + this.defaultSupportFormData = defaultSupportFormData; + } + + /** + * Gets sort converter. + * + * @return the sort converter + */ + public ModelConverters.SortConverter getSortConverter() { + return sortConverter; + } + + /** + * Sets sort converter. + * + * @param sortConverter the sort converter + */ + public void setSortConverter(ModelConverters.SortConverter sortConverter) { + this.sortConverter = sortConverter; + } + + /** + * Is show spring cloud functions boolean. + * + * @return the boolean + */ + public boolean isShowSpringCloudFunctions() { + return showSpringCloudFunctions; + } + + /** + * Sets show spring cloud functions. + * + * @param showSpringCloudFunctions the show spring cloud functions + */ + public void setShowSpringCloudFunctions(boolean showSpringCloudFunctions) { + this.showSpringCloudFunctions = showSpringCloudFunctions; + } + + /** + * Is default flat param object + * + * @return the boolean + */ + public boolean isDefaultFlatParamObject() { + return defaultFlatParamObject; + } + + /** + * Sets default flat param object. + * + * @param defaultFlatParamObject the default flat param object + */ + public void setDefaultFlatParamObject(boolean defaultFlatParamObject) { + this.defaultFlatParamObject = defaultFlatParamObject; + } + + /** + * Gets model converters. + * + * @return the model converters + */ + public ModelConverters getModelConverters() { + return modelConverters; + } + + /** + * Sets model converters. + * + * @param modelConverters the model converters + */ + public void setModelConverters(ModelConverters modelConverters) { + this.modelConverters = modelConverters; + } + + + /** + * Is use management port boolean. + * + * @return the boolean + */ + public boolean isUseManagementPort() { + return useManagementPort; + } + + /** + * Sets use management port. + * + * @param useManagementPort the use management port + */ + public void setUseManagementPort(boolean useManagementPort) { + this.useManagementPort = useManagementPort; + } + + /** + * Gets produces to match. + * + * @return the produces to match + */ + public List getProducesToMatch() { + return producesToMatch; + } + + /** + * Sets produces to match. + * + * @param producesToMatch the produces to match + */ + public void setProducesToMatch(List producesToMatch) { + this.producesToMatch = producesToMatch; + } + + /** + * Gets headers to match. + * + * @return the headers to match + */ + public List getHeadersToMatch() { + return headersToMatch; + } + + /** + * Sets headers to match. + * + * @param headersToMatch the headers to match + */ + public void setHeadersToMatch(List headersToMatch) { + this.headersToMatch = headersToMatch; + } + + /** + * Gets consumes to match. + * + * @return the consumes to match + */ + public List getConsumesToMatch() { + return consumesToMatch; + } + + /** + * Sets consumes to match. + * + * @param consumesToMatch the consumes to match + */ + public void setConsumesToMatch(List consumesToMatch) { + this.consumesToMatch = consumesToMatch; + } + + /** + * Is use fqn boolean. + * + * @return the boolean + */ + public boolean isUseFqn() { + return useFqn; + } + + /** + * Sets use fqn. + * + * @param useFqn the use fqn + */ + public void setUseFqn(boolean useFqn) { + this.useFqn = useFqn; + } + + /** + * Is auto tag classes boolean. + * + * @return the boolean + */ + public boolean isAutoTagClasses() { + return autoTagClasses; + } + + /** + * Sets auto tag classes. + * + * @param autoTagClasses the auto tag classes + */ + public void setAutoTagClasses(boolean autoTagClasses) { + this.autoTagClasses = autoTagClasses; + } + + /** + * Is model and view allowed boolean. + * + * @return the boolean + */ + public boolean isModelAndViewAllowed() { + return modelAndViewAllowed; + } + + /** + * Sets model and view allowed. + * + * @param modelAndViewAllowed the model and view allowed + */ + public void setModelAndViewAllowed(boolean modelAndViewAllowed) { + this.modelAndViewAllowed = modelAndViewAllowed; + } + + /** + * Gets packages to exclude. + * + * @return the packages to exclude + */ + public List getPackagesToExclude() { + return packagesToExclude; + } + + /** + * Sets packages to exclude. + * + * @param packagesToExclude the packages to exclude + */ + public void setPackagesToExclude(List packagesToExclude) { + this.packagesToExclude = packagesToExclude; + } + + /** + * Gets paths to exclude. + * + * @return the paths to exclude + */ + public List getPathsToExclude() { + return pathsToExclude; + } + + /** + * Sets paths to exclude. + * + * @param pathsToExclude the paths to exclude + */ + public void setPathsToExclude(List pathsToExclude) { + this.pathsToExclude = pathsToExclude; + } + + /** + * Is show login endpoint boolean. + * + * @return the boolean + */ + public boolean isShowLoginEndpoint() { + return showLoginEndpoint; + } + + /** + * Sets show login endpoint. + * + * @param showLoginEndpoint the show login endpoint + */ + public void setShowLoginEndpoint(boolean showLoginEndpoint) { + this.showLoginEndpoint = showLoginEndpoint; + } + + /** + * Gets packages to scan. + * + * @return the packages to scan + */ + public List getPackagesToScan() { + return packagesToScan; + } + + /** + * Sets packages to scan. + * + * @param packagesToScan the packages to scan + */ + public void setPackagesToScan(List packagesToScan) { + this.packagesToScan = packagesToScan; + } + + /** + * Is show actuator boolean. + * + * @return the boolean + */ + public boolean isShowActuator() { + return showActuator; + } + + /** + * Sets show actuator. + * + * @param showActuator the show actuator + */ + public void setShowActuator(boolean showActuator) { + this.showActuator = showActuator; + } + + /** + * Gets webjars. + * + * @return the webjars + */ + public Webjars getWebjars() { + return webjars; + } + + /** + * Sets webjars. + * + * @param webjars the webjars + */ + public void setWebjars(Webjars webjars) { + this.webjars = webjars; + } + + /** + * Gets api docs. + * + * @return the api docs + */ + public ApiDocs getApiDocs() { + return apiDocs; + } + + /** + * Sets api docs. + * + * @param apiDocs the api docs + */ + public void setApiDocs(ApiDocs apiDocs) { + this.apiDocs = apiDocs; + } + + /** + * Gets paths to match. + * + * @return the paths to match + */ + public List getPathsToMatch() { + return pathsToMatch; + } + + /** + * Sets paths to match. + * + * @param pathsToMatch the paths to match + */ + public void setPathsToMatch(List pathsToMatch) { + this.pathsToMatch = pathsToMatch; + } + + /** + * Gets cache. + * + * @return the cache + */ + public Cache getCache() { + return cache; + } + + /** + * Sets cache. + * + * @param cache the cache + */ + public void setCache(Cache cache) { + this.cache = cache; + } + + /** + * Is cache disabled boolean. + * + * @return the boolean + */ + public boolean isCacheDisabled() { + return cache.isDisabled(); + } + + /** + * Gets group configs. + * + * @return the group configs + */ + public List getGroupConfigs() { + return groupConfigs; + } + + /** + * Sets group configs. + * + * @param groupConfigs the group configs + */ + public void setGroupConfigs(List groupConfigs) { + this.groupConfigs = groupConfigs; + } + + /** + * Add group config. + * + * @param groupConfigs the group configs + */ + public void addGroupConfig(GroupConfig groupConfigs) { + this.groupConfigs.add(groupConfigs); + } + + /** + * Gets default consumes media type. + * + * @return the default consumes media type + */ + public String getDefaultConsumesMediaType() { + return defaultConsumesMediaType; + } + + /** + * Sets default consumes media type. + * + * @param defaultConsumesMediaType the default consumes media type + */ + public void setDefaultConsumesMediaType(String defaultConsumesMediaType) { + this.defaultConsumesMediaType = defaultConsumesMediaType; + } + + /** + * Gets default produces media type. + * + * @return the default produces media type + */ + public String getDefaultProducesMediaType() { + return defaultProducesMediaType; + } + + /** + * Sets default produces media type. + * + * @param defaultProducesMediaType the default produces media type + */ + public void setDefaultProducesMediaType(String defaultProducesMediaType) { + this.defaultProducesMediaType = defaultProducesMediaType; + } + + /** + * Is override with generic response boolean. + * + * @return the boolean + */ + public boolean isOverrideWithGenericResponse() { + return overrideWithGenericResponse != null && overrideWithGenericResponse; + } + + /** + * Sets override with generic response. + * + * @param overrideWithGenericResponse the override with generic response + */ + public void setOverrideWithGenericResponse(Boolean overrideWithGenericResponse) { + this.overrideWithGenericResponse = overrideWithGenericResponse; + } + + /** + * Gets default override with generic response. + * + * @return the default override with generic response + */ + public boolean isDefaultOverrideWithGenericResponse() { + if (overrideWithGenericResponse == null) { + return true; + } else { + return overrideWithGenericResponse; + } + } + + /** + * Is remove broken reference definitions boolean. + * + * @return the boolean + */ + public boolean isRemoveBrokenReferenceDefinitions() { + return removeBrokenReferenceDefinitions; + } + + /** + * Sets remove broken reference definitions. + * + * @param removeBrokenReferenceDefinitions the remove broken reference definitions + */ + public void setRemoveBrokenReferenceDefinitions(boolean removeBrokenReferenceDefinitions) { + this.removeBrokenReferenceDefinitions = removeBrokenReferenceDefinitions; + } + + /** + * Is writer wither order by keys boolean. + * + * @return the boolean + */ + public boolean isWriterWithOrderByKeys() { + return writerWithOrderByKeys; + } + + /** + * Sets writer wither order by keys. + * + * @param writerWithOrderByKeys the writer wither order by keys + */ + public void setWriterWithOrderByKeys(boolean writerWithOrderByKeys) { + this.writerWithOrderByKeys = writerWithOrderByKeys; + } + + /** + * Is writer with default pretty printer boolean. + * + * @return the boolean + */ + public boolean isWriterWithDefaultPrettyPrinter() { + return writerWithDefaultPrettyPrinter; + } + + /** + * Sets writer with default pretty printer. + * + * @param writerWithDefaultPrettyPrinter the writer with default pretty printer + */ + public void setWriterWithDefaultPrettyPrinter(boolean writerWithDefaultPrettyPrinter) { + this.writerWithDefaultPrettyPrinter = writerWithDefaultPrettyPrinter; + } + + /** + * Is disable i 18 n boolean. + * + * @return the boolean + */ + public boolean isDisableI18n() { + return disableI18n; + } + + /** + * Sets disable i 18 n. + * + * @param disableI18n the disable i 18 n + */ + public void setDisableI18n(boolean disableI18n) { + this.disableI18n = disableI18n; + } + + /** + * Is pre loading enabled boolean. + * + * @return the boolean + */ + public boolean isPreLoadingEnabled() { + return preLoadingEnabled; + } + + /** + * Sets pre loading enabled. + * + * @param preLoadingEnabled the pre loading enabled + */ + public void setPreLoadingEnabled(boolean preLoadingEnabled) { + this.preLoadingEnabled = preLoadingEnabled; + } + + public boolean isShowOauth2Endpoints() { + return showOauth2Endpoints; + } + + public void setShowOauth2Endpoints(boolean showOauth2Endpoint) { + this.showOauth2Endpoints = showOauth2Endpoint; + } + + /** + * The type Model converters. + * + * @author bnasslashen + */ + public static class ModelConverters { + + /** + * The Deprecating converter. + */ + private DeprecatingConverter deprecatingConverter = new DeprecatingConverter(); + + /** + * The Pageable converter. + */ + private PageableConverter pageableConverter = new PageableConverter(); + + /** + * The Polymorphic model converter. + */ + private PolymorphicConverter polymorphicConverter = new PolymorphicConverter(); + + + /** + * Gets deprecating converter. + * + * @return the deprecating converter + */ + public DeprecatingConverter getDeprecatingConverter() { + return deprecatingConverter; + } + + /** + * Sets deprecating converter. + * + * @param deprecatingConverter the deprecating converter + */ + public void setDeprecatingConverter(DeprecatingConverter deprecatingConverter) { + this.deprecatingConverter = deprecatingConverter; + } + + /** + * Gets pageable converter. + * + * @return the pageable converter + */ + public PageableConverter getPageableConverter() { + return pageableConverter; + } + + /** + * Sets pageable converter. + * + * @param pageableConverter the pageable converter + */ + public void setPageableConverter(PageableConverter pageableConverter) { + this.pageableConverter = pageableConverter; + } + + /** + * Gets polymorphic model converter. + * + * @return the polymorphic model converter + */ + public PolymorphicConverter getPolymorphicConverter() { + return polymorphicConverter; + } + + /** + * Sets polymorphic model converter. + * + * @param polymorphicConverter the polymorphic model converter + */ + public void setPolymorphicConverter(PolymorphicConverter polymorphicConverter) { + this.polymorphicConverter = polymorphicConverter; + } + + /** + * The type Sort converter. + * + * @author daniel -shuy + */ + public static class SortConverter { + + /** + * The Enabled. + */ + private boolean enabled; + + /** + * Is enabled boolean. + * + * @return the boolean + */ + public boolean isEnabled() { + return enabled; + } + + /** + * Sets enabled. + * + * @param enabled the enabled + */ + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + } + + /** + * The type Deprecating converter. + * + * @author bnasslashen + */ + public static class DeprecatingConverter { + + /** + * The Enabled. + */ + private boolean enabled; + + /** + * Is enabled boolean. + * + * @return the boolean + */ + public boolean isEnabled() { + return enabled; + } + + /** + * Sets enabled. + * + * @param enabled the enabled + */ + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + } + + /** + * The type Polymorphic model converter. + */ + public static class PolymorphicConverter { + + /** + * The Enabled. + */ + private boolean enabled; + + /** + * Is enabled boolean. + * + * @return the boolean + */ + public boolean isEnabled() { + return enabled; + } + + /** + * Sets enabled. + * + * @param enabled the enabled + */ + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + } + + + /** + * The type Pageable converter. + * + * @author bnasslashen + */ + public static class PageableConverter { + + /** + * The Enabled. + */ + private boolean enabled; + + /** + * Is enabled boolean. + * + * @return the boolean + */ + public boolean isEnabled() { + return enabled; + } + + /** + * Sets enabled. + * + * @param enabled the enabled + */ + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + } + } + + /** + * The type Webjars. + * + * @author bnasslahsen + */ + public static class Webjars { + /** + * The Prefix. + */ + private String prefix = Constants.DEFAULT_WEB_JARS_PREFIX_URL; + + /** + * Gets prefix. + * + * @return the prefix + */ + public String getPrefix() { + return prefix; + } + + /** + * Sets prefix. + * + * @param prefix the prefix + */ + public void setPrefix(String prefix) { + this.prefix = prefix; + } + } + + /** + * The type Api docs. + * + * @author bnasslahsen + */ + public static class ApiDocs { + /** + * Path to the generated OpenAPI documentation. For a yaml file, append ".yaml" to the path. + */ + private String path = Constants.DEFAULT_API_DOCS_URL; + + /** + * Whether to generate and serve an OpenAPI document. + */ + private boolean enabled = true; + + /** + * The Resolve schema properties. + */ + private boolean resolveSchemaProperties; + + /** + * The Groups. + */ + private Groups groups = new Groups(); + + /** + * The OpenAPI version. + */ + private OpenApiVersion version; + + /** + * Gets path. + * + * @return the path + */ + public String getPath() { + return path; + } + + /** + * Sets path. + * + * @param path the path + */ + public void setPath(String path) { + this.path = path; + } + + /** + * Is enabled boolean. + * + * @return the boolean + */ + public boolean isEnabled() { + return enabled; + } + + /** + * Sets enabled. + * + * @param enabled the enabled + */ + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + + /** + * Gets groups. + * + * @return the groups + */ + public Groups getGroups() { + return groups; + } + + /** + * Sets groups. + * + * @param groups the groups + */ + public void setGroups(Groups groups) { + this.groups = groups; + } + + /** + * Is resolve schema properties boolean. + * + * @return the boolean + */ + public boolean isResolveSchemaProperties() { + return resolveSchemaProperties; + } + + /** + * Sets resolve schema properties. + * + * @param resolveSchemaProperties the resolve schema properties + */ + public void setResolveSchemaProperties(boolean resolveSchemaProperties) { + this.resolveSchemaProperties = resolveSchemaProperties; + } + + /** + * Gets version. + * + * @return the version + */ + public OpenApiVersion getVersion() { + return version; + } + + /** + * Sets version. + * + * @param version the version + */ + public void setVersion(OpenApiVersion version) { + this.version = version; + } + + /** + * The enum OpenApiVersion. + */ + public enum OpenApiVersion { + /** + * Openapi 3.0.1 version. + */ + OPENAPI_3_0("3.0.1"), + /** + * Openapi 3.1.0 version. + */ + OPENAPI_3_1("3.1.0"); + + /** + * The Open api version. + */ + private final String version; + + /** + * Instantiates a new OpenApiVersion. + * + * @param openApiVersion the open api version + */ + OpenApiVersion(String openApiVersion) { + this.version = openApiVersion; + } + + /** + * Gets open api version. + * + * @return the open api version + */ + public String getVersion() { + return version; + } + } + } + + /** + * The type Groups. + * + * @author bnasslahsen + */ + public static class Groups { + /** + * The Enabled. + */ + private boolean enabled; + + /** + * Is enabled boolean. + * + * @return the boolean + */ + public boolean isEnabled() { + return enabled; + } + + /** + * Sets enabled. + * + * @param enabled the enabled + */ + public void setEnabled(boolean enabled) { + this.enabled = enabled; + } + } + + /** + * The type Cache. + * + * @author bnasslahsen + */ + public static class Cache { + /** + * The Disabled. + */ + private boolean disabled; + + /** + * Is disabled boolean. + * + * @return the boolean + */ + public boolean isDisabled() { + return disabled; + } + + /** + * Sets disabled. + * + * @param disabled the disabled + */ + public void setDisabled(boolean disabled) { + this.disabled = disabled; + } + } + + /** + * The type Group config. + * + * @author bnasslahsen + */ + public static class GroupConfig { + + /** + * The Paths to match. + */ + private List pathsToMatch; + + /** + * The Packages to scan. + */ + private List packagesToScan; + + /** + * The Packages to exclude. + */ + private List packagesToExclude; + + /** + * The Paths to exclude. + */ + private List pathsToExclude; + + /** + * The Group. + */ + private String group; + + /** + * The Produces to match. + */ + private List producesToMatch; + + /** + * The Headers to match. + */ + private List headersToMatch; + + /** + * The Consumes to match. + */ + private List consumesToMatch; + + /** + * The Display name. + */ + private String displayName; + + /** + * Instantiates a new Group config. + */ + public GroupConfig() { + } + + /** + * Instantiates a new Group config. + * + * @param group the group + * @param pathsToMatch the paths to match + * @param packagesToScan the packages to scan + * @param packagesToExclude the packages to exclude + * @param pathsToExclude the paths to exclude + * @param producesToMatch the produces to match + * @param consumesToMatch the consumes to match + * @param headersToMatch the headers to match + * @param displayName the display name + */ + public GroupConfig(String group, List pathsToMatch, List packagesToScan, + List packagesToExclude, List pathsToExclude, + List producesToMatch, List consumesToMatch, List headersToMatch, + String displayName) { + this.pathsToMatch = pathsToMatch; + this.pathsToExclude = pathsToExclude; + this.packagesToExclude = packagesToExclude; + this.packagesToScan = packagesToScan; + this.group = group; + this.producesToMatch = producesToMatch; + this.consumesToMatch = consumesToMatch; + this.headersToMatch = headersToMatch; + this.displayName = displayName; + } + + /** + * Gets headers to match. + * + * @return the headers to match + */ + public List getHeadersToMatch() { + return headersToMatch; + } + + /** + * Sets headers to match. + * + * @param headersToMatch the headers to match + */ + public void setHeadersToMatch(List headersToMatch) { + this.headersToMatch = headersToMatch; + } + + /** + * Gets consumes to match. + * + * @return the consumes to match + */ + public List getConsumesToMatch() { + return consumesToMatch; + } + + /** + * Sets consumes to match. + * + * @param consumesToMatch the consumes to match + */ + public void setConsumesToMatch(List consumesToMatch) { + this.consumesToMatch = consumesToMatch; + } + + /** + * Gets paths to match. + * + * @return the paths to match + */ + public List getPathsToMatch() { + return pathsToMatch; + } + + /** + * Sets paths to match. + * + * @param pathsToMatch the paths to match + */ + public void setPathsToMatch(List pathsToMatch) { + this.pathsToMatch = pathsToMatch; + } + + /** + * Gets packages to scan. + * + * @return the packages to scan + */ + public List getPackagesToScan() { + return packagesToScan; + } + + /** + * Sets packages to scan. + * + * @param packagesToScan the packages to scan + */ + public void setPackagesToScan(List packagesToScan) { + this.packagesToScan = packagesToScan; + } + + /** + * Gets group. + * + * @return the group + */ + public String getGroup() { + return group; + } + + /** + * Sets group. + * + * @param group the group + */ + public void setGroup(String group) { + this.group = group; + } + + /** + * Gets packages to exclude. + * + * @return the packages to exclude + */ + public List getPackagesToExclude() { + return packagesToExclude; + } + + /** + * Sets packages to exclude. + * + * @param packagesToExclude the packages to exclude + */ + public void setPackagesToExclude(List packagesToExclude) { + this.packagesToExclude = packagesToExclude; + } + + /** + * Gets paths to exclude. + * + * @return the paths to exclude + */ + public List getPathsToExclude() { + return pathsToExclude; + } + + /** + * Sets paths to exclude. + * + * @param pathsToExclude the paths to exclude + */ + public void setPathsToExclude(List pathsToExclude) { + this.pathsToExclude = pathsToExclude; + } + + /** + * Gets produces to match. + * + * @return the produces to match + */ + public List getProducesToMatch() { + return producesToMatch; + } + + /** + * Sets produces to match. + * + * @param producesToMatch the produces to match + */ + public void setProducesToMatch(List producesToMatch) { + this.producesToMatch = producesToMatch; + } + + /** + * Gets display name. + * + * @return the display name + */ + public String getDisplayName() { + return displayName; + } + + /** + * Sets display name. + * + * @param displayName the display name + */ + public void setDisplayName(String displayName) { + this.displayName = displayName; + } + } +} diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/SpringDocConfiguration.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/SpringDocConfiguration.java new file mode 100644 index 0000000..7a3e869 --- /dev/null +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/SpringDocConfiguration.java @@ -0,0 +1,64 @@ +package com.github.davidfantasy.mybatisplus.generatorui.common.core.configuration; + +import com.github.davidfantasy.mybatisplus.generatorui.common.ApplicationConfigure; +import com.github.davidfantasy.mybatisplus.generatorui.common.api.Result; +import com.github.davidfantasy.mybatisplus.generatorui.common.api.ResultGenerator; +import com.github.davidfantasy.mybatisplus.generatorui.common.api.ServiceException; +import com.github.davidfantasy.mybatisplus.generatorui.common.core.utils.Constants; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; +import org.springframework.context.annotation.Lazy; +import org.springframework.core.LocalVariableTableParameterNameDiscoverer; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.bind.annotation.RestControllerAdvice; + +@Lazy(false) +@Configuration(proxyBeanMethods = false) +@ConditionalOnProperty(name = Constants.SPRINGDOC_ENABLED, matchIfMissing = true) +@ConditionalOnWebApplication +@Import({ApplicationConfigure.class}) +public class SpringDocConfiguration { + + /** + * The constant BINDRESULT_CLASS. + */ + private static final String BINDRESULT_CLASS = "org.springframework.boot.context.properties.bind.BindResult"; + + /** + * Local spring doc parameter name discoverer local variable table parameter name discoverer. + * + * @return the local variable table parameter name discoverer + */ + @Bean + @Lazy(false) + LocalVariableTableParameterNameDiscoverer localSpringDocParameterNameDiscoverer() { + return new LocalVariableTableParameterNameDiscoverer(); + } + + /** + * The type Open api resource advice. + * + * @author bnasslashen + */ + @RestControllerAdvice + class OpenApiResourceAdvice { + /** + * Handle no handler found response entity. + * + * @param e the e + * @return the response entity + */ + @ExceptionHandler(ServiceException.class) + @ResponseStatus(HttpStatus.NOT_FOUND) + public ResponseEntity handleNoHandlerFound(ServiceException e) { + return ResponseEntity.status(HttpStatus.NOT_FOUND) + .body(ResultGenerator.genFailResult(e.getMessage())); + } + } +} diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/providers/SpringWebProvider.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/providers/SpringWebProvider.java new file mode 100644 index 0000000..47d68b3 --- /dev/null +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/providers/SpringWebProvider.java @@ -0,0 +1,55 @@ +package com.github.davidfantasy.mybatisplus.generatorui.common.core.providers; + +import com.github.davidfantasy.mybatisplus.generatorui.common.core.configuration.SpringDocConfigProperties; +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; + +import java.util.Map; +import java.util.Set; + +/** + * The type Spring web provider. + * + * @author bnasslahsen + */ +public abstract class SpringWebProvider implements ApplicationContextAware { + + /** + * The Application context. + */ + protected ApplicationContext applicationContext; + + /** + * The Handler methods. + */ + protected Map handlerMethods; + + /** + * Gets handler methods. + * + * @return the handler methods + */ + public abstract Map getHandlerMethods(); + + /** + * Find path prefix string. + * + * @param springDocConfigProperties the spring doc config properties + * @return the string + */ + public abstract String findPathPrefix(SpringDocConfigProperties springDocConfigProperties); + + /** + * Gets active patterns. + * + * @param requestMappingInfo the request mapping info + * @return the active patterns + */ + public abstract Set getActivePatterns(Object requestMappingInfo); + + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + this.applicationContext = applicationContext; + } +} diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/Constants.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/Constants.java new file mode 100644 index 0000000..a8c8ba3 --- /dev/null +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/Constants.java @@ -0,0 +1,420 @@ +/* + * + * * + * * * + * * * * + * * * * * Copyright 2019-2022 the original author or authors. + * * * * * + * * * * * Licensed under the Apache License, Version 2.0 (the "License"); + * * * * * you may not use this file except in compliance with the License. + * * * * * You may obtain a copy of the License at + * * * * * + * * * * * https://www.apache.org/licenses/LICENSE-2.0 + * * * * * + * * * * * Unless required by applicable law or agreed to in writing, software + * * * * * distributed under the License is distributed on an "AS IS" BASIS, + * * * * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * * * * See the License for the specific language governing permissions and + * * * * * limitations under the License. + * * * * + * * * + * * + * + */ + +package com.github.davidfantasy.mybatisplus.generatorui.common.core.utils; + +import org.springframework.util.ResourceUtils; + +import static org.springframework.util.AntPathMatcher.DEFAULT_PATH_SEPARATOR; + +/** + * The type Constants. + * @author bnasslahsen + */ +public final class Constants { + + /** + * The constant SPRINGDOC_PREFIX. + */ + public static final String SPRINGDOC_PREFIX = "springdoc"; + + /** + * The constant DEFAULT_API_DOCS_URL. + */ + public static final String DEFAULT_API_DOCS_URL = "/v3/api-docs"; + + /** + * The constant DEFAULT_SERVER_DESCRIPTION. + */ + public static final String DEFAULT_SERVER_DESCRIPTION = "Generated server url"; + + /** + * The constant API_DOCS_URL. + */ + public static final String API_DOCS_URL = "${springdoc.api-docs.path:#{T(com.github.davidfantasy.mybatisplus.generatorui.common.core.utils.Constants).DEFAULT_API_DOCS_URL}}"; + + /** + * The constant SWAGGER_CONFIG_FILE. + */ + public static final String SWAGGER_CONFIG_FILE = "swagger-config"; + + /** + * The constant SWAGGER_CONFIG_URL. + */ + public static final String SWAGGER_CONFIG_URL = API_DOCS_URL + DEFAULT_PATH_SEPARATOR + SWAGGER_CONFIG_FILE; + + /** + * The constant YAML. + */ + public static final String YAML = "yaml"; + + /** + * The constant DOT. + */ + public static final String DOT = "."; + + /** + * The constant DEFAULT_API_DOCS_URL_YAML. + */ + public static final String DEFAULT_API_DOCS_URL_YAML = API_DOCS_URL + DOT + YAML; + + /** + * The constant SPRINGDOC_ENABLED. + */ + public static final String SPRINGDOC_ENABLED = "springdoc.api-docs.enabled"; + + /** + * The constant SPRINGDOC_DEPRECATING_CONVERTER_ENABLED. + */ + public static final String SPRINGDOC_DEPRECATING_CONVERTER_ENABLED = "springdoc.model-converters.deprecating-converter.enabled"; + + /** + * The constant SPRINGDOC_PAGEABLE_CONVERTER_ENABLED. + */ + public static final String SPRINGDOC_PAGEABLE_CONVERTER_ENABLED = "springdoc.model-converters.pageable-converter.enabled"; + + /** + * The constant SPRINGDOC_POLYMORPHIC_CONVERTER_ENABLED. + */ + public static final String SPRINGDOC_POLYMORPHIC_CONVERTER_ENABLED = "springdoc.model-converters.polymorphic-converter.enabled"; + + /** + * The constant SPRINGDOC_SCHEMA_RESOLVE_PROPERTIES. + */ + public static final String SPRINGDOC_SCHEMA_RESOLVE_PROPERTIES = "springdoc.api-docs.resolve-schema-properties"; + + /** + * The constant SPRINGDOC_SHOW_LOGIN_ENDPOINT. + */ + public static final String SPRINGDOC_SHOW_LOGIN_ENDPOINT = "springdoc.show-login-endpoint"; + + /** + * The constant SPRINGDOC_SHOW_OAUTH2_ENDPOINTS. + */ + public static final String SPRINGDOC_SHOW_OAUTH2_ENDPOINTS = "springdoc.show-oauth2-endpoints"; + + /** + * The constant SPRINGDOC_CACHE_DISABLED. + */ + public static final String SPRINGDOC_CACHE_DISABLED = "springdoc.cache.disabled"; + + /** + * The constant SPRINGDOC_SWAGGER_UI_ENABLED. + */ + public static final String SPRINGDOC_SWAGGER_UI_ENABLED = "springdoc.swagger-ui.enabled"; + + /** + * The constant NULL. + */ + public static final String NULL = ":#{null}"; + + /** + * The constant SPRING_MVC_SERVLET_PATH. + */ + public static final String SPRING_MVC_SERVLET_PATH = "spring.mvc.servlet.path"; + + /** + * The constant MVC_SERVLET_PATH. + */ + public static final String MVC_SERVLET_PATH = "${" + SPRING_MVC_SERVLET_PATH + NULL + "}"; + + /** + * The constant SPRINGDOC_SHOW_ACTUATOR. + */ + public static final String SPRINGDOC_SHOW_ACTUATOR = "springdoc.show-actuator"; + + /** + * The constant SPRINGDOC_SHOW_SPRING_CLOUD_FUNCTIONS. + */ + public static final String SPRINGDOC_SHOW_SPRING_CLOUD_FUNCTIONS = "springdoc.show-spring-cloud-functions"; + + /** + * The constant SPRINGDOC_ACTUATOR_TAG. + */ + public static final String SPRINGDOC_ACTUATOR_TAG = "Actuator"; + + /** + * The constant SPRINGDOC_ACTUATOR_DESCRIPTION. + */ + public static final String SPRINGDOC_ACTUATOR_DESCRIPTION = "Monitor and interact"; + + /** + * The constant SPRINGDOC_ACTUATOR_DOC_URL. + */ + public static final String SPRINGDOC_ACTUATOR_DOC_URL = "https://docs.spring.io/spring-boot/docs/current/actuator-api/html/"; + + /** + * The constant SPRINGDOC_ACTUATOR_DOC_DESCRIPTION. + */ + public static final String SPRINGDOC_ACTUATOR_DOC_DESCRIPTION = "Spring Boot Actuator Web API Documentation"; + + /** + * The constant DEFAULT_WEB_JARS_PREFIX_URL. + */ + public static final String DEFAULT_WEB_JARS_PREFIX_URL = "/webjars"; + + /** + * The constant CLASSPATH_RESOURCE_LOCATION. + */ + public static final String CLASSPATH_RESOURCE_LOCATION = ResourceUtils.CLASSPATH_URL_PREFIX + "/META-INF/resources"; + + + /** + * The constant SWAGGER_UI_PREFIX. + */ + public static final String SWAGGER_UI_PREFIX = "/swagger-ui"; + + /** + * The constant INDEX_PAGE. + */ + public static final String INDEX_PAGE = "/index.html"; + + /** + * The constant SWAGGER_UI_URL. + */ + public static final String SWAGGER_UI_URL = SWAGGER_UI_PREFIX + INDEX_PAGE; + + /** + * The constant SWAGGER_INITIALIZER_JS. + */ + public static final String SWAGGER_INITIALIZER_JS = "swagger-initializer.js"; + + /** + * The constant SWAGGER_INITIALIZER_URL. + */ + public static final String SWAGGER_INITIALIZER_URL = SWAGGER_UI_PREFIX + "/" + SWAGGER_INITIALIZER_JS; + + /** + * the constant OAUTH_REDIRECT_PAGE. + */ + public static final String OAUTH_REDIRECT_PAGE = "/oauth2-redirect.html"; + + /** + * The constant SWAGGER_UI_OAUTH_REDIRECT_URL. + */ + public static final String SWAGGER_UI_OAUTH_REDIRECT_URL = SWAGGER_UI_PREFIX + OAUTH_REDIRECT_PAGE; + + /** + * The constant APPLICATION_OPENAPI_YAML. + */ + public static final String APPLICATION_OPENAPI_YAML = "application/vnd.oai.openapi"; + + /** + * The constant DEFAULT_SWAGGER_UI_PATH. + */ + public static final String DEFAULT_SWAGGER_UI_PATH = DEFAULT_PATH_SEPARATOR + "swagger-ui.html"; + + /** + * The constant SWAGGER_UI_PATH. + */ + public static final String SWAGGER_UI_PATH = "${springdoc.swagger-ui.path:#{T(com.github.davidfantasy.mybatisplus.generatorui.common.core.utils.Constants).DEFAULT_SWAGGER_UI_PATH}}"; + + /** + * The constant DEFAULT_GROUP_NAME. + */ + public static final String DEFAULT_GROUP_NAME = "springdocDefault"; + + /** + * The constant GROUP_CONFIG_FIRST_PROPERTY. + */ + public static final String GROUP_CONFIG_FIRST_PROPERTY = "springdoc.group-configs[0].group"; + + /** + * The constant GROUP_NAME_NOT_NULL. + */ + public static final String GROUP_NAME_NOT_NULL_OR_EMPTY = "Group name can not be null or empty"; + + /** + * The constant GET_METHOD. + */ + public static final String GET_METHOD = "get"; + + /** + * The constant POST_METHOD. + */ + public static final String POST_METHOD = "post"; + + /** + * The constant PUT_METHOD. + */ + public static final String PUT_METHOD = "put"; + + /** + * The constant DELETE_METHOD. + */ + public static final String DELETE_METHOD = "delete"; + + /** + * The constant PATCH_METHOD. + */ + public static final String PATCH_METHOD = "patch"; + + /** + * The constant TRACE_METHOD. + */ + public static final String TRACE_METHOD = "trace"; + + /** + * The constant HEAD_METHOD. + */ + public static final String HEAD_METHOD = "head"; + + /** + * The constant OPTIONS_METHOD. + */ + public static final String OPTIONS_METHOD = "options"; + + /** + * The constant QUERY_PARAM. + */ + public static final String QUERY_PARAM = "query"; + + /** + * The constant DEFAULT_DESCRIPTION. + */ + public static final String DEFAULT_DESCRIPTION = "default response"; + + /** + * The constant DEFAULT_TITLE. + */ + public static final String DEFAULT_TITLE = "OpenAPI definition"; + + /** + * The constant DEFAULT_VERSION. + */ + public static final String DEFAULT_VERSION = "v0"; + + /** + * The constant OPENAPI_STRING_TYPE. + */ + public static final String OPENAPI_STRING_TYPE = "string"; + + /** + * The constant OPENAPI_ARRAY_TYPE. + */ + public static final String OPENAPI_ARRAY_TYPE = "array"; + + /** + * The constant GRACEFUL_EXCEPTION_OCCURRED. + */ + public static final String GRACEFUL_EXCEPTION_OCCURRED = "Graceful exception occurred"; + + /** + * The constant SWAGGER_UI_DEFAULT_URL. + */ + public static final String SWAGGER_UI_DEFAULT_URL = "https://petstore.swagger.io/v2/swagger.json"; + + /** + * The constant CSRF_DEFAULT_COOKIE_NAME. + */ + public static final String CSRF_DEFAULT_COOKIE_NAME = "XSRF-TOKEN"; + + /** + * The constant CSRF_DEFAULT_LOCAL_STORAGE_KEY + */ + public static final String CSRF_DEFAULT_LOCAL_STORAGE_KEY = "XSRF-TOKEN"; + + /** + * The constant CSRF_DEFAULT_HEADER_NAME. + */ + public static final String CSRF_DEFAULT_HEADER_NAME = "X-XSRF-TOKEN"; + + /** + * The constant OPERATION_ATTRIBUTE. + */ + public static final String OPERATION_ATTRIBUTE = Constants.class.getName() + ".operation"; + + /** + * The constant MANAGEMENT_ENDPOINTS_WEB. + */ + public static final String MANAGEMENT_ENDPOINTS_WEB = "management.endpoints.web"; + + /** + * The constant ALL_PATTERN. + */ + public static final String ALL_PATTERN = "/**"; + + /** + * The constant HEALTH_PATTERN. + */ + public static final String HEALTH_PATTERN = "/health/*"; + + /** + * The constant SPRINGDOC_USE_MANAGEMENT_PORT. + */ + public static final String SPRINGDOC_USE_MANAGEMENT_PORT = "springdoc.use-management-port"; + + + /** + * The constant SPRINGDOC_ENABLE_DEFAULT_API_DOCS. + */ + public static final String SPRINGDOC_ENABLE_DEFAULT_API_DOCS = "springdoc.enable-default-api-docs"; + + /** + * The constant SPRINGDOC_USE_ROOT_PATH. + */ + public static final String SPRINGDOC_USE_ROOT_PATH = "springdoc.swagger-ui.use-root-path"; + + /** + * The constant DEFAULT_SWAGGER_UI_ACTUATOR_PATH. + */ + public static final String DEFAULT_SWAGGER_UI_ACTUATOR_PATH = "swagger-ui"; + + /** + * The constant DEFAULT_API_DOCS_ACTUATOR_URL. + */ + public static final String DEFAULT_API_DOCS_ACTUATOR_URL = "openapi"; + + /** + * The constant DEFAULT_YAML_API_DOCS_ACTUATOR_PATH. + */ + public static final String DEFAULT_YAML_API_DOCS_ACTUATOR_PATH = DEFAULT_PATH_SEPARATOR + YAML; + + /** + * The constant ACTUATOR_DEFAULT_GROUP. + */ + public static final String ACTUATOR_DEFAULT_GROUP = "x-actuator"; + + /** + * The constant LINKS_SCHEMA_CUSTOMISER. + */ + public static final String LINKS_SCHEMA_CUSTOMISER = "linksSchemaCustomizer"; + + /** + * The constant SPRINGDOC_SORT_CONVERTER_ENABLED. + */ + public static final String SPRINGDOC_SORT_CONVERTER_ENABLED = "springdoc.sort-converter.enabled"; + + /** + * The constant SPRINGDOC_NULLABLE_REQUEST_PARAMETER_ENABLED. + */ + public static final String SPRINGDOC_NULLABLE_REQUEST_PARAMETER_ENABLED = "springdoc.nullable-request-parameter-enabled"; + /** + * Instantiates a new Constants. + */ + private Constants() { + super(); + } + +} diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/JsonUtil.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/JsonUtil.java new file mode 100644 index 0000000..d574595 --- /dev/null +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/JsonUtil.java @@ -0,0 +1,64 @@ +package com.github.davidfantasy.mybatisplus.generatorui.common.core.utils; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.fasterxml.jackson.core.type.TypeReference; +import com.fasterxml.jackson.databind.JsonNode; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.google.common.base.Strings; + +import java.io.IOException; + +public class JsonUtil { + + private static ObjectMapper mapper = new ObjectMapper(); + + public static String obj2json(Object obj) { + try { + return mapper.writeValueAsString(obj); + } catch (JsonProcessingException e) { + throw new IllegalArgumentException("将对象转换为JSON时发生错误!", e); + } + } + + public static T json2obj(String jsonStr, Class clazz) { + try { + return mapper.readValue(jsonStr, clazz); + } catch (IOException e) { + throw new IllegalArgumentException("将JSON转换为对象时发生错误:" + jsonStr, e); + } + } + + public static T json2obj(String jsonStr, TypeReference clazzType) { + try { + return mapper.readValue(jsonStr, clazzType); + } catch (IOException e) { + throw new IllegalArgumentException("将JSON转换为对象时发生错误:" + jsonStr, e); + } + } + + public static T json2obj(String content, String path, Class clazz) throws IOException { + if (!Strings.isNullOrEmpty(path)) { + JsonNode node = mapper.readTree(content); + String[] pathes = path.split("\\."); + for (String p : pathes) { + node = node.get(p); + } + content = node.toString(); + } + return json2obj(content, clazz); + } + + public static T json2obj(String content, String path, TypeReference clazzType) throws IOException { + if (!Strings.isNullOrEmpty(path)) { + JsonNode node = mapper.readTree(content); + String[] pathes = path.split("\\."); + for (String p : pathes) { + node = node.get(p); + } + content = node.toString(); + } + return json2obj(content, clazzType); + } + + +} diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/OSUtil.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/OSUtil.java new file mode 100644 index 0000000..43e82a7 --- /dev/null +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/OSUtil.java @@ -0,0 +1,24 @@ +package com.github.davidfantasy.mybatisplus.generatorui.common.core.utils; + +public class OSUtil { + + private static final String OS = System.getProperty("os.name").toLowerCase(); + + public static boolean isLinux() { + return OS.contains("linux"); + } + + public static boolean isMacOS() { + return OS.contains("mac") && OS.contains("os") && OS.contains("x"); + } + + public static boolean isMacOSX() { + return OS.contains("mac") && OS.contains("os") && OS.contains("x"); + } + + public static boolean isWindows() { + return OS.contains("windows"); + } + + +} \ No newline at end of file diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/PathUtil.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/PathUtil.java new file mode 100644 index 0000000..75029cb --- /dev/null +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/PathUtil.java @@ -0,0 +1,41 @@ +package com.github.davidfantasy.mybatisplus.generatorui.common.core.utils; + +import com.google.common.base.Strings; + +import java.io.File; + +public class PathUtil { + + public static String joinPath(String... paths) { + StringBuilder tmp = new StringBuilder(); + for (String path : paths) { + if (!Strings.isNullOrEmpty(path)) { + tmp.append(path); + tmp.append(File.separator); + } + } + return tmp.deleteCharAt(tmp.lastIndexOf(File.separator)).toString(); + } + + public static String joinPackage(String... packages) { + StringBuilder tmp = new StringBuilder(); + for (String aPackage : packages) { + if (!Strings.isNullOrEmpty(aPackage)) { + tmp.append(aPackage); + tmp.append("."); + } + } + return tmp.deleteCharAt(tmp.lastIndexOf(".")).toString(); + } + + public static String getShortNameFromFullRef(String ref) { + if (Strings.isNullOrEmpty(ref)) { + return ""; + } + if (ref.indexOf(".") == -1) { + return ref; + } + return ref.substring(ref.lastIndexOf(".")+1, ref.length()); + } + +} diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/SpringDocUtils.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/SpringDocUtils.java new file mode 100644 index 0000000..6b03dad --- /dev/null +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/SpringDocUtils.java @@ -0,0 +1,58 @@ +/* + * + * * + * * * + * * * * + * * * * * Copyright 2019-2022 the original author or authors. + * * * * * + * * * * * Licensed under the Apache License, Version 2.0 (the "License"); + * * * * * you may not use this file except in compliance with the License. + * * * * * You may obtain a copy of the License at + * * * * * + * * * * * https://www.apache.org/licenses/LICENSE-2.0 + * * * * * + * * * * * Unless required by applicable law or agreed to in writing, software + * * * * * distributed under the License is distributed on an "AS IS" BASIS, + * * * * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * * * * See the License for the specific language governing permissions and + * * * * * limitations under the License. + * * * * + * * * + * * + * + */ + +package com.github.davidfantasy.mybatisplus.generatorui.common.core.utils; + + +import cn.hutool.core.util.StrUtil; + +/** + * The type Spring doc utils. + * + * @author bnasslahsen + */ +public class SpringDocUtils { + + /** + * The constant springDocConfig. + */ + private static final SpringDocUtils springDocConfig = new SpringDocUtils(); + + + /** + * Is valid path boolean. + * + * @param path the path + * @return the boolean + */ + public static boolean isValidPath(String path) { + if (StrUtil.isNotBlank(path) && !path.equals("/")) { + return true; + } + return false; + } + + +} + diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dbquery/DbQueryHolder.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dbquery/DbQueryHolder.java similarity index 93% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dbquery/DbQueryHolder.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dbquery/DbQueryHolder.java index 9566f99..72f736a 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dbquery/DbQueryHolder.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dbquery/DbQueryHolder.java @@ -1,4 +1,4 @@ -package com.github.davidfantasy.mybatisplus.generatorui.dbquery; +package com.github.davidfantasy.mybatisplus.generatorui.common.dbquery; import com.baomidou.mybatisplus.annotation.DbType; import com.baomidou.mybatisplus.generator.config.DataSourceConfig; diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dbquery/SqlServerQuery.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dbquery/SqlServerQuery.java similarity index 90% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dbquery/SqlServerQuery.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dbquery/SqlServerQuery.java index 5f0be8b..8a15ad4 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dbquery/SqlServerQuery.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dbquery/SqlServerQuery.java @@ -1,4 +1,4 @@ -package com.github.davidfantasy.mybatisplus.generatorui.dbquery; +package com.github.davidfantasy.mybatisplus.generatorui.common.dbquery; public class SqlServerQuery extends com.baomidou.mybatisplus.generator.config.querys.SqlServerQuery { diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dto/Constant.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/Constant.java similarity index 93% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dto/Constant.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/Constant.java index dc62634..98d8c95 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dto/Constant.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/Constant.java @@ -1,4 +1,4 @@ -package com.github.davidfantasy.mybatisplus.generatorui.dto; +package com.github.davidfantasy.mybatisplus.generatorui.common.dto; public class Constant { diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dto/DtoFieldInfo.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/DtoFieldInfo.java similarity index 94% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dto/DtoFieldInfo.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/DtoFieldInfo.java index 37e1a35..b2c80eb 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dto/DtoFieldInfo.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/DtoFieldInfo.java @@ -1,4 +1,4 @@ -package com.github.davidfantasy.mybatisplus.generatorui.dto; +package com.github.davidfantasy.mybatisplus.generatorui.common.dto; import cn.hutool.core.util.StrUtil; import com.github.javaparser.ast.NodeList; diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/ElementPosition.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/ElementPosition.java new file mode 100644 index 0000000..36b0dde --- /dev/null +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/ElementPosition.java @@ -0,0 +1,5 @@ +package com.github.davidfantasy.mybatisplus.generatorui.common.dto; + +public enum ElementPosition { + FIRST, LAST +} diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dto/GenDtoConfig.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/GenDtoConfig.java similarity index 97% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dto/GenDtoConfig.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/GenDtoConfig.java index 41ffc56..0b96fb3 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dto/GenDtoConfig.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/GenDtoConfig.java @@ -1,4 +1,4 @@ -package com.github.davidfantasy.mybatisplus.generatorui.dto; +package com.github.davidfantasy.mybatisplus.generatorui.common.dto; import com.fasterxml.jackson.annotation.JsonIgnore; import com.google.common.base.Strings; diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dto/GenDtoFromSqlReq.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/GenDtoFromSqlReq.java similarity index 67% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dto/GenDtoFromSqlReq.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/GenDtoFromSqlReq.java index 5778546..2009d05 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dto/GenDtoFromSqlReq.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/GenDtoFromSqlReq.java @@ -1,4 +1,4 @@ -package com.github.davidfantasy.mybatisplus.generatorui.dto; +package com.github.davidfantasy.mybatisplus.generatorui.common.dto; import lombok.Data; diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dto/GenSetting.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/GenSetting.java similarity index 91% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dto/GenSetting.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/GenSetting.java index 9a5359d..01eaec4 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dto/GenSetting.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/GenSetting.java @@ -1,4 +1,4 @@ -package com.github.davidfantasy.mybatisplus.generatorui.dto; +package com.github.davidfantasy.mybatisplus.generatorui.common.dto; import lombok.Data; diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dto/JavaClassMethodInfo.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/JavaClassMethodInfo.java similarity index 83% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dto/JavaClassMethodInfo.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/JavaClassMethodInfo.java index 7a5db79..10e4a18 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dto/JavaClassMethodInfo.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/JavaClassMethodInfo.java @@ -1,4 +1,4 @@ -package com.github.davidfantasy.mybatisplus.generatorui.dto; +package com.github.davidfantasy.mybatisplus.generatorui.common.dto; import lombok.Builder; import lombok.Data; diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dto/MapperElement.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/MapperElement.java similarity index 78% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dto/MapperElement.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/MapperElement.java index df02c21..be92d2b 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dto/MapperElement.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/MapperElement.java @@ -1,4 +1,4 @@ -package com.github.davidfantasy.mybatisplus.generatorui.dto; +package com.github.davidfantasy.mybatisplus.generatorui.common.dto; import lombok.Builder; import lombok.Data; diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dto/MpgGenCodeDto.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/MpgGenCodeDto.java similarity index 69% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dto/MpgGenCodeDto.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/MpgGenCodeDto.java index e93f961..b804291 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dto/MpgGenCodeDto.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/MpgGenCodeDto.java @@ -1,4 +1,4 @@ -package com.github.davidfantasy.mybatisplus.generatorui.dto; +package com.github.davidfantasy.mybatisplus.generatorui.common.dto; import lombok.Data; diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dto/OutputFileInfo.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/OutputFileInfo.java similarity index 91% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dto/OutputFileInfo.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/OutputFileInfo.java index 3b524f1..bad111f 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dto/OutputFileInfo.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/OutputFileInfo.java @@ -1,12 +1,11 @@ -package com.github.davidfantasy.mybatisplus.generatorui.dto; +package com.github.davidfantasy.mybatisplus.generatorui.common.dto; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.github.davidfantasy.mybatisplus.generatorui.common.ServiceException; import com.google.common.base.Strings; import lombok.Data; -import static com.github.davidfantasy.mybatisplus.generatorui.dto.Constant.*; +import static com.github.davidfantasy.mybatisplus.generatorui.common.dto.Constant.*; @Data @JsonIgnoreProperties(ignoreUnknown = true) diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dto/TableInfo.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/TableInfo.java similarity index 62% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dto/TableInfo.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/TableInfo.java index de978a0..dba50db 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dto/TableInfo.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/TableInfo.java @@ -1,4 +1,4 @@ -package com.github.davidfantasy.mybatisplus.generatorui.dto; +package com.github.davidfantasy.mybatisplus.generatorui.common.dto; import lombok.Data; diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dto/UserConfig.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/UserConfig.java similarity index 94% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dto/UserConfig.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/UserConfig.java index c2a86e5..66a8c0f 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dto/UserConfig.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/UserConfig.java @@ -1,14 +1,14 @@ -package com.github.davidfantasy.mybatisplus.generatorui.dto; +package com.github.davidfantasy.mybatisplus.generatorui.common.dto; import com.fasterxml.jackson.annotation.JsonIgnore; import com.fasterxml.jackson.annotation.JsonIgnoreProperties; -import com.github.davidfantasy.mybatisplus.generatorui.strategy.*; +import com.github.davidfantasy.mybatisplus.generatorui.common.strategy.*; import com.google.common.base.Strings; import lombok.Data; import java.util.List; -import static com.github.davidfantasy.mybatisplus.generatorui.dto.Constant.*; +import static com.github.davidfantasy.mybatisplus.generatorui.common.dto.Constant.*; @Data @JsonIgnoreProperties(ignoreUnknown = true) diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/mbp/BeetlTemplateEngine.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/mbp/BeetlTemplateEngine.java similarity index 94% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/mbp/BeetlTemplateEngine.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/mbp/BeetlTemplateEngine.java index 9cf57f6..026cf9d 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/mbp/BeetlTemplateEngine.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/mbp/BeetlTemplateEngine.java @@ -1,4 +1,4 @@ -package com.github.davidfantasy.mybatisplus.generatorui.mbp; +package com.github.davidfantasy.mybatisplus.generatorui.common.mbp; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.generator.config.OutputFile; @@ -22,8 +22,8 @@ import java.util.List; import java.util.Map; -import static com.github.davidfantasy.mybatisplus.generatorui.dto.Constant.RESOURCE_PREFIX_CLASSPATH; -import static com.github.davidfantasy.mybatisplus.generatorui.dto.Constant.RESOURCE_PREFIX_FILE; +import static com.github.davidfantasy.mybatisplus.generatorui.common.dto.Constant.RESOURCE_PREFIX_CLASSPATH; +import static com.github.davidfantasy.mybatisplus.generatorui.common.dto.Constant.RESOURCE_PREFIX_FILE; /** * 对原模板引擎进行改造,使其支持file和classpath两类加载模式 diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/mbp/MbpGenerator.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/mbp/MbpGenerator.java similarity index 94% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/mbp/MbpGenerator.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/mbp/MbpGenerator.java index cabf551..f489a1e 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/mbp/MbpGenerator.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/mbp/MbpGenerator.java @@ -1,4 +1,4 @@ -package com.github.davidfantasy.mybatisplus.generatorui.mbp; +package com.github.davidfantasy.mybatisplus.generatorui.common.mbp; import cn.hutool.core.io.FileUtil; import cn.hutool.core.util.StrUtil; @@ -10,16 +10,16 @@ import com.baomidou.mybatisplus.generator.config.po.TableField; import com.baomidou.mybatisplus.generator.config.po.TableInfo; import com.baomidou.mybatisplus.generator.fill.Column; -import com.github.davidfantasy.mybatisplus.generatorui.GeneratorConfig; -import com.github.davidfantasy.mybatisplus.generatorui.ProjectPathResolver; -import com.github.davidfantasy.mybatisplus.generatorui.common.ServiceException; -import com.github.davidfantasy.mybatisplus.generatorui.dto.Constant; -import com.github.davidfantasy.mybatisplus.generatorui.dto.GenSetting; -import com.github.davidfantasy.mybatisplus.generatorui.dto.OutputFileInfo; -import com.github.davidfantasy.mybatisplus.generatorui.dto.UserConfig; -import com.github.davidfantasy.mybatisplus.generatorui.service.UserConfigStore; -import com.github.davidfantasy.mybatisplus.generatorui.strategy.*; -import com.github.davidfantasy.mybatisplus.generatorui.util.PathUtil; +import com.github.davidfantasy.mybatisplus.generatorui.common.GeneratorConfig; +import com.github.davidfantasy.mybatisplus.generatorui.common.ProjectPathResolver; +import com.github.davidfantasy.mybatisplus.generatorui.common.api.ServiceException; +import com.github.davidfantasy.mybatisplus.generatorui.common.dto.Constant; +import com.github.davidfantasy.mybatisplus.generatorui.common.dto.GenSetting; +import com.github.davidfantasy.mybatisplus.generatorui.common.dto.OutputFileInfo; +import com.github.davidfantasy.mybatisplus.generatorui.common.dto.UserConfig; +import com.github.davidfantasy.mybatisplus.generatorui.common.service.UserConfigStore; +import com.github.davidfantasy.mybatisplus.generatorui.common.strategy.*; +import com.github.davidfantasy.mybatisplus.generatorui.common.util.PathUtil; import com.google.common.collect.Maps; import lombok.AllArgsConstructor; import lombok.extern.slf4j.Slf4j; diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/mbp/NameConverter.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/mbp/NameConverter.java similarity index 88% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/mbp/NameConverter.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/mbp/NameConverter.java index b943a52..625c323 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/mbp/NameConverter.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/mbp/NameConverter.java @@ -1,11 +1,11 @@ -package com.github.davidfantasy.mybatisplus.generatorui.mbp; +package com.github.davidfantasy.mybatisplus.generatorui.common.mbp; import cn.hutool.core.util.StrUtil; -import com.github.davidfantasy.mybatisplus.generatorui.dto.Constant; +import com.github.davidfantasy.mybatisplus.generatorui.common.dto.Constant; import com.google.common.base.Strings; -import static com.github.davidfantasy.mybatisplus.generatorui.dto.Constant.DOT_JAVA; -import static com.github.davidfantasy.mybatisplus.generatorui.dto.Constant.DOT_XML; +import static com.github.davidfantasy.mybatisplus.generatorui.common.dto.Constant.DOT_JAVA; +import static com.github.davidfantasy.mybatisplus.generatorui.common.dto.Constant.DOT_XML; /** * 自定义各类名称转换的规则 diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/mbp/TemplateVaribleInjecter.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/mbp/TemplateVaribleInjecter.java similarity index 75% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/mbp/TemplateVaribleInjecter.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/mbp/TemplateVaribleInjecter.java index bb07045..3114155 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/mbp/TemplateVaribleInjecter.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/mbp/TemplateVaribleInjecter.java @@ -1,4 +1,4 @@ -package com.github.davidfantasy.mybatisplus.generatorui.mbp; +package com.github.davidfantasy.mybatisplus.generatorui.common.mbp; import com.baomidou.mybatisplus.generator.config.po.TableInfo; diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/service/AutoCompleteService.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/service/AutoCompleteService.java similarity index 87% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/service/AutoCompleteService.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/service/AutoCompleteService.java index 034bd1a..8926010 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/service/AutoCompleteService.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/service/AutoCompleteService.java @@ -1,8 +1,8 @@ -package com.github.davidfantasy.mybatisplus.generatorui.service; +package com.github.davidfantasy.mybatisplus.generatorui.common.service; import cn.hutool.core.io.FileUtil; -import com.github.davidfantasy.mybatisplus.generatorui.ProjectPathResolver; -import com.github.davidfantasy.mybatisplus.generatorui.common.ServiceException; +import com.github.davidfantasy.mybatisplus.generatorui.common.ProjectPathResolver; +import com.github.davidfantasy.mybatisplus.generatorui.common.api.ServiceException; import com.google.common.base.Strings; import com.google.common.collect.Sets; import org.springframework.beans.factory.annotation.Autowired; @@ -11,7 +11,7 @@ import java.io.File; import java.util.Set; -import static com.github.davidfantasy.mybatisplus.generatorui.dto.Constant.*; +import static com.github.davidfantasy.mybatisplus.generatorui.common.dto.Constant.*; @Service public class AutoCompleteService { diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/service/DatabaseService.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/service/DatabaseService.java similarity index 91% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/service/DatabaseService.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/service/DatabaseService.java index d30eb49..4115f6c 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/service/DatabaseService.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/service/DatabaseService.java @@ -1,10 +1,10 @@ -package com.github.davidfantasy.mybatisplus.generatorui.service; +package com.github.davidfantasy.mybatisplus.generatorui.common.service; import com.baomidou.mybatisplus.annotation.DbType; import com.baomidou.mybatisplus.generator.config.DataSourceConfig; import com.baomidou.mybatisplus.generator.config.IDbQuery; -import com.github.davidfantasy.mybatisplus.generatorui.dbquery.DbQueryHolder; -import com.github.davidfantasy.mybatisplus.generatorui.dto.TableInfo; +import com.github.davidfantasy.mybatisplus.generatorui.common.dbquery.DbQueryHolder; +import com.github.davidfantasy.mybatisplus.generatorui.common.dto.TableInfo; import com.google.common.collect.Lists; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/service/JavaClassParser.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/service/JavaClassParser.java similarity index 83% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/service/JavaClassParser.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/service/JavaClassParser.java index 75db5d5..2f97b84 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/service/JavaClassParser.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/service/JavaClassParser.java @@ -1,12 +1,12 @@ -package com.github.davidfantasy.mybatisplus.generatorui.service; +package com.github.davidfantasy.mybatisplus.generatorui.common.service; import cn.hutool.core.io.FileUtil; import cn.hutool.core.io.IoUtil; import cn.hutool.core.util.StrUtil; -import com.github.davidfantasy.mybatisplus.generatorui.ProjectPathResolver; -import com.github.davidfantasy.mybatisplus.generatorui.dto.DtoFieldInfo; -import com.github.davidfantasy.mybatisplus.generatorui.dto.JavaClassMethodInfo; -import com.github.davidfantasy.mybatisplus.generatorui.util.PathUtil; +import com.github.davidfantasy.mybatisplus.generatorui.common.ProjectPathResolver; +import com.github.davidfantasy.mybatisplus.generatorui.common.dto.DtoFieldInfo; +import com.github.davidfantasy.mybatisplus.generatorui.common.dto.JavaClassMethodInfo; +import com.github.davidfantasy.mybatisplus.generatorui.common.util.PathUtil; import com.github.javaparser.JavaParser; import com.github.javaparser.ParseResult; import com.github.javaparser.ast.CompilationUnit; @@ -26,7 +26,7 @@ import java.io.FileInputStream; -import static com.github.davidfantasy.mybatisplus.generatorui.dto.Constant.DOT_JAVA; +import static com.github.davidfantasy.mybatisplus.generatorui.common.dto.Constant.DOT_JAVA; @Service public class JavaClassParser { diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/service/MapperXmlParser.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/service/MapperXmlParser.java similarity index 91% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/service/MapperXmlParser.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/service/MapperXmlParser.java index 0b7cdb7..3b0cc03 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/service/MapperXmlParser.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/service/MapperXmlParser.java @@ -1,8 +1,8 @@ -package com.github.davidfantasy.mybatisplus.generatorui.service; +package com.github.davidfantasy.mybatisplus.generatorui.common.service; -import com.github.davidfantasy.mybatisplus.generatorui.common.ServiceException; -import com.github.davidfantasy.mybatisplus.generatorui.dto.ElementPosition; -import com.github.davidfantasy.mybatisplus.generatorui.dto.MapperElement; +import com.github.davidfantasy.mybatisplus.generatorui.common.api.ServiceException; +import com.github.davidfantasy.mybatisplus.generatorui.common.dto.ElementPosition; +import com.github.davidfantasy.mybatisplus.generatorui.common.dto.MapperElement; import com.google.common.base.Strings; import com.google.common.collect.Lists; import org.dom4j.*; diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/service/OutputFileInfoService.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/service/OutputFileInfoService.java similarity index 84% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/service/OutputFileInfoService.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/service/OutputFileInfoService.java index 62a9914..58aee0a 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/service/OutputFileInfoService.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/service/OutputFileInfoService.java @@ -1,11 +1,11 @@ -package com.github.davidfantasy.mybatisplus.generatorui.service; - -import com.github.davidfantasy.mybatisplus.generatorui.ProjectPathResolver; -import com.github.davidfantasy.mybatisplus.generatorui.common.ServiceException; -import com.github.davidfantasy.mybatisplus.generatorui.dto.OutputFileInfo; -import com.github.davidfantasy.mybatisplus.generatorui.dto.UserConfig; -import com.github.davidfantasy.mybatisplus.generatorui.strategy.*; -import com.github.davidfantasy.mybatisplus.generatorui.util.TemplateUtil; +package com.github.davidfantasy.mybatisplus.generatorui.common.service; + +import com.github.davidfantasy.mybatisplus.generatorui.common.ProjectPathResolver; +import com.github.davidfantasy.mybatisplus.generatorui.common.api.ServiceException; +import com.github.davidfantasy.mybatisplus.generatorui.common.dto.OutputFileInfo; +import com.github.davidfantasy.mybatisplus.generatorui.common.dto.UserConfig; +import com.github.davidfantasy.mybatisplus.generatorui.common.strategy.*; +import com.github.davidfantasy.mybatisplus.generatorui.common.util.TemplateUtil; import com.google.common.collect.Lists; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -14,7 +14,7 @@ import java.util.Collections; import java.util.List; -import static com.github.davidfantasy.mybatisplus.generatorui.dto.Constant.*; +import static com.github.davidfantasy.mybatisplus.generatorui.common.dto.Constant.*; @Service public class OutputFileInfoService { diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/service/SqlGeneratorService.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/service/SqlGeneratorService.java similarity index 94% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/service/SqlGeneratorService.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/service/SqlGeneratorService.java index 0f588bb..07a46e6 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/service/SqlGeneratorService.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/service/SqlGeneratorService.java @@ -1,4 +1,4 @@ -package com.github.davidfantasy.mybatisplus.generatorui.service; +package com.github.davidfantasy.mybatisplus.generatorui.common.service; import cn.hutool.core.date.DateUtil; import com.baomidou.mybatisplus.generator.config.DataSourceConfig; @@ -6,14 +6,14 @@ import com.baomidou.mybatisplus.generator.config.rules.DateType; import com.baomidou.mybatisplus.generator.config.rules.DbColumnType; import com.baomidou.mybatisplus.generator.config.rules.IColumnType; -import com.github.davidfantasy.mybatisplus.generatorui.GeneratorConfig; -import com.github.davidfantasy.mybatisplus.generatorui.ProjectPathResolver; -import com.github.davidfantasy.mybatisplus.generatorui.common.ServiceException; -import com.github.davidfantasy.mybatisplus.generatorui.dto.*; -import com.github.davidfantasy.mybatisplus.generatorui.mbp.BeetlTemplateEngine; -import com.github.davidfantasy.mybatisplus.generatorui.sqlparser.ConditionExpr; -import com.github.davidfantasy.mybatisplus.generatorui.sqlparser.DynamicParamSqlEnhancer; -import com.github.davidfantasy.mybatisplus.generatorui.util.PathUtil; +import com.github.davidfantasy.mybatisplus.generatorui.common.GeneratorConfig; +import com.github.davidfantasy.mybatisplus.generatorui.common.ProjectPathResolver; +import com.github.davidfantasy.mybatisplus.generatorui.common.api.ServiceException; +import com.github.davidfantasy.mybatisplus.generatorui.common.dto.*; +import com.github.davidfantasy.mybatisplus.generatorui.common.mbp.BeetlTemplateEngine; +import com.github.davidfantasy.mybatisplus.generatorui.common.sqlparser.ConditionExpr; +import com.github.davidfantasy.mybatisplus.generatorui.common.sqlparser.DynamicParamSqlEnhancer; +import com.github.davidfantasy.mybatisplus.generatorui.common.util.PathUtil; import com.github.javaparser.ast.NodeList; import com.github.javaparser.ast.expr.AnnotationExpr; import com.github.javaparser.ast.expr.Name; @@ -36,8 +36,8 @@ import java.nio.charset.StandardCharsets; import java.util.*; -import static com.github.davidfantasy.mybatisplus.generatorui.dto.Constant.DOT_JAVA; -import static com.github.davidfantasy.mybatisplus.generatorui.dto.Constant.DOT_XML; +import static com.github.davidfantasy.mybatisplus.generatorui.common.dto.Constant.DOT_JAVA; +import static com.github.davidfantasy.mybatisplus.generatorui.common.dto.Constant.DOT_XML; @Service diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/service/UserConfigStore.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/service/UserConfigStore.java similarity index 90% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/service/UserConfigStore.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/service/UserConfigStore.java index 3cd8a4a..eda154f 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/service/UserConfigStore.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/service/UserConfigStore.java @@ -1,15 +1,15 @@ -package com.github.davidfantasy.mybatisplus.generatorui.service; +package com.github.davidfantasy.mybatisplus.generatorui.common.service; import cn.hutool.core.date.DateUtil; import cn.hutool.core.io.FileUtil; -import com.github.davidfantasy.mybatisplus.generatorui.GeneratorConfig; -import com.github.davidfantasy.mybatisplus.generatorui.ProjectPathResolver; -import com.github.davidfantasy.mybatisplus.generatorui.common.ServiceException; -import com.github.davidfantasy.mybatisplus.generatorui.dto.OutputFileInfo; -import com.github.davidfantasy.mybatisplus.generatorui.dto.UserConfig; -import com.github.davidfantasy.mybatisplus.generatorui.util.JsonUtil; -import com.github.davidfantasy.mybatisplus.generatorui.util.PathUtil; -import com.github.davidfantasy.mybatisplus.generatorui.util.TemplateUtil; +import com.github.davidfantasy.mybatisplus.generatorui.common.GeneratorConfig; +import com.github.davidfantasy.mybatisplus.generatorui.common.ProjectPathResolver; +import com.github.davidfantasy.mybatisplus.generatorui.common.api.ServiceException; +import com.github.davidfantasy.mybatisplus.generatorui.common.dto.OutputFileInfo; +import com.github.davidfantasy.mybatisplus.generatorui.common.dto.UserConfig; +import com.github.davidfantasy.mybatisplus.generatorui.common.util.JsonUtil; +import com.github.davidfantasy.mybatisplus.generatorui.common.util.PathUtil; +import com.github.davidfantasy.mybatisplus.generatorui.common.util.TemplateUtil; import com.google.common.collect.Lists; import com.google.common.io.Files; import lombok.extern.slf4j.Slf4j; @@ -26,7 +26,7 @@ import java.util.Date; import java.util.List; -import static com.github.davidfantasy.mybatisplus.generatorui.dto.Constant.*; +import static com.github.davidfantasy.mybatisplus.generatorui.common.dto.Constant.*; @Component @Slf4j diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/sqlparser/ConditionExpr.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/sqlparser/ConditionExpr.java similarity index 96% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/sqlparser/ConditionExpr.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/sqlparser/ConditionExpr.java index f13f2da..53aa9dc 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/sqlparser/ConditionExpr.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/sqlparser/ConditionExpr.java @@ -1,4 +1,4 @@ -package com.github.davidfantasy.mybatisplus.generatorui.sqlparser; +package com.github.davidfantasy.mybatisplus.generatorui.common.sqlparser; import cn.hutool.core.util.ReUtil; import com.google.common.base.Strings; diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/sqlparser/DynamicParamSqlEnhancer.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/sqlparser/DynamicParamSqlEnhancer.java similarity index 83% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/sqlparser/DynamicParamSqlEnhancer.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/sqlparser/DynamicParamSqlEnhancer.java index cb8138f..95301e9 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/sqlparser/DynamicParamSqlEnhancer.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/sqlparser/DynamicParamSqlEnhancer.java @@ -1,17 +1,11 @@ -package com.github.davidfantasy.mybatisplus.generatorui.sqlparser; +package com.github.davidfantasy.mybatisplus.generatorui.common.sqlparser; import cn.hutool.core.util.ReUtil; import com.baomidou.mybatisplus.annotation.DbType; -import com.baomidou.mybatisplus.generator.config.DataSourceConfig; -import com.github.davidfantasy.mybatisplus.generatorui.common.ServiceException; +import com.github.davidfantasy.mybatisplus.generatorui.common.api.ServiceException; import com.google.common.base.Strings; import lombok.extern.slf4j.Slf4j; -import net.sf.jsqlparser.expression.LongValue; -import net.sf.jsqlparser.expression.operators.relational.ComparisonOperator; -import net.sf.jsqlparser.expression.operators.relational.EqualsTo; import net.sf.jsqlparser.parser.CCJSqlParser; -import net.sf.jsqlparser.parser.CCJSqlParserUtil; -import net.sf.jsqlparser.schema.Column; import net.sf.jsqlparser.statement.Statement; import net.sf.jsqlparser.statement.select.*; @@ -33,7 +27,7 @@ public DynamicParamSqlEnhancer(DbType dbType) { * @param sql * @return */ - public List parseSqlDynamicConditions(String sql) { + public List parseSqlDynamicConditions(String sql) { if (Strings.isNullOrEmpty(sql)) { throw new ServiceException("sql不能为空"); } @@ -58,8 +52,8 @@ public List parseSqlDynamicConditions(String sql) { * 将SQL中标记的动态条件替换为Mybatis动态SQL */ public String enhanceDynamicConditions(String sql) { - List conditions = parseSqlDynamicConditions(sql); - for (ConditionExpr condition : conditions) { + List conditions = parseSqlDynamicConditions(sql); + for (com.github.davidfantasy.mybatisplus.generatorui.common.sqlparser.ConditionExpr condition : conditions) { Pattern pattern = Pattern.compile(condition.getFindPattern(), Pattern.CASE_INSENSITIVE); sql = ReUtil.replaceAll(sql, pattern, toDynamicSql(condition)); } @@ -70,8 +64,8 @@ public String enhanceDynamicConditions(String sql) { * 去掉SQL中不符合语法的动态条件 */ public String clearIllegalStatements(String sql) { - List conditions = parseSqlDynamicConditions(sql); - for (ConditionExpr condition : conditions) { + List conditions = parseSqlDynamicConditions(sql); + for (com.github.davidfantasy.mybatisplus.generatorui.common.sqlparser.ConditionExpr condition : conditions) { if ("in".equalsIgnoreCase(condition.getOperator())) { Pattern pattern = Pattern.compile(condition.getFindPattern(), Pattern.CASE_INSENSITIVE); String replaceStr = " " + condition.getLogicOperator() + " " + condition.getLeftExpr() + " in ('')"; @@ -81,7 +75,7 @@ public String clearIllegalStatements(String sql) { return sql; } - public String toDynamicSql(ConditionExpr condition) { + public String toDynamicSql(com.github.davidfantasy.mybatisplus.generatorui.common.sqlparser.ConditionExpr condition) { StringBuilder tmp = new StringBuilder(); if (Strings.isNullOrEmpty(condition.getLogicOperator())) { tmp.append(" 1=1 "); diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/sqlparser/SelectConditionParser.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/sqlparser/SelectConditionParser.java similarity index 85% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/sqlparser/SelectConditionParser.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/sqlparser/SelectConditionParser.java index d7ed7e2..18f7ef8 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/sqlparser/SelectConditionParser.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/sqlparser/SelectConditionParser.java @@ -1,4 +1,4 @@ -package com.github.davidfantasy.mybatisplus.generatorui.sqlparser; +package com.github.davidfantasy.mybatisplus.generatorui.common.sqlparser; import lombok.extern.slf4j.Slf4j; import net.sf.jsqlparser.expression.Expression; @@ -13,7 +13,7 @@ @Slf4j public class SelectConditionParser implements SelectVisitor, FromItemVisitor { - private final WhereParser whereConditionParser = new WhereParser(); + private final WhereParser whereConditionParser = new com.github.davidfantasy.mybatisplus.generatorui.common.sqlparser.WhereParser(); public List getParsedConditions() { return whereConditionParser.getConditions(); @@ -25,7 +25,7 @@ public void visit(Table tableName) { @Override public void visit(ParenthesedSelect parenthesedSelect) { - parenthesedSelect.getSetOperationList().accept((SelectVisitor) this); + parenthesedSelect.getSetOperationList().accept(this); } @Override diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/sqlparser/WhereParser.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/sqlparser/WhereParser.java similarity index 81% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/sqlparser/WhereParser.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/sqlparser/WhereParser.java index 749d71f..54d9f5f 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/sqlparser/WhereParser.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/sqlparser/WhereParser.java @@ -1,4 +1,4 @@ -package com.github.davidfantasy.mybatisplus.generatorui.sqlparser; +package com.github.davidfantasy.mybatisplus.generatorui.common.sqlparser; import com.google.common.collect.Lists; import net.sf.jsqlparser.expression.BinaryExpression; @@ -98,9 +98,9 @@ private void parseComparisonOperator(ComparisonOperator operator) { } private void parseBetweenOperator(Between between) { - if (ConditionExpr.isDynamicParam(between.getBetweenExpressionStart().toString()) - || ConditionExpr.isDynamicParam(between.getBetweenExpressionEnd().toString())) { - ConditionExpr condition = new ConditionExpr(); + if (com.github.davidfantasy.mybatisplus.generatorui.common.sqlparser.ConditionExpr.isDynamicParam(between.getBetweenExpressionStart().toString()) + || com.github.davidfantasy.mybatisplus.generatorui.common.sqlparser.ConditionExpr.isDynamicParam(between.getBetweenExpressionEnd().toString())) { + com.github.davidfantasy.mybatisplus.generatorui.common.sqlparser.ConditionExpr condition = new com.github.davidfantasy.mybatisplus.generatorui.common.sqlparser.ConditionExpr(); condition.setLogicOperator(currentLogicOp); condition.setLeftExpr(between.getLeftExpression().toString()); condition.setOperator("between"); @@ -119,8 +119,8 @@ private void parseCommonOperator(Expression left, Expression right, String opera currentLogicOp = ""; return; } - if (ConditionExpr.isDynamicParam(right.toString())) { - ConditionExpr condition = new ConditionExpr(); + if (com.github.davidfantasy.mybatisplus.generatorui.common.sqlparser.ConditionExpr.isDynamicParam(right.toString())) { + com.github.davidfantasy.mybatisplus.generatorui.common.sqlparser.ConditionExpr condition = new com.github.davidfantasy.mybatisplus.generatorui.common.sqlparser.ConditionExpr(); condition.setLeftExpr(left.toString()); condition.setOperator(operator); condition.setRightExpr(right.toString()); diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/strategy/ControllerStrategy.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/strategy/ControllerStrategy.java similarity index 90% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/strategy/ControllerStrategy.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/strategy/ControllerStrategy.java index a98f8d4..5717512 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/strategy/ControllerStrategy.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/strategy/ControllerStrategy.java @@ -1,4 +1,4 @@ -package com.github.davidfantasy.mybatisplus.generatorui.strategy; +package com.github.davidfantasy.mybatisplus.generatorui.common.strategy; import lombok.Data; diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/strategy/EntityStrategy.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/strategy/EntityStrategy.java similarity index 96% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/strategy/EntityStrategy.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/strategy/EntityStrategy.java index bfe9dc1..94776b7 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/strategy/EntityStrategy.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/strategy/EntityStrategy.java @@ -1,4 +1,4 @@ -package com.github.davidfantasy.mybatisplus.generatorui.strategy; +package com.github.davidfantasy.mybatisplus.generatorui.common.strategy; import lombok.Data; diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/strategy/MapperStrategy.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/strategy/MapperStrategy.java similarity index 78% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/strategy/MapperStrategy.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/strategy/MapperStrategy.java index e33df2d..514169c 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/strategy/MapperStrategy.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/strategy/MapperStrategy.java @@ -1,4 +1,4 @@ -package com.github.davidfantasy.mybatisplus.generatorui.strategy; +package com.github.davidfantasy.mybatisplus.generatorui.common.strategy; import com.baomidou.mybatisplus.generator.config.ConstVal; import lombok.Data; diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/strategy/MapperXmlStrategy.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/strategy/MapperXmlStrategy.java similarity index 78% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/strategy/MapperXmlStrategy.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/strategy/MapperXmlStrategy.java index 268972e..ebd42fb 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/strategy/MapperXmlStrategy.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/strategy/MapperXmlStrategy.java @@ -1,4 +1,4 @@ -package com.github.davidfantasy.mybatisplus.generatorui.strategy; +package com.github.davidfantasy.mybatisplus.generatorui.common.strategy; import lombok.Data; diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/strategy/ServiceImplStrategy.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/strategy/ServiceImplStrategy.java similarity index 79% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/strategy/ServiceImplStrategy.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/strategy/ServiceImplStrategy.java index e393c2b..c2bd02d 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/strategy/ServiceImplStrategy.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/strategy/ServiceImplStrategy.java @@ -1,4 +1,4 @@ -package com.github.davidfantasy.mybatisplus.generatorui.strategy; +package com.github.davidfantasy.mybatisplus.generatorui.common.strategy; import com.baomidou.mybatisplus.generator.config.ConstVal; import lombok.Data; diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/strategy/ServiceStrategy.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/strategy/ServiceStrategy.java similarity index 78% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/strategy/ServiceStrategy.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/strategy/ServiceStrategy.java index 84438e1..5aa4cb9 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/strategy/ServiceStrategy.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/strategy/ServiceStrategy.java @@ -1,4 +1,4 @@ -package com.github.davidfantasy.mybatisplus.generatorui.strategy; +package com.github.davidfantasy.mybatisplus.generatorui.common.strategy; import com.baomidou.mybatisplus.generator.config.ConstVal; import lombok.Data; diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/util/JsonUtil.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/util/JsonUtil.java similarity index 96% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/util/JsonUtil.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/util/JsonUtil.java index b52b445..dfd6d8d 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/util/JsonUtil.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/util/JsonUtil.java @@ -1,4 +1,4 @@ -package com.github.davidfantasy.mybatisplus.generatorui.util; +package com.github.davidfantasy.mybatisplus.generatorui.common.util; import com.fasterxml.jackson.core.JsonProcessingException; import com.fasterxml.jackson.core.type.TypeReference; diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/util/OSUtil.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/util/OSUtil.java similarity index 89% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/util/OSUtil.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/util/OSUtil.java index eeda653..a58b920 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/util/OSUtil.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/util/OSUtil.java @@ -1,4 +1,4 @@ -package com.github.davidfantasy.mybatisplus.generatorui.util; +package com.github.davidfantasy.mybatisplus.generatorui.common.util; import com.baomidou.mybatisplus.annotation.FieldFill; diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/util/PathUtil.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/util/PathUtil.java similarity index 94% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/util/PathUtil.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/util/PathUtil.java index f5b3c2e..b36fef6 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/util/PathUtil.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/util/PathUtil.java @@ -1,4 +1,4 @@ -package com.github.davidfantasy.mybatisplus.generatorui.util; +package com.github.davidfantasy.mybatisplus.generatorui.common.util; import com.google.common.base.Strings; diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/util/TemplateUtil.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/util/TemplateUtil.java similarity index 85% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/util/TemplateUtil.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/util/TemplateUtil.java index a71c9c0..71f61cd 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/util/TemplateUtil.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/util/TemplateUtil.java @@ -1,8 +1,8 @@ -package com.github.davidfantasy.mybatisplus.generatorui.util; +package com.github.davidfantasy.mybatisplus.generatorui.common.util; import java.io.InputStream; -import static com.github.davidfantasy.mybatisplus.generatorui.dto.Constant.*; +import static com.github.davidfantasy.mybatisplus.generatorui.common.dto.Constant.*; public class TemplateUtil { diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/META-INF/spring.factories b/mybatis-plus-generator-ui-starter-common/src/main/resources/META-INF/spring.factories new file mode 100644 index 0000000..1b3e800 --- /dev/null +++ b/mybatis-plus-generator-ui-starter-common/src/main/resources/META-INF/spring.factories @@ -0,0 +1,3 @@ +org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ +com.github.davidfantasy.mybatisplus.generatorui.common.core.configuration.SpringDocConfiguration,\ +com.github.davidfantasy.mybatisplus.generatorui.common.core.configuration.SpringDocConfigProperties \ No newline at end of file diff --git a/src/main/resources/codetpls/controller.java.btl b/mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/controller.java.btl similarity index 100% rename from src/main/resources/codetpls/controller.java.btl rename to mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/controller.java.btl diff --git a/src/main/resources/codetpls/dto.btl b/mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/dto.btl similarity index 100% rename from src/main/resources/codetpls/dto.btl rename to mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/dto.btl diff --git a/src/main/resources/codetpls/entity.java.btl b/mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/entity.java.btl similarity index 100% rename from src/main/resources/codetpls/entity.java.btl rename to mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/entity.java.btl diff --git a/src/main/resources/codetpls/mapper.java.btl b/mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/mapper.java.btl similarity index 100% rename from src/main/resources/codetpls/mapper.java.btl rename to mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/mapper.java.btl diff --git a/src/main/resources/codetpls/mapper.xml.btl b/mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/mapper.xml.btl similarity index 100% rename from src/main/resources/codetpls/mapper.xml.btl rename to mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/mapper.xml.btl diff --git a/src/main/resources/codetpls/mapperMethods.btl b/mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/mapperMethods.btl similarity index 100% rename from src/main/resources/codetpls/mapperMethods.btl rename to mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/mapperMethods.btl diff --git a/src/main/resources/codetpls/resultMap.btl b/mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/resultMap.btl similarity index 100% rename from src/main/resources/codetpls/resultMap.btl rename to mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/resultMap.btl diff --git a/src/main/resources/codetpls/service.java.btl b/mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/service.java.btl similarity index 100% rename from src/main/resources/codetpls/service.java.btl rename to mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/service.java.btl diff --git a/src/main/resources/codetpls/serviceImpl.java.btl b/mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/serviceImpl.java.btl similarity index 100% rename from src/main/resources/codetpls/serviceImpl.java.btl rename to mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/serviceImpl.java.btl diff --git a/src/main/resources/public/_nuxt/09694b79d33cba9c2850.js b/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/09694b79d33cba9c2850.js similarity index 100% rename from src/main/resources/public/_nuxt/09694b79d33cba9c2850.js rename to mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/09694b79d33cba9c2850.js diff --git a/src/main/resources/public/_nuxt/27503bae7f340bb103e0.js b/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/27503bae7f340bb103e0.js similarity index 100% rename from src/main/resources/public/_nuxt/27503bae7f340bb103e0.js rename to mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/27503bae7f340bb103e0.js diff --git a/src/main/resources/public/_nuxt/27503bae7f340bb103e0.js.map b/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/27503bae7f340bb103e0.js.map similarity index 100% rename from src/main/resources/public/_nuxt/27503bae7f340bb103e0.js.map rename to mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/27503bae7f340bb103e0.js.map diff --git a/src/main/resources/public/_nuxt/4d665454dfb48fc57305.js b/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/4d665454dfb48fc57305.js similarity index 100% rename from src/main/resources/public/_nuxt/4d665454dfb48fc57305.js rename to mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/4d665454dfb48fc57305.js diff --git a/src/main/resources/public/_nuxt/52cc4ad706f1ab56fd67.js b/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/52cc4ad706f1ab56fd67.js similarity index 100% rename from src/main/resources/public/_nuxt/52cc4ad706f1ab56fd67.js rename to mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/52cc4ad706f1ab56fd67.js diff --git a/src/main/resources/public/_nuxt/77f28fc3ed6d061a9232.js b/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/77f28fc3ed6d061a9232.js similarity index 100% rename from src/main/resources/public/_nuxt/77f28fc3ed6d061a9232.js rename to mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/77f28fc3ed6d061a9232.js diff --git a/src/main/resources/public/_nuxt/7b68d0166b8d500e2875.js b/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/7b68d0166b8d500e2875.js similarity index 100% rename from src/main/resources/public/_nuxt/7b68d0166b8d500e2875.js rename to mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/7b68d0166b8d500e2875.js diff --git a/src/main/resources/public/_nuxt/86adaf226d0c8490dad4.js b/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/86adaf226d0c8490dad4.js similarity index 100% rename from src/main/resources/public/_nuxt/86adaf226d0c8490dad4.js rename to mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/86adaf226d0c8490dad4.js diff --git a/src/main/resources/public/_nuxt/9d53f74ea8103025e271.js b/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/9d53f74ea8103025e271.js similarity index 100% rename from src/main/resources/public/_nuxt/9d53f74ea8103025e271.js rename to mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/9d53f74ea8103025e271.js diff --git a/src/main/resources/public/_nuxt/LICENSES b/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/LICENSES similarity index 100% rename from src/main/resources/public/_nuxt/LICENSES rename to mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/LICENSES diff --git a/src/main/resources/public/_nuxt/cf49cb65f4df44b6a375.js b/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/cf49cb65f4df44b6a375.js similarity index 100% rename from src/main/resources/public/_nuxt/cf49cb65f4df44b6a375.js rename to mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/cf49cb65f4df44b6a375.js diff --git a/src/main/resources/public/_nuxt/cf49cb65f4df44b6a375.js.map b/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/cf49cb65f4df44b6a375.js.map similarity index 100% rename from src/main/resources/public/_nuxt/cf49cb65f4df44b6a375.js.map rename to mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/cf49cb65f4df44b6a375.js.map diff --git a/src/main/resources/public/_nuxt/e5273501af6c8ff2839e.js b/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/e5273501af6c8ff2839e.js similarity index 100% rename from src/main/resources/public/_nuxt/e5273501af6c8ff2839e.js rename to mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/e5273501af6c8ff2839e.js diff --git a/src/main/resources/public/_nuxt/fonts/535877f.woff b/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/fonts/535877f.woff similarity index 100% rename from src/main/resources/public/_nuxt/fonts/535877f.woff rename to mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/fonts/535877f.woff diff --git a/src/main/resources/public/_nuxt/fonts/674f50d.eot b/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/fonts/674f50d.eot similarity index 100% rename from src/main/resources/public/_nuxt/fonts/674f50d.eot rename to mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/fonts/674f50d.eot diff --git a/src/main/resources/public/_nuxt/fonts/732389d.ttf b/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/fonts/732389d.ttf similarity index 100% rename from src/main/resources/public/_nuxt/fonts/732389d.ttf rename to mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/fonts/732389d.ttf diff --git a/src/main/resources/public/_nuxt/fonts/af7ae50.woff2 b/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/fonts/af7ae50.woff2 similarity index 100% rename from src/main/resources/public/_nuxt/fonts/af7ae50.woff2 rename to mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/fonts/af7ae50.woff2 diff --git a/src/main/resources/public/_nuxt/fonts/b06871f.ttf b/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/fonts/b06871f.ttf similarity index 100% rename from src/main/resources/public/_nuxt/fonts/b06871f.ttf rename to mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/fonts/b06871f.ttf diff --git a/src/main/resources/public/_nuxt/fonts/fee66e7.woff b/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/fonts/fee66e7.woff similarity index 100% rename from src/main/resources/public/_nuxt/fonts/fee66e7.woff rename to mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/fonts/fee66e7.woff diff --git a/src/main/resources/public/_nuxt/img/acf3dcb.svg b/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/img/acf3dcb.svg similarity index 100% rename from src/main/resources/public/_nuxt/img/acf3dcb.svg rename to mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/img/acf3dcb.svg diff --git a/src/main/resources/public/_nuxt/img/af9195e.png b/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/img/af9195e.png similarity index 100% rename from src/main/resources/public/_nuxt/img/af9195e.png rename to mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/img/af9195e.png diff --git a/src/main/resources/public/index.html b/mybatis-plus-generator-ui-starter-common/src/main/resources/public/index.html similarity index 100% rename from src/main/resources/public/index.html rename to mybatis-plus-generator-ui-starter-common/src/main/resources/public/index.html diff --git a/src/main/resources/public/libs/adminlte/adminlte.min.css b/mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/adminlte/adminlte.min.css similarity index 100% rename from src/main/resources/public/libs/adminlte/adminlte.min.css rename to mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/adminlte/adminlte.min.css diff --git a/src/main/resources/public/libs/adminlte/adminlte.min.js b/mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/adminlte/adminlte.min.js similarity index 100% rename from src/main/resources/public/libs/adminlte/adminlte.min.js rename to mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/adminlte/adminlte.min.js diff --git a/src/main/resources/public/libs/bootstrap/css/bootstrap.min.css b/mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/bootstrap/css/bootstrap.min.css similarity index 100% rename from src/main/resources/public/libs/bootstrap/css/bootstrap.min.css rename to mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/bootstrap/css/bootstrap.min.css diff --git a/src/main/resources/public/libs/bootstrap/css/bootstrap.min.css.map b/mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/bootstrap/css/bootstrap.min.css.map similarity index 100% rename from src/main/resources/public/libs/bootstrap/css/bootstrap.min.css.map rename to mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/bootstrap/css/bootstrap.min.css.map diff --git a/src/main/resources/public/libs/bootstrap/js/bootstrap.min.js b/mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/bootstrap/js/bootstrap.min.js similarity index 100% rename from src/main/resources/public/libs/bootstrap/js/bootstrap.min.js rename to mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/bootstrap/js/bootstrap.min.js diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/font-awesome/css/font-awesome.min.css b/mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/font-awesome/css/font-awesome.min.css new file mode 100644 index 0000000..54f0e3c --- /dev/null +++ b/mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/font-awesome/css/font-awesome.min.css @@ -0,0 +1,4 @@ +/*! + * Font Awesome 4.7.0 by @davegandy - http://fontawesome.io - @fontawesome + * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) + */@font-face{font-family:'FontAwesome';src:url('../fonts/fontawesome-webfont.eot?v=4.7.0');src:url('../fonts/fontawesome-webfont.eot?#iefix&v=4.7.0') format('embedded-opentype'),url('../fonts/fontawesome-webfont.woff2?v=4.7.0') format('woff2'),url('../fonts/fontawesome-webfont.woff?v=4.7.0') format('woff'),url('../fonts/fontawesome-webfont.ttf?v=4.7.0') format('truetype'),url('../fonts/fontawesome-webfont.svg?v=4.7.0#fontawesomeregular') format('svg');font-weight:normal;font-style:normal}.fa{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale} .fa-lg{font-size:1.33333333em;line-height:.75em;vertical-align:-15%} .fa-2x{font-size:2em} .fa-3x{font-size:3em} .fa-4x{font-size:4em} .fa-5x{font-size:5em} .fa-fw{width:1.28571429em;text-align:center} .fa-ul{padding-left:0;margin-left:2.14285714em;list-style-type:none} .fa-ul>li{position:relative} .fa-li{position:absolute;left:-2.14285714em;width:2.14285714em;top:.14285714em;text-align:center} .fa-li.fa-lg{left:-1.85714286em} .fa-border{padding:.2em .25em .15em;border:solid .08em #eee;border-radius:.1em} .fa-pull-left{float:left} .fa-pull-right{float:right} .fa.fa-pull-left{margin-right:.3em} .fa.fa-pull-right{margin-left:.3em} .pull-right{float:right} .pull-left{float:left} .fa.pull-left{margin-right:.3em} .fa.pull-right{margin-left:.3em} .fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear} .fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)} @-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)} 100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}} @keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)} 100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}} .fa-rotate-90{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)} .fa-rotate-180{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)} .fa-rotate-270{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)} .fa-flip-horizontal{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";-webkit-transform:scale(-1, 1);-ms-transform:scale(-1, 1);transform:scale(-1, 1)} .fa-flip-vertical{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)";-webkit-transform:scale(1, -1);-ms-transform:scale(1, -1);transform:scale(1, -1)} :root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270,:root .fa-flip-horizontal,:root .fa-flip-vertical{filter:none} .fa-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:middle} .fa-stack-1x,.fa-stack-2x{position:absolute;left:0;width:100%;text-align:center} .fa-stack-1x{line-height:inherit} .fa-stack-2x{font-size:2em} .fa-inverse{color:#fff} .fa-glass:before{content:"\f000"} .fa-music:before{content:"\f001"} .fa-search:before{content:"\f002"} .fa-envelope-o:before{content:"\f003"} .fa-heart:before{content:"\f004"} .fa-star:before{content:"\f005"} .fa-star-o:before{content:"\f006"} .fa-user:before{content:"\f007"} .fa-film:before{content:"\f008"} .fa-th-large:before{content:"\f009"} .fa-th:before{content:"\f00a"} .fa-th-list:before{content:"\f00b"} .fa-check:before{content:"\f00c"} .fa-remove:before,.fa-close:before,.fa-times:before{content:"\f00d"} .fa-search-plus:before{content:"\f00e"} .fa-search-minus:before{content:"\f010"} .fa-power-off:before{content:"\f011"} .fa-signal:before{content:"\f012"} .fa-gear:before,.fa-cog:before{content:"\f013"} .fa-trash-o:before{content:"\f014"} .fa-home:before{content:"\f015"} .fa-file-o:before{content:"\f016"} .fa-clock-o:before{content:"\f017"} .fa-road:before{content:"\f018"} .fa-download:before{content:"\f019"} .fa-arrow-circle-o-down:before{content:"\f01a"} .fa-arrow-circle-o-up:before{content:"\f01b"} .fa-inbox:before{content:"\f01c"} .fa-play-circle-o:before{content:"\f01d"} .fa-rotate-right:before,.fa-repeat:before{content:"\f01e"} .fa-refresh:before{content:"\f021"} .fa-list-alt:before{content:"\f022"} .fa-lock:before{content:"\f023"} .fa-flag:before{content:"\f024"} .fa-headphones:before{content:"\f025"} .fa-volume-off:before{content:"\f026"} .fa-volume-down:before{content:"\f027"} .fa-volume-up:before{content:"\f028"} .fa-qrcode:before{content:"\f029"} .fa-barcode:before{content:"\f02a"} .fa-tag:before{content:"\f02b"} .fa-tags:before{content:"\f02c"} .fa-book:before{content:"\f02d"} .fa-bookmark:before{content:"\f02e"} .fa-print:before{content:"\f02f"} .fa-camera:before{content:"\f030"} .fa-font:before{content:"\f031"} .fa-bold:before{content:"\f032"} .fa-italic:before{content:"\f033"} .fa-text-height:before{content:"\f034"} .fa-text-width:before{content:"\f035"} .fa-align-left:before{content:"\f036"} .fa-align-center:before{content:"\f037"} .fa-align-right:before{content:"\f038"} .fa-align-justify:before{content:"\f039"} .fa-list:before{content:"\f03a"} .fa-dedent:before,.fa-outdent:before{content:"\f03b"} .fa-indent:before{content:"\f03c"} .fa-video-camera:before{content:"\f03d"} .fa-photo:before,.fa-image:before,.fa-picture-o:before{content:"\f03e"} .fa-pencil:before{content:"\f040"} .fa-map-marker:before{content:"\f041"} .fa-adjust:before{content:"\f042"} .fa-tint:before{content:"\f043"} .fa-edit:before,.fa-pencil-square-o:before{content:"\f044"} .fa-share-square-o:before{content:"\f045"} .fa-check-square-o:before{content:"\f046"} .fa-arrows:before{content:"\f047"} .fa-step-backward:before{content:"\f048"} .fa-fast-backward:before{content:"\f049"} .fa-backward:before{content:"\f04a"} .fa-play:before{content:"\f04b"} .fa-pause:before{content:"\f04c"} .fa-stop:before{content:"\f04d"} .fa-forward:before{content:"\f04e"} .fa-fast-forward:before{content:"\f050"} .fa-step-forward:before{content:"\f051"} .fa-eject:before{content:"\f052"} .fa-chevron-left:before{content:"\f053"} .fa-chevron-right:before{content:"\f054"} .fa-plus-circle:before{content:"\f055"} .fa-minus-circle:before{content:"\f056"} .fa-times-circle:before{content:"\f057"} .fa-check-circle:before{content:"\f058"} .fa-question-circle:before{content:"\f059"} .fa-info-circle:before{content:"\f05a"} .fa-crosshairs:before{content:"\f05b"} .fa-times-circle-o:before{content:"\f05c"} .fa-check-circle-o:before{content:"\f05d"} .fa-ban:before{content:"\f05e"} .fa-arrow-left:before{content:"\f060"} .fa-arrow-right:before{content:"\f061"} .fa-arrow-up:before{content:"\f062"} .fa-arrow-down:before{content:"\f063"} .fa-mail-forward:before,.fa-share:before{content:"\f064"} .fa-expand:before{content:"\f065"} .fa-compress:before{content:"\f066"} .fa-plus:before{content:"\f067"} .fa-minus:before{content:"\f068"} .fa-asterisk:before{content:"\f069"} .fa-exclamation-circle:before{content:"\f06a"} .fa-gift:before{content:"\f06b"} .fa-leaf:before{content:"\f06c"} .fa-fire:before{content:"\f06d"} .fa-eye:before{content:"\f06e"} .fa-eye-slash:before{content:"\f070"} .fa-warning:before,.fa-exclamation-triangle:before{content:"\f071"} .fa-plane:before{content:"\f072"} .fa-calendar:before{content:"\f073"} .fa-random:before{content:"\f074"} .fa-comment:before{content:"\f075"} .fa-magnet:before{content:"\f076"} .fa-chevron-up:before{content:"\f077"} .fa-chevron-down:before{content:"\f078"} .fa-retweet:before{content:"\f079"} .fa-shopping-cart:before{content:"\f07a"} .fa-folder:before{content:"\f07b"} .fa-folder-open:before{content:"\f07c"} .fa-arrows-v:before{content:"\f07d"} .fa-arrows-h:before{content:"\f07e"} .fa-bar-chart-o:before,.fa-bar-chart:before{content:"\f080"} .fa-twitter-square:before{content:"\f081"} .fa-facebook-square:before{content:"\f082"} .fa-camera-retro:before{content:"\f083"} .fa-key:before{content:"\f084"} .fa-gears:before,.fa-cogs:before{content:"\f085"} .fa-comments:before{content:"\f086"} .fa-thumbs-o-up:before{content:"\f087"} .fa-thumbs-o-down:before{content:"\f088"} .fa-star-half:before{content:"\f089"} .fa-heart-o:before{content:"\f08a"} .fa-sign-out:before{content:"\f08b"} .fa-linkedin-square:before{content:"\f08c"} .fa-thumb-tack:before{content:"\f08d"} .fa-external-link:before{content:"\f08e"} .fa-sign-in:before{content:"\f090"} .fa-trophy:before{content:"\f091"} .fa-github-square:before{content:"\f092"} .fa-upload:before{content:"\f093"} .fa-lemon-o:before{content:"\f094"} .fa-phone:before{content:"\f095"} .fa-square-o:before{content:"\f096"} .fa-bookmark-o:before{content:"\f097"} .fa-phone-square:before{content:"\f098"} .fa-twitter:before{content:"\f099"} .fa-facebook-f:before,.fa-facebook:before{content:"\f09a"} .fa-github:before{content:"\f09b"} .fa-unlock:before{content:"\f09c"} .fa-credit-card:before{content:"\f09d"} .fa-feed:before,.fa-rss:before{content:"\f09e"} .fa-hdd-o:before{content:"\f0a0"} .fa-bullhorn:before{content:"\f0a1"} .fa-bell:before{content:"\f0f3"} .fa-certificate:before{content:"\f0a3"} .fa-hand-o-right:before{content:"\f0a4"} .fa-hand-o-left:before{content:"\f0a5"} .fa-hand-o-up:before{content:"\f0a6"} .fa-hand-o-down:before{content:"\f0a7"} .fa-arrow-circle-left:before{content:"\f0a8"} .fa-arrow-circle-right:before{content:"\f0a9"} .fa-arrow-circle-up:before{content:"\f0aa"} .fa-arrow-circle-down:before{content:"\f0ab"} .fa-globe:before{content:"\f0ac"} .fa-wrench:before{content:"\f0ad"} .fa-tasks:before{content:"\f0ae"} .fa-filter:before{content:"\f0b0"} .fa-briefcase:before{content:"\f0b1"} .fa-arrows-alt:before{content:"\f0b2"} .fa-group:before,.fa-users:before{content:"\f0c0"} .fa-chain:before,.fa-link:before{content:"\f0c1"} .fa-cloud:before{content:"\f0c2"} .fa-flask:before{content:"\f0c3"} .fa-cut:before,.fa-scissors:before{content:"\f0c4"} .fa-copy:before,.fa-files-o:before{content:"\f0c5"} .fa-paperclip:before{content:"\f0c6"} .fa-save:before,.fa-floppy-o:before{content:"\f0c7"} .fa-square:before{content:"\f0c8"} .fa-navicon:before,.fa-reorder:before,.fa-bars:before{content:"\f0c9"} .fa-list-ul:before{content:"\f0ca"} .fa-list-ol:before{content:"\f0cb"} .fa-strikethrough:before{content:"\f0cc"} .fa-underline:before{content:"\f0cd"} .fa-table:before{content:"\f0ce"} .fa-magic:before{content:"\f0d0"} .fa-truck:before{content:"\f0d1"} .fa-pinterest:before{content:"\f0d2"} .fa-pinterest-square:before{content:"\f0d3"} .fa-google-plus-square:before{content:"\f0d4"} .fa-google-plus:before{content:"\f0d5"} .fa-money:before{content:"\f0d6"} .fa-caret-down:before{content:"\f0d7"} .fa-caret-up:before{content:"\f0d8"} .fa-caret-left:before{content:"\f0d9"} .fa-caret-right:before{content:"\f0da"} .fa-columns:before{content:"\f0db"} .fa-unsorted:before,.fa-sort:before{content:"\f0dc"} .fa-sort-down:before,.fa-sort-desc:before{content:"\f0dd"} .fa-sort-up:before,.fa-sort-asc:before{content:"\f0de"} .fa-envelope:before{content:"\f0e0"} .fa-linkedin:before{content:"\f0e1"} .fa-rotate-left:before,.fa-undo:before{content:"\f0e2"} .fa-legal:before,.fa-gavel:before{content:"\f0e3"} .fa-dashboard:before,.fa-tachometer:before{content:"\f0e4"} .fa-comment-o:before{content:"\f0e5"} .fa-comments-o:before{content:"\f0e6"} .fa-flash:before,.fa-bolt:before{content:"\f0e7"} .fa-sitemap:before{content:"\f0e8"} .fa-umbrella:before{content:"\f0e9"} .fa-paste:before,.fa-clipboard:before{content:"\f0ea"} .fa-lightbulb-o:before{content:"\f0eb"} .fa-exchange:before{content:"\f0ec"} .fa-cloud-download:before{content:"\f0ed"} .fa-cloud-upload:before{content:"\f0ee"} .fa-user-md:before{content:"\f0f0"} .fa-stethoscope:before{content:"\f0f1"} .fa-suitcase:before{content:"\f0f2"} .fa-bell-o:before{content:"\f0a2"} .fa-coffee:before{content:"\f0f4"} .fa-cutlery:before{content:"\f0f5"} .fa-file-text-o:before{content:"\f0f6"} .fa-building-o:before{content:"\f0f7"} .fa-hospital-o:before{content:"\f0f8"} .fa-ambulance:before{content:"\f0f9"} .fa-medkit:before{content:"\f0fa"} .fa-fighter-jet:before{content:"\f0fb"} .fa-beer:before{content:"\f0fc"} .fa-h-square:before{content:"\f0fd"} .fa-plus-square:before{content:"\f0fe"} .fa-angle-double-left:before{content:"\f100"} .fa-angle-double-right:before{content:"\f101"} .fa-angle-double-up:before{content:"\f102"} .fa-angle-double-down:before{content:"\f103"} .fa-angle-left:before{content:"\f104"} .fa-angle-right:before{content:"\f105"} .fa-angle-up:before{content:"\f106"} .fa-angle-down:before{content:"\f107"} .fa-desktop:before{content:"\f108"} .fa-laptop:before{content:"\f109"} .fa-tablet:before{content:"\f10a"} .fa-mobile-phone:before,.fa-mobile:before{content:"\f10b"} .fa-circle-o:before{content:"\f10c"} .fa-quote-left:before{content:"\f10d"} .fa-quote-right:before{content:"\f10e"} .fa-spinner:before{content:"\f110"} .fa-circle:before{content:"\f111"} .fa-mail-reply:before,.fa-reply:before{content:"\f112"} .fa-github-alt:before{content:"\f113"} .fa-folder-o:before{content:"\f114"} .fa-folder-open-o:before{content:"\f115"} .fa-smile-o:before{content:"\f118"} .fa-frown-o:before{content:"\f119"} .fa-meh-o:before{content:"\f11a"} .fa-gamepad:before{content:"\f11b"} .fa-keyboard-o:before{content:"\f11c"} .fa-flag-o:before{content:"\f11d"} .fa-flag-checkered:before{content:"\f11e"} .fa-terminal:before{content:"\f120"} .fa-code:before{content:"\f121"} .fa-mail-reply-all:before,.fa-reply-all:before{content:"\f122"} .fa-star-half-empty:before,.fa-star-half-full:before,.fa-star-half-o:before{content:"\f123"} .fa-location-arrow:before{content:"\f124"} .fa-crop:before{content:"\f125"} .fa-code-fork:before{content:"\f126"} .fa-unlink:before,.fa-chain-broken:before{content:"\f127"} .fa-question:before{content:"\f128"} .fa-info:before{content:"\f129"} .fa-exclamation:before{content:"\f12a"} .fa-superscript:before{content:"\f12b"} .fa-subscript:before{content:"\f12c"} .fa-eraser:before{content:"\f12d"} .fa-puzzle-piece:before{content:"\f12e"} .fa-microphone:before{content:"\f130"} .fa-microphone-slash:before{content:"\f131"} .fa-shield:before{content:"\f132"} .fa-calendar-o:before{content:"\f133"} .fa-fire-extinguisher:before{content:"\f134"} .fa-rocket:before{content:"\f135"} .fa-maxcdn:before{content:"\f136"} .fa-chevron-circle-left:before{content:"\f137"} .fa-chevron-circle-right:before{content:"\f138"} .fa-chevron-circle-up:before{content:"\f139"} .fa-chevron-circle-down:before{content:"\f13a"} .fa-html5:before{content:"\f13b"} .fa-css3:before{content:"\f13c"} .fa-anchor:before{content:"\f13d"} .fa-unlock-alt:before{content:"\f13e"} .fa-bullseye:before{content:"\f140"} .fa-ellipsis-h:before{content:"\f141"} .fa-ellipsis-v:before{content:"\f142"} .fa-rss-square:before{content:"\f143"} .fa-play-circle:before{content:"\f144"} .fa-ticket:before{content:"\f145"} .fa-minus-square:before{content:"\f146"} .fa-minus-square-o:before{content:"\f147"} .fa-level-up:before{content:"\f148"} .fa-level-down:before{content:"\f149"} .fa-check-square:before{content:"\f14a"} .fa-pencil-square:before{content:"\f14b"} .fa-external-link-square:before{content:"\f14c"} .fa-share-square:before{content:"\f14d"} .fa-compass:before{content:"\f14e"} .fa-toggle-down:before,.fa-caret-square-o-down:before{content:"\f150"} .fa-toggle-up:before,.fa-caret-square-o-up:before{content:"\f151"} .fa-toggle-right:before,.fa-caret-square-o-right:before{content:"\f152"} .fa-euro:before,.fa-eur:before{content:"\f153"} .fa-gbp:before{content:"\f154"} .fa-dollar:before,.fa-usd:before{content:"\f155"} .fa-rupee:before,.fa-inr:before{content:"\f156"} .fa-cny:before,.fa-rmb:before,.fa-yen:before,.fa-jpy:before{content:"\f157"} .fa-ruble:before,.fa-rouble:before,.fa-rub:before{content:"\f158"} .fa-won:before,.fa-krw:before{content:"\f159"} .fa-bitcoin:before,.fa-btc:before{content:"\f15a"} .fa-file:before{content:"\f15b"} .fa-file-text:before{content:"\f15c"} .fa-sort-alpha-asc:before{content:"\f15d"} .fa-sort-alpha-desc:before{content:"\f15e"} .fa-sort-amount-asc:before{content:"\f160"} .fa-sort-amount-desc:before{content:"\f161"} .fa-sort-numeric-asc:before{content:"\f162"} .fa-sort-numeric-desc:before{content:"\f163"} .fa-thumbs-up:before{content:"\f164"} .fa-thumbs-down:before{content:"\f165"} .fa-youtube-square:before{content:"\f166"} .fa-youtube:before{content:"\f167"} .fa-xing:before{content:"\f168"} .fa-xing-square:before{content:"\f169"} .fa-youtube-play:before{content:"\f16a"} .fa-dropbox:before{content:"\f16b"} .fa-stack-overflow:before{content:"\f16c"} .fa-instagram:before{content:"\f16d"} .fa-flickr:before{content:"\f16e"} .fa-adn:before{content:"\f170"} .fa-bitbucket:before{content:"\f171"} .fa-bitbucket-square:before{content:"\f172"} .fa-tumblr:before{content:"\f173"} .fa-tumblr-square:before{content:"\f174"} .fa-long-arrow-down:before{content:"\f175"} .fa-long-arrow-up:before{content:"\f176"} .fa-long-arrow-left:before{content:"\f177"} .fa-long-arrow-right:before{content:"\f178"} .fa-apple:before{content:"\f179"} .fa-windows:before{content:"\f17a"} .fa-android:before{content:"\f17b"} .fa-linux:before{content:"\f17c"} .fa-dribbble:before{content:"\f17d"} .fa-skype:before{content:"\f17e"} .fa-foursquare:before{content:"\f180"} .fa-trello:before{content:"\f181"} .fa-female:before{content:"\f182"} .fa-male:before{content:"\f183"} .fa-gittip:before,.fa-gratipay:before{content:"\f184"} .fa-sun-o:before{content:"\f185"} .fa-moon-o:before{content:"\f186"} .fa-archive:before{content:"\f187"} .fa-bug:before{content:"\f188"} .fa-vk:before{content:"\f189"} .fa-weibo:before{content:"\f18a"} .fa-renren:before{content:"\f18b"} .fa-pagelines:before{content:"\f18c"} .fa-stack-exchange:before{content:"\f18d"} .fa-arrow-circle-o-right:before{content:"\f18e"} .fa-arrow-circle-o-left:before{content:"\f190"} .fa-toggle-left:before,.fa-caret-square-o-left:before{content:"\f191"} .fa-dot-circle-o:before{content:"\f192"} .fa-wheelchair:before{content:"\f193"} .fa-vimeo-square:before{content:"\f194"} .fa-turkish-lira:before,.fa-try:before{content:"\f195"} .fa-plus-square-o:before{content:"\f196"} .fa-space-shuttle:before{content:"\f197"} .fa-slack:before{content:"\f198"} .fa-envelope-square:before{content:"\f199"} .fa-wordpress:before{content:"\f19a"} .fa-openid:before{content:"\f19b"} .fa-institution:before,.fa-bank:before,.fa-university:before{content:"\f19c"} .fa-mortar-board:before,.fa-graduation-cap:before{content:"\f19d"} .fa-yahoo:before{content:"\f19e"} .fa-google:before{content:"\f1a0"} .fa-reddit:before{content:"\f1a1"} .fa-reddit-square:before{content:"\f1a2"} .fa-stumbleupon-circle:before{content:"\f1a3"} .fa-stumbleupon:before{content:"\f1a4"} .fa-delicious:before{content:"\f1a5"} .fa-digg:before{content:"\f1a6"} .fa-pied-piper-pp:before{content:"\f1a7"} .fa-pied-piper-alt:before{content:"\f1a8"} .fa-drupal:before{content:"\f1a9"} .fa-joomla:before{content:"\f1aa"} .fa-language:before{content:"\f1ab"} .fa-fax:before{content:"\f1ac"} .fa-building:before{content:"\f1ad"} .fa-child:before{content:"\f1ae"} .fa-paw:before{content:"\f1b0"} .fa-spoon:before{content:"\f1b1"} .fa-cube:before{content:"\f1b2"} .fa-cubes:before{content:"\f1b3"} .fa-behance:before{content:"\f1b4"} .fa-behance-square:before{content:"\f1b5"} .fa-steam:before{content:"\f1b6"} .fa-steam-square:before{content:"\f1b7"} .fa-recycle:before{content:"\f1b8"} .fa-automobile:before,.fa-car:before{content:"\f1b9"} .fa-cab:before,.fa-taxi:before{content:"\f1ba"} .fa-tree:before{content:"\f1bb"} .fa-spotify:before{content:"\f1bc"} .fa-deviantart:before{content:"\f1bd"} .fa-soundcloud:before{content:"\f1be"} .fa-database:before{content:"\f1c0"} .fa-file-pdf-o:before{content:"\f1c1"} .fa-file-word-o:before{content:"\f1c2"} .fa-file-excel-o:before{content:"\f1c3"} .fa-file-powerpoint-o:before{content:"\f1c4"} .fa-file-photo-o:before,.fa-file-picture-o:before,.fa-file-image-o:before{content:"\f1c5"} .fa-file-zip-o:before,.fa-file-archive-o:before{content:"\f1c6"} .fa-file-sound-o:before,.fa-file-audio-o:before{content:"\f1c7"} .fa-file-movie-o:before,.fa-file-video-o:before{content:"\f1c8"} .fa-file-code-o:before{content:"\f1c9"} .fa-vine:before{content:"\f1ca"} .fa-codepen:before{content:"\f1cb"} .fa-jsfiddle:before{content:"\f1cc"} .fa-life-bouy:before,.fa-life-buoy:before,.fa-life-saver:before,.fa-support:before,.fa-life-ring:before{content:"\f1cd"} .fa-circle-o-notch:before{content:"\f1ce"} .fa-ra:before,.fa-resistance:before,.fa-rebel:before{content:"\f1d0"} .fa-ge:before,.fa-empire:before{content:"\f1d1"} .fa-git-square:before{content:"\f1d2"} .fa-git:before{content:"\f1d3"} .fa-y-combinator-square:before,.fa-yc-square:before,.fa-hacker-news:before{content:"\f1d4"} .fa-tencent-weibo:before{content:"\f1d5"} .fa-qq:before{content:"\f1d6"} .fa-wechat:before,.fa-weixin:before{content:"\f1d7"} .fa-send:before,.fa-paper-plane:before{content:"\f1d8"} .fa-send-o:before,.fa-paper-plane-o:before{content:"\f1d9"} .fa-history:before{content:"\f1da"} .fa-circle-thin:before{content:"\f1db"} .fa-header:before{content:"\f1dc"} .fa-paragraph:before{content:"\f1dd"} .fa-sliders:before{content:"\f1de"} .fa-share-alt:before{content:"\f1e0"} .fa-share-alt-square:before{content:"\f1e1"} .fa-bomb:before{content:"\f1e2"} .fa-soccer-ball-o:before,.fa-futbol-o:before{content:"\f1e3"} .fa-tty:before{content:"\f1e4"} .fa-binoculars:before{content:"\f1e5"} .fa-plug:before{content:"\f1e6"} .fa-slideshare:before{content:"\f1e7"} .fa-twitch:before{content:"\f1e8"} .fa-yelp:before{content:"\f1e9"} .fa-newspaper-o:before{content:"\f1ea"} .fa-wifi:before{content:"\f1eb"} .fa-calculator:before{content:"\f1ec"} .fa-paypal:before{content:"\f1ed"} .fa-google-wallet:before{content:"\f1ee"} .fa-cc-visa:before{content:"\f1f0"} .fa-cc-mastercard:before{content:"\f1f1"} .fa-cc-discover:before{content:"\f1f2"} .fa-cc-amex:before{content:"\f1f3"} .fa-cc-paypal:before{content:"\f1f4"} .fa-cc-stripe:before{content:"\f1f5"} .fa-bell-slash:before{content:"\f1f6"} .fa-bell-slash-o:before{content:"\f1f7"} .fa-trash:before{content:"\f1f8"} .fa-copyright:before{content:"\f1f9"} .fa-at:before{content:"\f1fa"} .fa-eyedropper:before{content:"\f1fb"} .fa-paint-brush:before{content:"\f1fc"} .fa-birthday-cake:before{content:"\f1fd"} .fa-area-chart:before{content:"\f1fe"} .fa-pie-chart:before{content:"\f200"} .fa-line-chart:before{content:"\f201"} .fa-lastfm:before{content:"\f202"} .fa-lastfm-square:before{content:"\f203"} .fa-toggle-off:before{content:"\f204"} .fa-toggle-on:before{content:"\f205"} .fa-bicycle:before{content:"\f206"} .fa-bus:before{content:"\f207"} .fa-ioxhost:before{content:"\f208"} .fa-angellist:before{content:"\f209"} .fa-cc:before{content:"\f20a"} .fa-shekel:before,.fa-sheqel:before,.fa-ils:before{content:"\f20b"} .fa-meanpath:before{content:"\f20c"} .fa-buysellads:before{content:"\f20d"} .fa-connectdevelop:before{content:"\f20e"} .fa-dashcube:before{content:"\f210"} .fa-forumbee:before{content:"\f211"} .fa-leanpub:before{content:"\f212"} .fa-sellsy:before{content:"\f213"} .fa-shirtsinbulk:before{content:"\f214"} .fa-simplybuilt:before{content:"\f215"} .fa-skyatlas:before{content:"\f216"} .fa-cart-plus:before{content:"\f217"} .fa-cart-arrow-down:before{content:"\f218"} .fa-diamond:before{content:"\f219"} .fa-ship:before{content:"\f21a"} .fa-user-secret:before{content:"\f21b"} .fa-motorcycle:before{content:"\f21c"} .fa-street-view:before{content:"\f21d"} .fa-heartbeat:before{content:"\f21e"} .fa-venus:before{content:"\f221"} .fa-mars:before{content:"\f222"} .fa-mercury:before{content:"\f223"} .fa-intersex:before,.fa-transgender:before{content:"\f224"} .fa-transgender-alt:before{content:"\f225"} .fa-venus-double:before{content:"\f226"} .fa-mars-double:before{content:"\f227"} .fa-venus-mars:before{content:"\f228"} .fa-mars-stroke:before{content:"\f229"} .fa-mars-stroke-v:before{content:"\f22a"} .fa-mars-stroke-h:before{content:"\f22b"} .fa-neuter:before{content:"\f22c"} .fa-genderless:before{content:"\f22d"} .fa-facebook-official:before{content:"\f230"} .fa-pinterest-p:before{content:"\f231"} .fa-whatsapp:before{content:"\f232"} .fa-server:before{content:"\f233"} .fa-user-plus:before{content:"\f234"} .fa-user-times:before{content:"\f235"} .fa-hotel:before,.fa-bed:before{content:"\f236"} .fa-viacoin:before{content:"\f237"} .fa-train:before{content:"\f238"} .fa-subway:before{content:"\f239"} .fa-medium:before{content:"\f23a"} .fa-yc:before,.fa-y-combinator:before{content:"\f23b"} .fa-optin-monster:before{content:"\f23c"} .fa-opencart:before{content:"\f23d"} .fa-expeditedssl:before{content:"\f23e"} .fa-battery-4:before,.fa-battery:before,.fa-battery-full:before{content:"\f240"} .fa-battery-3:before,.fa-battery-three-quarters:before{content:"\f241"} .fa-battery-2:before,.fa-battery-half:before{content:"\f242"} .fa-battery-1:before,.fa-battery-quarter:before{content:"\f243"} .fa-battery-0:before,.fa-battery-empty:before{content:"\f244"} .fa-mouse-pointer:before{content:"\f245"} .fa-i-cursor:before{content:"\f246"} .fa-object-group:before{content:"\f247"} .fa-object-ungroup:before{content:"\f248"} .fa-sticky-note:before{content:"\f249"} .fa-sticky-note-o:before{content:"\f24a"} .fa-cc-jcb:before{content:"\f24b"} .fa-cc-diners-club:before{content:"\f24c"} .fa-clone:before{content:"\f24d"} .fa-balance-scale:before{content:"\f24e"} .fa-hourglass-o:before{content:"\f250"} .fa-hourglass-1:before,.fa-hourglass-start:before{content:"\f251"} .fa-hourglass-2:before,.fa-hourglass-half:before{content:"\f252"} .fa-hourglass-3:before,.fa-hourglass-end:before{content:"\f253"} .fa-hourglass:before{content:"\f254"} .fa-hand-grab-o:before,.fa-hand-rock-o:before{content:"\f255"} .fa-hand-stop-o:before,.fa-hand-paper-o:before{content:"\f256"} .fa-hand-scissors-o:before{content:"\f257"} .fa-hand-lizard-o:before{content:"\f258"} .fa-hand-spock-o:before{content:"\f259"} .fa-hand-pointer-o:before{content:"\f25a"} .fa-hand-peace-o:before{content:"\f25b"} .fa-trademark:before{content:"\f25c"} .fa-registered:before{content:"\f25d"} .fa-creative-commons:before{content:"\f25e"} .fa-gg:before{content:"\f260"} .fa-gg-circle:before{content:"\f261"} .fa-tripadvisor:before{content:"\f262"} .fa-odnoklassniki:before{content:"\f263"} .fa-odnoklassniki-square:before{content:"\f264"} .fa-get-pocket:before{content:"\f265"} .fa-wikipedia-w:before{content:"\f266"} .fa-safari:before{content:"\f267"} .fa-chrome:before{content:"\f268"} .fa-firefox:before{content:"\f269"} .fa-opera:before{content:"\f26a"} .fa-internet-explorer:before{content:"\f26b"} .fa-tv:before,.fa-television:before{content:"\f26c"} .fa-contao:before{content:"\f26d"} .fa-500px:before{content:"\f26e"} .fa-amazon:before{content:"\f270"} .fa-calendar-plus-o:before{content:"\f271"} .fa-calendar-minus-o:before{content:"\f272"} .fa-calendar-times-o:before{content:"\f273"} .fa-calendar-check-o:before{content:"\f274"} .fa-industry:before{content:"\f275"} .fa-map-pin:before{content:"\f276"} .fa-map-signs:before{content:"\f277"} .fa-map-o:before{content:"\f278"} .fa-map:before{content:"\f279"} .fa-commenting:before{content:"\f27a"} .fa-commenting-o:before{content:"\f27b"} .fa-houzz:before{content:"\f27c"} .fa-vimeo:before{content:"\f27d"} .fa-black-tie:before{content:"\f27e"} .fa-fonticons:before{content:"\f280"} .fa-reddit-alien:before{content:"\f281"} .fa-edge:before{content:"\f282"} .fa-credit-card-alt:before{content:"\f283"} .fa-codiepie:before{content:"\f284"} .fa-modx:before{content:"\f285"} .fa-fort-awesome:before{content:"\f286"} .fa-usb:before{content:"\f287"} .fa-product-hunt:before{content:"\f288"} .fa-mixcloud:before{content:"\f289"} .fa-scribd:before{content:"\f28a"} .fa-pause-circle:before{content:"\f28b"} .fa-pause-circle-o:before{content:"\f28c"} .fa-stop-circle:before{content:"\f28d"} .fa-stop-circle-o:before{content:"\f28e"} .fa-shopping-bag:before{content:"\f290"} .fa-shopping-basket:before{content:"\f291"} .fa-hashtag:before{content:"\f292"} .fa-bluetooth:before{content:"\f293"} .fa-bluetooth-b:before{content:"\f294"} .fa-percent:before{content:"\f295"} .fa-gitlab:before{content:"\f296"} .fa-wpbeginner:before{content:"\f297"} .fa-wpforms:before{content:"\f298"} .fa-envira:before{content:"\f299"} .fa-universal-access:before{content:"\f29a"} .fa-wheelchair-alt:before{content:"\f29b"} .fa-question-circle-o:before{content:"\f29c"} .fa-blind:before{content:"\f29d"} .fa-audio-description:before{content:"\f29e"} .fa-volume-control-phone:before{content:"\f2a0"} .fa-braille:before{content:"\f2a1"} .fa-assistive-listening-systems:before{content:"\f2a2"} .fa-asl-interpreting:before,.fa-american-sign-language-interpreting:before{content:"\f2a3"} .fa-deafness:before,.fa-hard-of-hearing:before,.fa-deaf:before{content:"\f2a4"} .fa-glide:before{content:"\f2a5"} .fa-glide-g:before{content:"\f2a6"} .fa-signing:before,.fa-sign-language:before{content:"\f2a7"} .fa-low-vision:before{content:"\f2a8"} .fa-viadeo:before{content:"\f2a9"} .fa-viadeo-square:before{content:"\f2aa"} .fa-snapchat:before{content:"\f2ab"} .fa-snapchat-ghost:before{content:"\f2ac"} .fa-snapchat-square:before{content:"\f2ad"} .fa-pied-piper:before{content:"\f2ae"} .fa-first-order:before{content:"\f2b0"} .fa-yoast:before{content:"\f2b1"} .fa-themeisle:before{content:"\f2b2"} .fa-google-plus-circle:before,.fa-google-plus-official:before{content:"\f2b3"} .fa-fa:before,.fa-font-awesome:before{content:"\f2b4"} .fa-handshake-o:before{content:"\f2b5"} .fa-envelope-open:before{content:"\f2b6"} .fa-envelope-open-o:before{content:"\f2b7"} .fa-linode:before{content:"\f2b8"} .fa-address-book:before{content:"\f2b9"} .fa-address-book-o:before{content:"\f2ba"} .fa-vcard:before,.fa-address-card:before{content:"\f2bb"} .fa-vcard-o:before,.fa-address-card-o:before{content:"\f2bc"} .fa-user-circle:before{content:"\f2bd"} .fa-user-circle-o:before{content:"\f2be"} .fa-user-o:before{content:"\f2c0"} .fa-id-badge:before{content:"\f2c1"} .fa-drivers-license:before,.fa-id-card:before{content:"\f2c2"} .fa-drivers-license-o:before,.fa-id-card-o:before{content:"\f2c3"} .fa-quora:before{content:"\f2c4"} .fa-free-code-camp:before{content:"\f2c5"} .fa-telegram:before{content:"\f2c6"} .fa-thermometer-4:before,.fa-thermometer:before,.fa-thermometer-full:before{content:"\f2c7"} .fa-thermometer-3:before,.fa-thermometer-three-quarters:before{content:"\f2c8"} .fa-thermometer-2:before,.fa-thermometer-half:before{content:"\f2c9"} .fa-thermometer-1:before,.fa-thermometer-quarter:before{content:"\f2ca"} .fa-thermometer-0:before,.fa-thermometer-empty:before{content:"\f2cb"} .fa-shower:before{content:"\f2cc"} .fa-bathtub:before,.fa-s15:before,.fa-bath:before{content:"\f2cd"} .fa-podcast:before{content:"\f2ce"} .fa-window-maximize:before{content:"\f2d0"} .fa-window-minimize:before{content:"\f2d1"} .fa-window-restore:before{content:"\f2d2"} .fa-times-rectangle:before,.fa-window-close:before{content:"\f2d3"} .fa-times-rectangle-o:before,.fa-window-close-o:before{content:"\f2d4"} .fa-bandcamp:before{content:"\f2d5"} .fa-grav:before{content:"\f2d6"} .fa-etsy:before{content:"\f2d7"} .fa-imdb:before{content:"\f2d8"} .fa-ravelry:before{content:"\f2d9"} .fa-eercast:before{content:"\f2da"} .fa-microchip:before{content:"\f2db"} .fa-snowflake-o:before{content:"\f2dc"} .fa-superpowers:before{content:"\f2dd"} .fa-wpexplorer:before{content:"\f2de"} .fa-meetup:before{content:"\f2e0"} .sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);border:0} .sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto} diff --git a/src/main/resources/public/libs/font-awesome/fonts/FontAwesome.otf b/mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/font-awesome/fonts/FontAwesome.otf similarity index 100% rename from src/main/resources/public/libs/font-awesome/fonts/FontAwesome.otf rename to mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/font-awesome/fonts/FontAwesome.otf diff --git a/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.eot b/mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.eot similarity index 100% rename from src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.eot rename to mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.eot diff --git a/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.svg b/mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.svg similarity index 100% rename from src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.svg rename to mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.svg diff --git a/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.ttf b/mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.ttf similarity index 100% rename from src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.ttf rename to mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.ttf diff --git a/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.woff b/mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.woff similarity index 100% rename from src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.woff rename to mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.woff diff --git a/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.woff2 b/mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.woff2 similarity index 100% rename from src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.woff2 rename to mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.woff2 diff --git a/src/main/resources/public/libs/jquery.fullscreen-min.js b/mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/jquery.fullscreen-min.js similarity index 100% rename from src/main/resources/public/libs/jquery.fullscreen-min.js rename to mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/jquery.fullscreen-min.js diff --git a/src/main/resources/public/libs/jquery.min.js b/mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/jquery.min.js similarity index 100% rename from src/main/resources/public/libs/jquery.min.js rename to mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/jquery.min.js diff --git a/mybatis-plus-generator-ui-starter-common/src/test/resources/application-test.properties b/mybatis-plus-generator-ui-starter-common/src/test/resources/application-test.properties new file mode 100644 index 0000000..73334b5 --- /dev/null +++ b/mybatis-plus-generator-ui-starter-common/src/test/resources/application-test.properties @@ -0,0 +1,4 @@ +spring.main.banner-mode=off +logging.level.root=off +logging.pattern.console=%m%n +spring.main.lazy-initialization=true \ No newline at end of file diff --git a/mybatis-plus-generator-ui-starter-webmvc-api/pom.xml b/mybatis-plus-generator-ui-starter-webmvc-api/pom.xml new file mode 100644 index 0000000..16f4d2d --- /dev/null +++ b/mybatis-plus-generator-ui-starter-webmvc-api/pom.xml @@ -0,0 +1,48 @@ + + 4.0.0 + + com.github.davidfantasy + mybatis-plus-generator-ui + 2.0.5 + + mybatis-plus-generator-ui-starter-webmvc-api + + + + com.github.davidfantasy + mybatis-plus-generator-ui-starter-common + ${project.version} + + + org.springframework + spring-webmvc + + + + org.springframework.boot + spring-boot-starter-actuator + true + + + jakarta.servlet + jakarta.servlet-api + provided + + + javax.money + money-api + test + + + org.hibernate.validator + hibernate-validator + test + + + org.projectlombok + lombok + true + + + \ No newline at end of file diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/controller/AutoCompleteController.java b/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api/AutoCompleteController.java similarity index 65% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/controller/AutoCompleteController.java rename to mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api/AutoCompleteController.java index 1f886be..946b895 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/controller/AutoCompleteController.java +++ b/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api/AutoCompleteController.java @@ -1,9 +1,9 @@ -package com.github.davidfantasy.mybatisplus.generatorui.controller; +package com.github.davidfantasy.mybatisplus.generatorui.webmvc.api.api; -import com.github.davidfantasy.mybatisplus.generatorui.ProjectPathResolver; -import com.github.davidfantasy.mybatisplus.generatorui.common.Result; -import com.github.davidfantasy.mybatisplus.generatorui.common.ResultGenerator; -import com.github.davidfantasy.mybatisplus.generatorui.service.AutoCompleteService; +import com.github.davidfantasy.mybatisplus.generatorui.common.ProjectPathResolver; +import com.github.davidfantasy.mybatisplus.generatorui.common.api.Result; +import com.github.davidfantasy.mybatisplus.generatorui.common.api.ResultGenerator; +import com.github.davidfantasy.mybatisplus.generatorui.common.service.AutoCompleteService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/controller/DatabaseController.java b/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api/DatabaseController.java similarity index 60% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/controller/DatabaseController.java rename to mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api/DatabaseController.java index c7bc2a8..7533e99 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/controller/DatabaseController.java +++ b/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api/DatabaseController.java @@ -1,9 +1,9 @@ -package com.github.davidfantasy.mybatisplus.generatorui.controller; +package com.github.davidfantasy.mybatisplus.generatorui.webmvc.api.api; -import com.github.davidfantasy.mybatisplus.generatorui.common.Result; -import com.github.davidfantasy.mybatisplus.generatorui.common.ResultGenerator; -import com.github.davidfantasy.mybatisplus.generatorui.dto.TableInfo; -import com.github.davidfantasy.mybatisplus.generatorui.service.DatabaseService; +import com.github.davidfantasy.mybatisplus.generatorui.common.api.Result; +import com.github.davidfantasy.mybatisplus.generatorui.common.api.ResultGenerator; +import com.github.davidfantasy.mybatisplus.generatorui.common.dto.TableInfo; +import com.github.davidfantasy.mybatisplus.generatorui.common.service.DatabaseService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/controller/MbpGeneratorController.java b/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api/MbpGeneratorController.java similarity index 63% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/controller/MbpGeneratorController.java rename to mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api/MbpGeneratorController.java index 055216a..bae091f 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/controller/MbpGeneratorController.java +++ b/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api/MbpGeneratorController.java @@ -1,9 +1,9 @@ -package com.github.davidfantasy.mybatisplus.generatorui.controller; +package com.github.davidfantasy.mybatisplus.generatorui.webmvc.api.api; -import com.github.davidfantasy.mybatisplus.generatorui.common.Result; -import com.github.davidfantasy.mybatisplus.generatorui.common.ResultGenerator; -import com.github.davidfantasy.mybatisplus.generatorui.dto.MpgGenCodeDto; -import com.github.davidfantasy.mybatisplus.generatorui.mbp.MbpGenerator; +import com.github.davidfantasy.mybatisplus.generatorui.common.api.Result; +import com.github.davidfantasy.mybatisplus.generatorui.common.api.ResultGenerator; +import com.github.davidfantasy.mybatisplus.generatorui.common.dto.MpgGenCodeDto; +import com.github.davidfantasy.mybatisplus.generatorui.common.mbp.MbpGenerator; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; diff --git a/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api/MultipleOpenApiActuatorResource.java b/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api/MultipleOpenApiActuatorResource.java new file mode 100644 index 0000000..bf52dba --- /dev/null +++ b/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api/MultipleOpenApiActuatorResource.java @@ -0,0 +1,27 @@ +package com.github.davidfantasy.mybatisplus.generatorui.webmvc.api.api; + +import com.fasterxml.jackson.core.JsonProcessingException; +import com.github.davidfantasy.mybatisplus.generatorui.common.api.Result; +import com.github.davidfantasy.mybatisplus.generatorui.common.api.ResultGenerator; +import org.springframework.boot.actuate.endpoint.web.annotation.RestControllerEndpoint; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PathVariable; + +import static com.github.davidfantasy.mybatisplus.generatorui.common.core.utils.Constants.DEFAULT_API_DOCS_ACTUATOR_URL; + +/** + * The type Multiple open api actuator resource. + * + * @author bnasslashen + */ +@RestControllerEndpoint(id = DEFAULT_API_DOCS_ACTUATOR_URL) +public class MultipleOpenApiActuatorResource { + + @GetMapping(value = "/{group}", produces = MediaType.APPLICATION_JSON_VALUE) + public Result openapiJson(@PathVariable String group) + throws JsonProcessingException { + return ResultGenerator.genSuccessResult("你好," + group); + } + +} diff --git a/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api/OpenApiWebMvcResource.java b/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api/OpenApiWebMvcResource.java new file mode 100644 index 0000000..5e1868b --- /dev/null +++ b/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api/OpenApiWebMvcResource.java @@ -0,0 +1,25 @@ +package com.github.davidfantasy.mybatisplus.generatorui.webmvc.api.api; + +import com.github.davidfantasy.mybatisplus.generatorui.common.api.Result; +import com.github.davidfantasy.mybatisplus.generatorui.common.api.ResultGenerator; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.http.MediaType; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.RestController; + +import static com.github.davidfantasy.mybatisplus.generatorui.common.core.utils.Constants.API_DOCS_URL; + +/** + * The type Open api resource. + * + * @author bnasslahsen + */ +@RestController +public class OpenApiWebMvcResource { + + @GetMapping(value = API_DOCS_URL, produces = MediaType.APPLICATION_JSON_VALUE) + public Result openapiJson(@Value(API_DOCS_URL) String apiDocsUrl) { + return ResultGenerator.genSuccessResult("你好," + apiDocsUrl); + } + +} \ No newline at end of file diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/controller/OutputFileInfoController.java b/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api/OutputFileInfoController.java similarity index 85% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/controller/OutputFileInfoController.java rename to mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api/OutputFileInfoController.java index c909601..18867fc 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/controller/OutputFileInfoController.java +++ b/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api/OutputFileInfoController.java @@ -1,12 +1,12 @@ -package com.github.davidfantasy.mybatisplus.generatorui.controller; - -import com.github.davidfantasy.mybatisplus.generatorui.ProjectPathResolver; -import com.github.davidfantasy.mybatisplus.generatorui.common.Result; -import com.github.davidfantasy.mybatisplus.generatorui.common.ResultGenerator; -import com.github.davidfantasy.mybatisplus.generatorui.dto.OutputFileInfo; -import com.github.davidfantasy.mybatisplus.generatorui.service.OutputFileInfoService; -import com.github.davidfantasy.mybatisplus.generatorui.service.UserConfigStore; -import com.github.davidfantasy.mybatisplus.generatorui.strategy.*; +package com.github.davidfantasy.mybatisplus.generatorui.webmvc.api.api; + +import com.github.davidfantasy.mybatisplus.generatorui.common.ProjectPathResolver; +import com.github.davidfantasy.mybatisplus.generatorui.common.api.Result; +import com.github.davidfantasy.mybatisplus.generatorui.common.api.ResultGenerator; +import com.github.davidfantasy.mybatisplus.generatorui.common.dto.OutputFileInfo; +import com.github.davidfantasy.mybatisplus.generatorui.common.service.OutputFileInfoService; +import com.github.davidfantasy.mybatisplus.generatorui.common.service.UserConfigStore; +import com.github.davidfantasy.mybatisplus.generatorui.common.strategy.*; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.*; diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/controller/SqlGeneratorController.java b/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api/SqlGeneratorController.java similarity index 62% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/controller/SqlGeneratorController.java rename to mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api/SqlGeneratorController.java index f4b2b4a..dc50b7e 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/controller/SqlGeneratorController.java +++ b/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api/SqlGeneratorController.java @@ -1,10 +1,10 @@ -package com.github.davidfantasy.mybatisplus.generatorui.controller; +package com.github.davidfantasy.mybatisplus.generatorui.webmvc.api.api; -import com.github.davidfantasy.mybatisplus.generatorui.GeneratorConfig; -import com.github.davidfantasy.mybatisplus.generatorui.common.Result; -import com.github.davidfantasy.mybatisplus.generatorui.common.ResultGenerator; -import com.github.davidfantasy.mybatisplus.generatorui.dto.GenDtoFromSqlReq; -import com.github.davidfantasy.mybatisplus.generatorui.service.SqlGeneratorService; +import com.github.davidfantasy.mybatisplus.generatorui.common.GeneratorConfig; +import com.github.davidfantasy.mybatisplus.generatorui.common.api.Result; +import com.github.davidfantasy.mybatisplus.generatorui.common.api.ResultGenerator; +import com.github.davidfantasy.mybatisplus.generatorui.common.dto.GenDtoFromSqlReq; +import com.github.davidfantasy.mybatisplus.generatorui.common.service.SqlGeneratorService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.web.bind.annotation.*; diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/controller/TemplateController.java b/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api/TemplateController.java similarity index 81% rename from src/main/java/com/github/davidfantasy/mybatisplus/generatorui/controller/TemplateController.java rename to mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api/TemplateController.java index 94c11c3..8b28bdf 100644 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/controller/TemplateController.java +++ b/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api/TemplateController.java @@ -1,14 +1,14 @@ -package com.github.davidfantasy.mybatisplus.generatorui.controller; +package com.github.davidfantasy.mybatisplus.generatorui.webmvc.api.api; import cn.hutool.core.io.IoUtil; -import com.github.davidfantasy.mybatisplus.generatorui.common.Result; -import com.github.davidfantasy.mybatisplus.generatorui.common.ResultGenerator; -import com.github.davidfantasy.mybatisplus.generatorui.common.ServiceException; -import com.github.davidfantasy.mybatisplus.generatorui.dto.OutputFileInfo; -import com.github.davidfantasy.mybatisplus.generatorui.dto.UserConfig; -import com.github.davidfantasy.mybatisplus.generatorui.service.OutputFileInfoService; -import com.github.davidfantasy.mybatisplus.generatorui.service.UserConfigStore; -import com.github.davidfantasy.mybatisplus.generatorui.util.TemplateUtil; +import com.github.davidfantasy.mybatisplus.generatorui.common.api.Result; +import com.github.davidfantasy.mybatisplus.generatorui.common.api.ResultGenerator; +import com.github.davidfantasy.mybatisplus.generatorui.common.api.ServiceException; +import com.github.davidfantasy.mybatisplus.generatorui.common.dto.OutputFileInfo; +import com.github.davidfantasy.mybatisplus.generatorui.common.dto.UserConfig; +import com.github.davidfantasy.mybatisplus.generatorui.common.service.OutputFileInfoService; +import com.github.davidfantasy.mybatisplus.generatorui.common.service.UserConfigStore; +import com.github.davidfantasy.mybatisplus.generatorui.common.util.TemplateUtil; import com.google.common.base.Strings; import com.google.common.collect.Maps; import lombok.extern.slf4j.Slf4j; diff --git a/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/core/RouterFunctionWebMvcProvider.java b/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/core/RouterFunctionWebMvcProvider.java new file mode 100644 index 0000000..871eaf2 --- /dev/null +++ b/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/core/RouterFunctionWebMvcProvider.java @@ -0,0 +1,41 @@ +/* + * + * * + * * * + * * * * Copyright 2019-2022 the original author or authors. + * * * * + * * * * Licensed under the Apache License, Version 2.0 (the "License"); + * * * * you may not use this file except in compliance with the License. + * * * * You may obtain a copy of the License at + * * * * + * * * * https://www.apache.org/licenses/LICENSE-2.0 + * * * * + * * * * Unless required by applicable law or agreed to in writing, software + * * * * distributed under the License is distributed on an "AS IS" BASIS, + * * * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * * * See the License for the specific language governing permissions and + * * * * limitations under the License. + * * * + * * + * + */ + +package com.github.davidfantasy.mybatisplus.generatorui.webmvc.api.core; + +import org.springframework.beans.BeansException; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationContextAware; + +public class RouterFunctionWebMvcProvider implements ApplicationContextAware { + + /** + * The Application context. + */ + private ApplicationContext applicationContext; + + @Override + public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { + this.applicationContext = applicationContext; + } + +} diff --git a/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/core/SpringDocWebMvcConfiguration.java b/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/core/SpringDocWebMvcConfiguration.java new file mode 100644 index 0000000..84aceef --- /dev/null +++ b/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/core/SpringDocWebMvcConfiguration.java @@ -0,0 +1,60 @@ +package com.github.davidfantasy.mybatisplus.generatorui.webmvc.api.core; + +import com.github.davidfantasy.mybatisplus.generatorui.common.core.configuration.SpringDocConfiguration; +import com.github.davidfantasy.mybatisplus.generatorui.common.core.providers.SpringWebProvider; +import org.springframework.boot.autoconfigure.condition.*; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Lazy; +import org.springframework.web.servlet.function.RouterFunction; + +import static com.github.davidfantasy.mybatisplus.generatorui.common.core.utils.Constants.SPRINGDOC_ENABLED; + +/** + * The type Spring doc web mvc configuration. + * + * @author bnasslahsen + */ +@Lazy(false) +@Configuration(proxyBeanMethods = false) +@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET) +@ConditionalOnProperty(name = SPRINGDOC_ENABLED, matchIfMissing = true) +@ConditionalOnBean(SpringDocConfiguration.class) +public class SpringDocWebMvcConfiguration { + + static { + } + + /** + * Spring web provider spring web provider. + * + * @return the spring web provider + */ + @Bean + @ConditionalOnMissingBean + @Lazy(false) + SpringWebProvider springWebProvider() { + return new SpringWebMvcProvider(); + } + + /** + * The type Spring doc web mvc router configuration. + * + * @author bnasslahsen + */ + @ConditionalOnClass(RouterFunction.class) + static class SpringDocWebMvcRouterConfiguration { + + /** + * Router function provider router function provider. + * + * @return the router function provider + */ + @Bean + @ConditionalOnMissingBean + @Lazy(false) + RouterFunctionWebMvcProvider routerFunctionProvider() { + return new RouterFunctionWebMvcProvider(); + } + } +} diff --git a/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/core/SpringWebMvcProvider.java b/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/core/SpringWebMvcProvider.java new file mode 100644 index 0000000..f001cd6 --- /dev/null +++ b/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/core/SpringWebMvcProvider.java @@ -0,0 +1,112 @@ +/* + * + * * + * * * + * * * * Copyright 2019-2022 the original author or authors. + * * * * + * * * * Licensed under the Apache License, Version 2.0 (the "License"); + * * * * you may not use this file except in compliance with the License. + * * * * You may obtain a copy of the License at + * * * * + * * * * https://www.apache.org/licenses/LICENSE-2.0 + * * * * + * * * * Unless required by applicable law or agreed to in writing, software + * * * * distributed under the License is distributed on an "AS IS" BASIS, + * * * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * * * See the License for the specific language governing permissions and + * * * * limitations under the License. + * * * + * * + * + */ +package com.github.davidfantasy.mybatisplus.generatorui.webmvc.api.core; + +import cn.hutool.core.util.StrUtil; +import com.github.davidfantasy.mybatisplus.generatorui.common.core.configuration.SpringDocConfigProperties; +import com.github.davidfantasy.mybatisplus.generatorui.common.core.providers.SpringWebProvider; +import org.springframework.util.CollectionUtils; +import org.springframework.web.method.HandlerMethod; +import org.springframework.web.servlet.handler.AbstractHandlerMethodMapping; +import org.springframework.web.servlet.mvc.condition.PathPatternsRequestCondition; +import org.springframework.web.servlet.mvc.condition.PatternsRequestCondition; +import org.springframework.web.servlet.mvc.method.RequestMappingInfo; +import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; + +import java.util.Collection; +import java.util.LinkedHashMap; +import java.util.Map; +import java.util.Map.Entry; +import java.util.Set; +import java.util.stream.Collectors; + +/** + * The type Spring web mvc provider. + * + * @author bnasslahsen + */ +public class SpringWebMvcProvider extends SpringWebProvider { + + /** + * Finds path prefix. + * + * @param springDocConfigProperties the spring doc config properties + * @return the path prefix + */ + @Override + public String findPathPrefix(SpringDocConfigProperties springDocConfigProperties) { + Map map = getHandlerMethods(); + for (Entry entry : map.entrySet()) { + RequestMappingInfo requestMappingInfo = entry.getKey(); + Set patterns = getActivePatterns(requestMappingInfo); + if (!CollectionUtils.isEmpty(patterns)) { + for (String operationPath : patterns) { + if (operationPath.endsWith(springDocConfigProperties.getApiDocs().getPath())) { + return operationPath.replace(springDocConfigProperties.getApiDocs().getPath(), StrUtil.EMPTY); + } + } + } + } + return StrUtil.EMPTY; + } + + /** + * Gets active patterns. + * + * @param requestMapping the request mapping info + * @return the active patterns + */ + @Override + public Set getActivePatterns(Object requestMapping) { + Set patterns = null; + RequestMappingInfo requestMappingInfo = (RequestMappingInfo) requestMapping; + PatternsRequestCondition patternsRequestCondition = requestMappingInfo.getPatternsCondition(); + if (patternsRequestCondition != null) { + patterns = patternsRequestCondition.getPatterns(); + } else { + PathPatternsRequestCondition pathPatternsRequestCondition = requestMappingInfo.getPathPatternsCondition(); + if (pathPatternsRequestCondition != null) { + patterns = pathPatternsRequestCondition.getPatternValues(); + } + } + return patterns; + } + + + /** + * Gets handler methods. + * + * @return the handler methods + */ + @Override + public Map getHandlerMethods() { + if (this.handlerMethods == null) { + Map beansOfTypeRequestMappingHandlerMapping = applicationContext.getBeansOfType(RequestMappingHandlerMapping.class); + this.handlerMethods = beansOfTypeRequestMappingHandlerMapping.values().stream() + .map(AbstractHandlerMethodMapping::getHandlerMethods) + .map(Map::entrySet) + .flatMap(Collection::stream) + .collect(Collectors.toMap(Entry::getKey, Entry::getValue, (a1, a2) -> a1, LinkedHashMap::new)); + } + return this.handlerMethods; + } +} diff --git a/mybatis-plus-generator-ui-starter-webmvc-api/src/main/resources/META-INF/spring.factories b/mybatis-plus-generator-ui-starter-webmvc-api/src/main/resources/META-INF/spring.factories new file mode 100644 index 0000000..f075dae --- /dev/null +++ b/mybatis-plus-generator-ui-starter-webmvc-api/src/main/resources/META-INF/spring.factories @@ -0,0 +1,2 @@ +org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ +com.github.davidfantasy.mybatisplus.generatorui.webmvc.api.core.SpringDocWebMvcConfiguration \ No newline at end of file diff --git a/mybatis-plus-generator-ui-starter-webmvc-ui/pom.xml b/mybatis-plus-generator-ui-starter-webmvc-ui/pom.xml new file mode 100644 index 0000000..83b5408 --- /dev/null +++ b/mybatis-plus-generator-ui-starter-webmvc-ui/pom.xml @@ -0,0 +1,38 @@ + + 4.0.0 + + com.github.davidfantasy + mybatis-plus-generator-ui + 2.0.5 + + mybatis-plus-generator-ui-starter-webmvc-ui + + + + com.github.davidfantasy + mybatis-plus-generator-ui-starter-webmvc-api + ${project.version} + + + jakarta.servlet + jakarta.servlet-api + provided + + + org.springframework.boot + spring-boot-starter-security + test + + + + org.springframework.boot + spring-boot-starter-actuator + true + + + org.apache.tomcat.embed + tomcat-embed-core + test + + + \ No newline at end of file diff --git a/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/ui/SwaggerConfig.java b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/ui/SwaggerConfig.java new file mode 100644 index 0000000..af4c2a5 --- /dev/null +++ b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/ui/SwaggerConfig.java @@ -0,0 +1,55 @@ +package com.github.davidfantasy.mybatisplus.generatorui.webmvc.ui; + +import com.github.davidfantasy.mybatisplus.generatorui.common.core.configuration.SpringDocConfiguration; +import com.github.davidfantasy.mybatisplus.generatorui.common.core.providers.SpringWebProvider; +import com.github.davidfantasy.mybatisplus.generatorui.webmvc.api.core.SpringWebMvcProvider; +import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; +import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Lazy; + +import static com.github.davidfantasy.mybatisplus.generatorui.common.core.utils.Constants.SPRINGDOC_SWAGGER_UI_ENABLED; +import static com.github.davidfantasy.mybatisplus.generatorui.common.core.utils.Constants.SPRINGDOC_USE_ROOT_PATH; + + +/** + * The type Swagger config. + * + * @author bnasslahsen + */ +@Lazy(false) +@Configuration(proxyBeanMethods = false) +@ConditionalOnProperty(name = SPRINGDOC_SWAGGER_UI_ENABLED, matchIfMissing = true) +@ConditionalOnWebApplication(type = Type.SERVLET) +@ConditionalOnBean(SpringDocConfiguration.class) +public class SwaggerConfig { + + /** + * Spring web provider spring web provider. + * + * @return the spring web provider + */ + @Bean + @ConditionalOnMissingBean + @Lazy(false) + SpringWebProvider springWebProvider() { + return new SpringWebMvcProvider(); + } + + /** + * Swagger ui home swagger ui home. + * + * @return the swagger ui home + */ + @Bean + @ConditionalOnMissingBean + @ConditionalOnProperty(name = SPRINGDOC_USE_ROOT_PATH, havingValue = "true") + @Lazy(false) + SwaggerUiHome swaggerUiHome() { + return new SwaggerUiHome(); + } +} diff --git a/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/ui/SwaggerUiHome.java b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/ui/SwaggerUiHome.java new file mode 100644 index 0000000..55f0dce --- /dev/null +++ b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/ui/SwaggerUiHome.java @@ -0,0 +1,64 @@ +/* + * + * * + * * * + * * * * + * * * * * Copyright 2019-2022 the original author or authors. + * * * * * + * * * * * Licensed under the Apache License, Version 2.0 (the "License"); + * * * * * you may not use this file except in compliance with the License. + * * * * * You may obtain a copy of the License at + * * * * * + * * * * * https://www.apache.org/licenses/LICENSE-2.0 + * * * * * + * * * * * Unless required by applicable law or agreed to in writing, software + * * * * * distributed under the License is distributed on an "AS IS" BASIS, + * * * * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * * * * See the License for the specific language governing permissions and + * * * * * limitations under the License. + * * * * + * * * + * * + * + */ + +package com.github.davidfantasy.mybatisplus.generatorui.webmvc.ui; + + +import com.github.davidfantasy.mybatisplus.generatorui.common.core.utils.SpringDocUtils; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.stereotype.Controller; +import org.springframework.web.bind.annotation.GetMapping; + +import static com.github.davidfantasy.mybatisplus.generatorui.common.core.utils.Constants.MVC_SERVLET_PATH; +import static com.github.davidfantasy.mybatisplus.generatorui.common.core.utils.Constants.SWAGGER_UI_PATH; +import static org.springframework.util.AntPathMatcher.DEFAULT_PATH_SEPARATOR; +import static org.springframework.web.servlet.view.UrlBasedViewResolver.REDIRECT_URL_PREFIX; + +/** + * Home redirection to swagger api documentation + */ +@Controller +public class SwaggerUiHome { + + @Value(SWAGGER_UI_PATH) + private String swaggerUiPath; + + @Value(MVC_SERVLET_PATH) + private String mvcServletPath; + + /** + * Index string. + * + * @return the string + */ + @GetMapping(DEFAULT_PATH_SEPARATOR) + public String index() { + StringBuilder uiRootPath = new StringBuilder(); + if (SpringDocUtils.isValidPath(mvcServletPath)) { + uiRootPath.append(mvcServletPath); + } + + return REDIRECT_URL_PREFIX + uiRootPath + swaggerUiPath; + } +} \ No newline at end of file diff --git a/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/META-INF/spring.factories b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/META-INF/spring.factories new file mode 100644 index 0000000..97eb537 --- /dev/null +++ b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/META-INF/spring.factories @@ -0,0 +1,2 @@ +org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ +com.github.davidfantasy.mybatisplus.generatorui.webmvc.ui.SwaggerConfig \ No newline at end of file diff --git a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/pom.xml b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/pom.xml new file mode 100644 index 0000000..ac9a450 --- /dev/null +++ b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/pom.xml @@ -0,0 +1,75 @@ + + + com.github.davidfantasy.mybatisplus.generatorui + mybatis-plus-generator-ui-tests + 2.0.5 + + 4.0.0 + jar + mybatis-plus-generator-ui-actuator-webmvc-tests + + + com.github.davidfantasy + mybatis-plus-generator-ui-starter-webmvc-api + ${project.version} + + + + org.springframework.boot + spring-boot-starter-web + + + + + org.springframework.boot + spring-boot-starter-test + test + + + + org.springframework.boot + spring-boot-starter-actuator + test + + + org.springframework.boot + spring-boot-test-autoconfigure + test + + + + org.springframework + spring-test + test + + + + + ${project.artifactId} + + + + org.springframework.boot + spring-boot-maven-plugin + ${spring-boot.version} + + com.github.davidfantasy.mybatisplus.generatorui.ServerApplication + true + + + + repackage + + repackage + + + + + + + + \ No newline at end of file diff --git a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/ControllerPrinter.java b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/ControllerPrinter.java new file mode 100644 index 0000000..fd6610e --- /dev/null +++ b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/ControllerPrinter.java @@ -0,0 +1,51 @@ +package com.github.davidfantasy.mybatisplus.generatorui; + +import cn.hutool.core.util.StrUtil; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.context.ApplicationContext; +import org.springframework.context.ApplicationEvent; +import org.springframework.context.ApplicationListener; +import org.springframework.core.annotation.AnnotatedElementUtils; +import org.springframework.core.annotation.AnnotationUtils; +import org.springframework.stereotype.Component; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.util.Arrays; +import java.util.Objects; + +/** + * 打印扫描到的接口 + * + * @author llq + * @Description ApplicationListener实现类 + */ +// @Component +public class ControllerPrinter implements ApplicationListener { + + @Autowired + private ApplicationContext applicationContext; + + @Override + public void onApplicationEvent(ApplicationEvent event) { + System.out.println("-----------------------"); + Arrays.stream(applicationContext.getBeanDefinitionNames()) + .filter(name -> Objects.requireNonNull(applicationContext.getType(name)) + .isAnnotationPresent(RestController.class)) + .forEach(controllerName -> { + Class controllerClass = applicationContext.getType(controllerName); + System.out.println("Controller: " + controllerClass.getName()); + + Arrays.stream(controllerClass.getDeclaredMethods()) + .filter(method -> + null != AnnotationUtils.findAnnotation(method, RequestMapping.class) + ) + .forEach(method -> { + RequestMapping annotation = AnnotatedElementUtils.getMergedAnnotation(method, RequestMapping.class); + System.out.printf("\tMethod: %s%n\t\tRequestMapping: %s%n", + method.getName(), + StrUtil.join(",", AnnotationUtils.getValue(annotation, "value"))); + }); + }); + } +} diff --git a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/ServerApplication.java b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/ServerApplication.java new file mode 100644 index 0000000..4a7c952 --- /dev/null +++ b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/ServerApplication.java @@ -0,0 +1,35 @@ +package com.github.davidfantasy.mybatisplus.generatorui; + +import com.github.davidfantasy.mybatisplus.generatorui.common.GeneratorConfig; +import com.github.davidfantasy.mybatisplus.generatorui.common.mbp.NameConverter; +import org.springframework.boot.SpringApplication; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +@SpringBootApplication +public class ServerApplication { + + public static void main(String[] args) { + GeneratorConfig config = GeneratorConfig.builder().jdbcUrl("jdbc:mysql://192.168.0.101:32888/test?allowMultiQueries=true&useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true&nullCatalogMeansCurrent=true&&allowPublicKeyRetrieval=true") + .userName("root") + .password("admin") + .port(18068) + .driverClassName("com.mysql.cj.jdbc.Driver") + .basePackage("com.github.davidfantasy.mybatisplus.generatorui.example") + //数据库表前缀,生成entity名称时会去掉 + .tablePrefix("t_") + .nameConverter(new NameConverter() { + @Override + public String serviceNameConvert(String entityName) { + return entityName + "Service"; + } + + @Override + public String controllerNameConvert(String entityName) { + return entityName + "Action"; + } + }) + .build(); + MybatisPlusToolsApplication.run(ServerApplication.class, args, config); + } + +} diff --git a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/main/resources/application.yaml b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/main/resources/application.yaml new file mode 100644 index 0000000..b44ae75 --- /dev/null +++ b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/main/resources/application.yaml @@ -0,0 +1,17 @@ +spring: + application: + name: yudao-server + # Jackson 配置项 + jackson: + serialization: + write-dates-as-timestamps: true # 设置 Date 的格式,使用时间戳 + write-date-timestamps-as-nanoseconds: false # 设置不使用 nanoseconds 的格式。例如说 1611460870.401,而是直接 1611460870401 + write-durations-as-timestamps: true # 设置 Duration 的格式,使用时间戳 + fail-on-empty-beans: false # 允许序列化无属性的 Bean + +debug: false +logging: + level: + root: debug +server: + port: 12454 \ No newline at end of file diff --git a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/AbstractCommonTest.java b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/AbstractCommonTest.java new file mode 100644 index 0000000..1dad19c --- /dev/null +++ b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/AbstractCommonTest.java @@ -0,0 +1,35 @@ +package com.github.davidfantasy.mybatisplus.generatorui; + +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; +import org.springframework.test.context.ActiveProfiles; +import org.springframework.test.context.TestPropertySource; +import org.springframework.test.web.servlet.MockMvc; +import org.springframework.test.web.servlet.MvcResult; + +import java.nio.charset.StandardCharsets; +import java.nio.file.Files; +import java.nio.file.Path; +import java.nio.file.Paths; + +@AutoConfigureMockMvc +@ActiveProfiles("test") +@TestPropertySource(properties = { "management.endpoints.enabled-by-default=false" }) +public abstract class AbstractCommonTest { + + @Autowired + protected MockMvc mockMvc; + + protected static String getContent(String fileName) { + try { + Path path = Paths.get(AbstractCommonTest.class.getClassLoader().getResource(fileName).toURI()); + byte[] fileBytes = Files.readAllBytes(path); + return new String(fileBytes, StandardCharsets.UTF_8); + } + catch (Exception e) { + throw new RuntimeException("Failed to read file: " + fileName, e); + } + } + + protected abstract MvcResult getMvcResult() throws Exception; +} diff --git a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/AbstractSpringDocTest.java b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/AbstractSpringDocTest.java new file mode 100644 index 0000000..b5849c6 --- /dev/null +++ b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/AbstractSpringDocTest.java @@ -0,0 +1,73 @@ +package com.github.davidfantasy.mybatisplus.generatorui; + +import com.github.davidfantasy.mybatisplus.generatorui.common.GeneratorConfig; +import com.github.davidfantasy.mybatisplus.generatorui.common.core.utils.Constants; +import com.github.davidfantasy.mybatisplus.generatorui.common.mbp.NameConverter; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.BeforeAll; +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.http.MediaType; +import org.springframework.test.web.servlet.MvcResult; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; + +import java.nio.charset.StandardCharsets; + +import static org.hamcrest.Matchers.is; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +@SpringBootTest(classes = TestApplication.class) +public abstract class AbstractSpringDocTest extends AbstractCommonTest { + + public static String className; + + /** + * 必须要这一段初始化代码, + * 不然jdbc不会配置, + * 启动不了测试 + */ + @BeforeAll + public static final void setUp() { + GeneratorConfig config = GeneratorConfig.builder().jdbcUrl("jdbc:mysql://192.168.0.101:32888/test?allowMultiQueries=true&useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true&nullCatalogMeansCurrent=true&&allowPublicKeyRetrieval=true") + .userName("root") + .password("admin") + .port(18068) + .driverClassName("com.mysql.cj.jdbc.Driver") + .basePackage("com.github.davidfantasy.mybatisplus.generatorui.example") + //数据库表前缀,生成entity名称时会去掉 + .tablePrefix("t_") + .nameConverter(new NameConverter() { + @Override + public String serviceNameConvert(String entityName) { + return entityName + "Service"; + } + + @Override + public String controllerNameConvert(String entityName) { + return entityName + "Action"; + } + }) + .build(); + MybatisPlusToolsApplication.run(TestApplication.class, new String[0], config); + } + + @Test + public void testApp() throws Exception { + className = getClass().getSimpleName(); + String testNumber = className.replaceAll("[^0-9]", ""); + MvcResult mockMvcResult = getMvcResult(); + String result = mockMvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8); + String expected = getContent("results/app" + testNumber + ".json"); + Assertions.assertEquals(expected, result); + } + + @Override + protected MvcResult getMvcResult() throws Exception { + return mockMvc.perform(MockMvcRequestBuilders.get(Constants.DEFAULT_API_DOCS_URL) + .contentType(MediaType.APPLICATION_JSON) //指定请求的contentType头信息 + .accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.code", is(200))).andReturn(); + } +} diff --git a/src/test/java/TestApplication.java b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/TestApplication.java similarity index 72% rename from src/test/java/TestApplication.java rename to mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/TestApplication.java index 4a9c652..3c359ea 100644 --- a/src/test/java/TestApplication.java +++ b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/TestApplication.java @@ -1,9 +1,11 @@ -import com.github.davidfantasy.mybatisplus.generatorui.GeneratorConfig; -import com.github.davidfantasy.mybatisplus.generatorui.MybatisPlusToolsApplication; -import com.github.davidfantasy.mybatisplus.generatorui.mbp.NameConverter; +package com.github.davidfantasy.mybatisplus.generatorui; -public class TestApplication { +import com.github.davidfantasy.mybatisplus.generatorui.common.GeneratorConfig; +import com.github.davidfantasy.mybatisplus.generatorui.common.mbp.NameConverter; +import org.springframework.boot.autoconfigure.SpringBootApplication; +@SpringBootApplication +public class TestApplication { public static void main(String[] args) { GeneratorConfig config = GeneratorConfig.builder().jdbcUrl("jdbc:mysql://localhost:3306/autoapi") @@ -26,7 +28,7 @@ public String controllerNameConvert(String entityName) { } }) .build(); - MybatisPlusToolsApplication.run(config); + MybatisPlusToolsApplication.run(TestApplication.class, args, config); } diff --git a/src/test/java/TestSqlParser.java b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/TestSqlParser.java similarity index 96% rename from src/test/java/TestSqlParser.java rename to mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/TestSqlParser.java index 78ef772..1cad593 100644 --- a/src/test/java/TestSqlParser.java +++ b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/TestSqlParser.java @@ -1,9 +1,11 @@ +package com.github.davidfantasy.mybatisplus.generatorui; + import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollectionUtil; import cn.hutool.core.util.ReUtil; import com.baomidou.mybatisplus.generator.config.DataSourceConfig; -import com.github.davidfantasy.mybatisplus.generatorui.sqlparser.ConditionExpr; -import com.github.davidfantasy.mybatisplus.generatorui.sqlparser.DynamicParamSqlEnhancer; +import com.github.davidfantasy.mybatisplus.generatorui.common.sqlparser.ConditionExpr; +import com.github.davidfantasy.mybatisplus.generatorui.common.sqlparser.DynamicParamSqlEnhancer; import com.google.common.collect.Lists; import net.sf.jsqlparser.JSQLParserException; import net.sf.jsqlparser.expression.LongValue; diff --git a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/app2/SpringDocApp2Test.java b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/app2/SpringDocApp2Test.java new file mode 100644 index 0000000..9d0b129 --- /dev/null +++ b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/app2/SpringDocApp2Test.java @@ -0,0 +1,29 @@ +/* + * + * * Copyright 2019-2020 the original author or authors. + * * + * * Licensed under the Apache License, Version 2.0 (the "License"); + * * you may not use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * https://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * + */ + +package com.github.davidfantasy.mybatisplus.generatorui.app2; + +import com.github.davidfantasy.mybatisplus.generatorui.AbstractSpringDocTest; +import org.springframework.boot.autoconfigure.SpringBootApplication; + +/** + * 按照Spring Doc标准进行的单元测试 + */ +public class SpringDocApp2Test extends AbstractSpringDocTest { + +} \ No newline at end of file diff --git a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/app3/SpringDocApp3Test.java b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/app3/SpringDocApp3Test.java new file mode 100644 index 0000000..604981d --- /dev/null +++ b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/app3/SpringDocApp3Test.java @@ -0,0 +1,39 @@ +/* + * + * * Copyright 2019-2020 the original author or authors. + * * + * * Licensed under the Apache License, Version 2.0 (the "License"); + * * you may not use this file except in compliance with the License. + * * You may obtain a copy of the License at + * * + * * https://www.apache.org/licenses/LICENSE-2.0 + * * + * * Unless required by applicable law or agreed to in writing, software + * * distributed under the License is distributed on an "AS IS" BASIS, + * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * See the License for the specific language governing permissions and + * * limitations under the License. + * + */ + +package com.github.davidfantasy.mybatisplus.generatorui.app3; + +import com.github.davidfantasy.mybatisplus.generatorui.AbstractSpringDocTest; +import org.springframework.http.MediaType; +import org.springframework.test.web.servlet.MvcResult; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; + +import static org.hamcrest.Matchers.is; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +public class SpringDocApp3Test extends AbstractSpringDocTest { + @Override + protected MvcResult getMvcResult() throws Exception { + return mockMvc.perform(MockMvcRequestBuilders.get("/api/db/tables") + .contentType(MediaType.APPLICATION_JSON) //指定请求的contentType头信息 + .accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.code", is(200))).andReturn(); + } +} \ No newline at end of file diff --git a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/resources/application-test.properties b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/resources/application-test.properties new file mode 100644 index 0000000..c7338ab --- /dev/null +++ b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/resources/application-test.properties @@ -0,0 +1,5 @@ +spring.main.banner-mode=off +logging.level.root=debug +debug=true +logging.pattern.console=%m%n +spring.main.lazy-initialization=true \ No newline at end of file diff --git a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/resources/logback-test.xml b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/resources/logback-test.xml new file mode 100644 index 0000000..3fd46cf --- /dev/null +++ b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/resources/logback-test.xml @@ -0,0 +1,5 @@ + + + + + \ No newline at end of file diff --git a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/resources/results/app2.json b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/resources/results/app2.json new file mode 100644 index 0000000..fc289fc --- /dev/null +++ b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/resources/results/app2.json @@ -0,0 +1 @@ +{"code":200,"message":"SUCCESS","data":"你好,/v3/api-docs"} \ No newline at end of file diff --git a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/resources/results/app3.json b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/resources/results/app3.json new file mode 100644 index 0000000..3dc9b03 --- /dev/null +++ b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/resources/results/app3.json @@ -0,0 +1 @@ +{"code":200,"message":"SUCCESS","data":[{"name":"Logs","comment":""},{"name":"Scores","comment":""},{"name":"axasd","comment":""},{"name":"car_lane","comment":"车道"},{"name":"emp_details","comment":""},{"name":"s_table","comment":""},{"name":"student","comment":""},{"name":"t_order_0","comment":""},{"name":"t_order_1","comment":""},{"name":"vc","comment":""}]} \ No newline at end of file diff --git a/mybatis-plus-generator-ui-tests/pom.xml b/mybatis-plus-generator-ui-tests/pom.xml new file mode 100644 index 0000000..3f9ccf0 --- /dev/null +++ b/mybatis-plus-generator-ui-tests/pom.xml @@ -0,0 +1,18 @@ + + + + com.github.davidfantasy + mybatis-plus-generator-ui + 2.0.5 + + 4.0.0 + com.github.davidfantasy.mybatisplus.generatorui + mybatis-plus-generator-ui-tests + mybatis-plus-generator-ui-tests + mybatis-plus-generator-ui-tests + pom + + mybatis-plus-generator-ui-actuator-webmvc-tests + + diff --git a/pom.xml b/pom.xml index f6f09aa..baac077 100644 --- a/pom.xml +++ b/pom.xml @@ -1,11 +1,12 @@ - com.github.davidfantasy mybatis-plus-generator-ui 2.0.5 4.0.0 + pom mybatis-plus-generator-ui mybatis-plus code generator with UI @@ -39,6 +40,13 @@ 3.5.7 + + mybatis-plus-generator-ui-starter-common + mybatis-plus-generator-ui-starter-webmvc-api + mybatis-plus-generator-ui-starter-webmvc-ui + mybatis-plus-generator-ui-tests + + @@ -57,67 +65,21 @@ org.springframework.boot spring-boot-starter-web - - org.springframework.boot - spring-boot-starter-jdbc - cn.hutool hutool-core 5.8.19 - com.baomidou - mybatis-plus-generator - ${mybatis-plus.version} - - - com.baomidou - mybatis-plus-annotation - ${mybatis-plus.version} - - - com.baomidou - mybatis-plus-core - ${mybatis-plus.version} - - - com.ibeetl - beetl - 3.15.4.RELEASE - - - org.projectlombok - lombok - 1.18.34 - provided - - - org.dom4j - dom4j - 2.1.4 - - - - com.alibaba - druid - 1.2.23 - - - com.github.jsqlparser - jsqlparser - 4.9 - - - com.github.javaparser - javaparser-symbol-solver-core - 3.26.1 + mysql + mysql-connector-java + 8.0.33 org.springframework.boot spring-boot-starter-test + ${spring-boot.version} test - org.junit.vintage @@ -125,26 +87,22 @@ - - mysql - mysql-connector-java - 8.0.33 - test - - - - maven-compiler-plugin - 3.10.0 - - ${java.version} - ${java.version} - UTF-8 - - - + + + + maven-compiler-plugin + 3.10.0 + + ${java.version} + ${java.version} + UTF-8 + + + + diff --git a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dto/ElementPosition.java b/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dto/ElementPosition.java deleted file mode 100644 index 990c5a2..0000000 --- a/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/dto/ElementPosition.java +++ /dev/null @@ -1,5 +0,0 @@ -package com.github.davidfantasy.mybatisplus.generatorui.dto; - -public enum ElementPosition { - FIRST, LAST -} diff --git a/src/main/resources/application.yml b/src/main/resources/application.yml deleted file mode 100644 index e69de29..0000000 diff --git a/src/main/resources/public/libs/font-awesome/css/font-awesome.min.css b/src/main/resources/public/libs/font-awesome/css/font-awesome.min.css deleted file mode 100644 index 540440c..0000000 --- a/src/main/resources/public/libs/font-awesome/css/font-awesome.min.css +++ /dev/null @@ -1,4 +0,0 @@ -/*! - * Font Awesome 4.7.0 by @davegandy - http://fontawesome.io - @fontawesome - * License - http://fontawesome.io/license (Font: SIL OFL 1.1, CSS: MIT License) - */@font-face{font-family:'FontAwesome';src:url('../fonts/fontawesome-webfont.eot?v=4.7.0');src:url('../fonts/fontawesome-webfont.eot?#iefix&v=4.7.0') format('embedded-opentype'),url('../fonts/fontawesome-webfont.woff2?v=4.7.0') format('woff2'),url('../fonts/fontawesome-webfont.woff?v=4.7.0') format('woff'),url('../fonts/fontawesome-webfont.ttf?v=4.7.0') format('truetype'),url('../fonts/fontawesome-webfont.svg?v=4.7.0#fontawesomeregular') format('svg');font-weight:normal;font-style:normal}.fa{display:inline-block;font:normal normal normal 14px/1 FontAwesome;font-size:inherit;text-rendering:auto;-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}.fa-lg{font-size:1.33333333em;line-height:.75em;vertical-align:-15%}.fa-2x{font-size:2em}.fa-3x{font-size:3em}.fa-4x{font-size:4em}.fa-5x{font-size:5em}.fa-fw{width:1.28571429em;text-align:center}.fa-ul{padding-left:0;margin-left:2.14285714em;list-style-type:none}.fa-ul>li{position:relative}.fa-li{position:absolute;left:-2.14285714em;width:2.14285714em;top:.14285714em;text-align:center}.fa-li.fa-lg{left:-1.85714286em}.fa-border{padding:.2em .25em .15em;border:solid .08em #eee;border-radius:.1em}.fa-pull-left{float:left}.fa-pull-right{float:right}.fa.fa-pull-left{margin-right:.3em}.fa.fa-pull-right{margin-left:.3em}.pull-right{float:right}.pull-left{float:left}.fa.pull-left{margin-right:.3em}.fa.pull-right{margin-left:.3em}.fa-spin{-webkit-animation:fa-spin 2s infinite linear;animation:fa-spin 2s infinite linear}.fa-pulse{-webkit-animation:fa-spin 1s infinite steps(8);animation:fa-spin 1s infinite steps(8)}@-webkit-keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}@keyframes fa-spin{0%{-webkit-transform:rotate(0deg);transform:rotate(0deg)}100%{-webkit-transform:rotate(359deg);transform:rotate(359deg)}}.fa-rotate-90{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=1)";-webkit-transform:rotate(90deg);-ms-transform:rotate(90deg);transform:rotate(90deg)}.fa-rotate-180{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2)";-webkit-transform:rotate(180deg);-ms-transform:rotate(180deg);transform:rotate(180deg)}.fa-rotate-270{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=3)";-webkit-transform:rotate(270deg);-ms-transform:rotate(270deg);transform:rotate(270deg)}.fa-flip-horizontal{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=0, mirror=1)";-webkit-transform:scale(-1, 1);-ms-transform:scale(-1, 1);transform:scale(-1, 1)}.fa-flip-vertical{-ms-filter:"progid:DXImageTransform.Microsoft.BasicImage(rotation=2, mirror=1)";-webkit-transform:scale(1, -1);-ms-transform:scale(1, -1);transform:scale(1, -1)}:root .fa-rotate-90,:root .fa-rotate-180,:root .fa-rotate-270,:root .fa-flip-horizontal,:root .fa-flip-vertical{filter:none}.fa-stack{position:relative;display:inline-block;width:2em;height:2em;line-height:2em;vertical-align:middle}.fa-stack-1x,.fa-stack-2x{position:absolute;left:0;width:100%;text-align:center}.fa-stack-1x{line-height:inherit}.fa-stack-2x{font-size:2em}.fa-inverse{color:#fff}.fa-glass:before{content:"\f000"}.fa-music:before{content:"\f001"}.fa-search:before{content:"\f002"}.fa-envelope-o:before{content:"\f003"}.fa-heart:before{content:"\f004"}.fa-star:before{content:"\f005"}.fa-star-o:before{content:"\f006"}.fa-user:before{content:"\f007"}.fa-film:before{content:"\f008"}.fa-th-large:before{content:"\f009"}.fa-th:before{content:"\f00a"}.fa-th-list:before{content:"\f00b"}.fa-check:before{content:"\f00c"}.fa-remove:before,.fa-close:before,.fa-times:before{content:"\f00d"}.fa-search-plus:before{content:"\f00e"}.fa-search-minus:before{content:"\f010"}.fa-power-off:before{content:"\f011"}.fa-signal:before{content:"\f012"}.fa-gear:before,.fa-cog:before{content:"\f013"}.fa-trash-o:before{content:"\f014"}.fa-home:before{content:"\f015"}.fa-file-o:before{content:"\f016"}.fa-clock-o:before{content:"\f017"}.fa-road:before{content:"\f018"}.fa-download:before{content:"\f019"}.fa-arrow-circle-o-down:before{content:"\f01a"}.fa-arrow-circle-o-up:before{content:"\f01b"}.fa-inbox:before{content:"\f01c"}.fa-play-circle-o:before{content:"\f01d"}.fa-rotate-right:before,.fa-repeat:before{content:"\f01e"}.fa-refresh:before{content:"\f021"}.fa-list-alt:before{content:"\f022"}.fa-lock:before{content:"\f023"}.fa-flag:before{content:"\f024"}.fa-headphones:before{content:"\f025"}.fa-volume-off:before{content:"\f026"}.fa-volume-down:before{content:"\f027"}.fa-volume-up:before{content:"\f028"}.fa-qrcode:before{content:"\f029"}.fa-barcode:before{content:"\f02a"}.fa-tag:before{content:"\f02b"}.fa-tags:before{content:"\f02c"}.fa-book:before{content:"\f02d"}.fa-bookmark:before{content:"\f02e"}.fa-print:before{content:"\f02f"}.fa-camera:before{content:"\f030"}.fa-font:before{content:"\f031"}.fa-bold:before{content:"\f032"}.fa-italic:before{content:"\f033"}.fa-text-height:before{content:"\f034"}.fa-text-width:before{content:"\f035"}.fa-align-left:before{content:"\f036"}.fa-align-center:before{content:"\f037"}.fa-align-right:before{content:"\f038"}.fa-align-justify:before{content:"\f039"}.fa-list:before{content:"\f03a"}.fa-dedent:before,.fa-outdent:before{content:"\f03b"}.fa-indent:before{content:"\f03c"}.fa-video-camera:before{content:"\f03d"}.fa-photo:before,.fa-image:before,.fa-picture-o:before{content:"\f03e"}.fa-pencil:before{content:"\f040"}.fa-map-marker:before{content:"\f041"}.fa-adjust:before{content:"\f042"}.fa-tint:before{content:"\f043"}.fa-edit:before,.fa-pencil-square-o:before{content:"\f044"}.fa-share-square-o:before{content:"\f045"}.fa-check-square-o:before{content:"\f046"}.fa-arrows:before{content:"\f047"}.fa-step-backward:before{content:"\f048"}.fa-fast-backward:before{content:"\f049"}.fa-backward:before{content:"\f04a"}.fa-play:before{content:"\f04b"}.fa-pause:before{content:"\f04c"}.fa-stop:before{content:"\f04d"}.fa-forward:before{content:"\f04e"}.fa-fast-forward:before{content:"\f050"}.fa-step-forward:before{content:"\f051"}.fa-eject:before{content:"\f052"}.fa-chevron-left:before{content:"\f053"}.fa-chevron-right:before{content:"\f054"}.fa-plus-circle:before{content:"\f055"}.fa-minus-circle:before{content:"\f056"}.fa-times-circle:before{content:"\f057"}.fa-check-circle:before{content:"\f058"}.fa-question-circle:before{content:"\f059"}.fa-info-circle:before{content:"\f05a"}.fa-crosshairs:before{content:"\f05b"}.fa-times-circle-o:before{content:"\f05c"}.fa-check-circle-o:before{content:"\f05d"}.fa-ban:before{content:"\f05e"}.fa-arrow-left:before{content:"\f060"}.fa-arrow-right:before{content:"\f061"}.fa-arrow-up:before{content:"\f062"}.fa-arrow-down:before{content:"\f063"}.fa-mail-forward:before,.fa-share:before{content:"\f064"}.fa-expand:before{content:"\f065"}.fa-compress:before{content:"\f066"}.fa-plus:before{content:"\f067"}.fa-minus:before{content:"\f068"}.fa-asterisk:before{content:"\f069"}.fa-exclamation-circle:before{content:"\f06a"}.fa-gift:before{content:"\f06b"}.fa-leaf:before{content:"\f06c"}.fa-fire:before{content:"\f06d"}.fa-eye:before{content:"\f06e"}.fa-eye-slash:before{content:"\f070"}.fa-warning:before,.fa-exclamation-triangle:before{content:"\f071"}.fa-plane:before{content:"\f072"}.fa-calendar:before{content:"\f073"}.fa-random:before{content:"\f074"}.fa-comment:before{content:"\f075"}.fa-magnet:before{content:"\f076"}.fa-chevron-up:before{content:"\f077"}.fa-chevron-down:before{content:"\f078"}.fa-retweet:before{content:"\f079"}.fa-shopping-cart:before{content:"\f07a"}.fa-folder:before{content:"\f07b"}.fa-folder-open:before{content:"\f07c"}.fa-arrows-v:before{content:"\f07d"}.fa-arrows-h:before{content:"\f07e"}.fa-bar-chart-o:before,.fa-bar-chart:before{content:"\f080"}.fa-twitter-square:before{content:"\f081"}.fa-facebook-square:before{content:"\f082"}.fa-camera-retro:before{content:"\f083"}.fa-key:before{content:"\f084"}.fa-gears:before,.fa-cogs:before{content:"\f085"}.fa-comments:before{content:"\f086"}.fa-thumbs-o-up:before{content:"\f087"}.fa-thumbs-o-down:before{content:"\f088"}.fa-star-half:before{content:"\f089"}.fa-heart-o:before{content:"\f08a"}.fa-sign-out:before{content:"\f08b"}.fa-linkedin-square:before{content:"\f08c"}.fa-thumb-tack:before{content:"\f08d"}.fa-external-link:before{content:"\f08e"}.fa-sign-in:before{content:"\f090"}.fa-trophy:before{content:"\f091"}.fa-github-square:before{content:"\f092"}.fa-upload:before{content:"\f093"}.fa-lemon-o:before{content:"\f094"}.fa-phone:before{content:"\f095"}.fa-square-o:before{content:"\f096"}.fa-bookmark-o:before{content:"\f097"}.fa-phone-square:before{content:"\f098"}.fa-twitter:before{content:"\f099"}.fa-facebook-f:before,.fa-facebook:before{content:"\f09a"}.fa-github:before{content:"\f09b"}.fa-unlock:before{content:"\f09c"}.fa-credit-card:before{content:"\f09d"}.fa-feed:before,.fa-rss:before{content:"\f09e"}.fa-hdd-o:before{content:"\f0a0"}.fa-bullhorn:before{content:"\f0a1"}.fa-bell:before{content:"\f0f3"}.fa-certificate:before{content:"\f0a3"}.fa-hand-o-right:before{content:"\f0a4"}.fa-hand-o-left:before{content:"\f0a5"}.fa-hand-o-up:before{content:"\f0a6"}.fa-hand-o-down:before{content:"\f0a7"}.fa-arrow-circle-left:before{content:"\f0a8"}.fa-arrow-circle-right:before{content:"\f0a9"}.fa-arrow-circle-up:before{content:"\f0aa"}.fa-arrow-circle-down:before{content:"\f0ab"}.fa-globe:before{content:"\f0ac"}.fa-wrench:before{content:"\f0ad"}.fa-tasks:before{content:"\f0ae"}.fa-filter:before{content:"\f0b0"}.fa-briefcase:before{content:"\f0b1"}.fa-arrows-alt:before{content:"\f0b2"}.fa-group:before,.fa-users:before{content:"\f0c0"}.fa-chain:before,.fa-link:before{content:"\f0c1"}.fa-cloud:before{content:"\f0c2"}.fa-flask:before{content:"\f0c3"}.fa-cut:before,.fa-scissors:before{content:"\f0c4"}.fa-copy:before,.fa-files-o:before{content:"\f0c5"}.fa-paperclip:before{content:"\f0c6"}.fa-save:before,.fa-floppy-o:before{content:"\f0c7"}.fa-square:before{content:"\f0c8"}.fa-navicon:before,.fa-reorder:before,.fa-bars:before{content:"\f0c9"}.fa-list-ul:before{content:"\f0ca"}.fa-list-ol:before{content:"\f0cb"}.fa-strikethrough:before{content:"\f0cc"}.fa-underline:before{content:"\f0cd"}.fa-table:before{content:"\f0ce"}.fa-magic:before{content:"\f0d0"}.fa-truck:before{content:"\f0d1"}.fa-pinterest:before{content:"\f0d2"}.fa-pinterest-square:before{content:"\f0d3"}.fa-google-plus-square:before{content:"\f0d4"}.fa-google-plus:before{content:"\f0d5"}.fa-money:before{content:"\f0d6"}.fa-caret-down:before{content:"\f0d7"}.fa-caret-up:before{content:"\f0d8"}.fa-caret-left:before{content:"\f0d9"}.fa-caret-right:before{content:"\f0da"}.fa-columns:before{content:"\f0db"}.fa-unsorted:before,.fa-sort:before{content:"\f0dc"}.fa-sort-down:before,.fa-sort-desc:before{content:"\f0dd"}.fa-sort-up:before,.fa-sort-asc:before{content:"\f0de"}.fa-envelope:before{content:"\f0e0"}.fa-linkedin:before{content:"\f0e1"}.fa-rotate-left:before,.fa-undo:before{content:"\f0e2"}.fa-legal:before,.fa-gavel:before{content:"\f0e3"}.fa-dashboard:before,.fa-tachometer:before{content:"\f0e4"}.fa-comment-o:before{content:"\f0e5"}.fa-comments-o:before{content:"\f0e6"}.fa-flash:before,.fa-bolt:before{content:"\f0e7"}.fa-sitemap:before{content:"\f0e8"}.fa-umbrella:before{content:"\f0e9"}.fa-paste:before,.fa-clipboard:before{content:"\f0ea"}.fa-lightbulb-o:before{content:"\f0eb"}.fa-exchange:before{content:"\f0ec"}.fa-cloud-download:before{content:"\f0ed"}.fa-cloud-upload:before{content:"\f0ee"}.fa-user-md:before{content:"\f0f0"}.fa-stethoscope:before{content:"\f0f1"}.fa-suitcase:before{content:"\f0f2"}.fa-bell-o:before{content:"\f0a2"}.fa-coffee:before{content:"\f0f4"}.fa-cutlery:before{content:"\f0f5"}.fa-file-text-o:before{content:"\f0f6"}.fa-building-o:before{content:"\f0f7"}.fa-hospital-o:before{content:"\f0f8"}.fa-ambulance:before{content:"\f0f9"}.fa-medkit:before{content:"\f0fa"}.fa-fighter-jet:before{content:"\f0fb"}.fa-beer:before{content:"\f0fc"}.fa-h-square:before{content:"\f0fd"}.fa-plus-square:before{content:"\f0fe"}.fa-angle-double-left:before{content:"\f100"}.fa-angle-double-right:before{content:"\f101"}.fa-angle-double-up:before{content:"\f102"}.fa-angle-double-down:before{content:"\f103"}.fa-angle-left:before{content:"\f104"}.fa-angle-right:before{content:"\f105"}.fa-angle-up:before{content:"\f106"}.fa-angle-down:before{content:"\f107"}.fa-desktop:before{content:"\f108"}.fa-laptop:before{content:"\f109"}.fa-tablet:before{content:"\f10a"}.fa-mobile-phone:before,.fa-mobile:before{content:"\f10b"}.fa-circle-o:before{content:"\f10c"}.fa-quote-left:before{content:"\f10d"}.fa-quote-right:before{content:"\f10e"}.fa-spinner:before{content:"\f110"}.fa-circle:before{content:"\f111"}.fa-mail-reply:before,.fa-reply:before{content:"\f112"}.fa-github-alt:before{content:"\f113"}.fa-folder-o:before{content:"\f114"}.fa-folder-open-o:before{content:"\f115"}.fa-smile-o:before{content:"\f118"}.fa-frown-o:before{content:"\f119"}.fa-meh-o:before{content:"\f11a"}.fa-gamepad:before{content:"\f11b"}.fa-keyboard-o:before{content:"\f11c"}.fa-flag-o:before{content:"\f11d"}.fa-flag-checkered:before{content:"\f11e"}.fa-terminal:before{content:"\f120"}.fa-code:before{content:"\f121"}.fa-mail-reply-all:before,.fa-reply-all:before{content:"\f122"}.fa-star-half-empty:before,.fa-star-half-full:before,.fa-star-half-o:before{content:"\f123"}.fa-location-arrow:before{content:"\f124"}.fa-crop:before{content:"\f125"}.fa-code-fork:before{content:"\f126"}.fa-unlink:before,.fa-chain-broken:before{content:"\f127"}.fa-question:before{content:"\f128"}.fa-info:before{content:"\f129"}.fa-exclamation:before{content:"\f12a"}.fa-superscript:before{content:"\f12b"}.fa-subscript:before{content:"\f12c"}.fa-eraser:before{content:"\f12d"}.fa-puzzle-piece:before{content:"\f12e"}.fa-microphone:before{content:"\f130"}.fa-microphone-slash:before{content:"\f131"}.fa-shield:before{content:"\f132"}.fa-calendar-o:before{content:"\f133"}.fa-fire-extinguisher:before{content:"\f134"}.fa-rocket:before{content:"\f135"}.fa-maxcdn:before{content:"\f136"}.fa-chevron-circle-left:before{content:"\f137"}.fa-chevron-circle-right:before{content:"\f138"}.fa-chevron-circle-up:before{content:"\f139"}.fa-chevron-circle-down:before{content:"\f13a"}.fa-html5:before{content:"\f13b"}.fa-css3:before{content:"\f13c"}.fa-anchor:before{content:"\f13d"}.fa-unlock-alt:before{content:"\f13e"}.fa-bullseye:before{content:"\f140"}.fa-ellipsis-h:before{content:"\f141"}.fa-ellipsis-v:before{content:"\f142"}.fa-rss-square:before{content:"\f143"}.fa-play-circle:before{content:"\f144"}.fa-ticket:before{content:"\f145"}.fa-minus-square:before{content:"\f146"}.fa-minus-square-o:before{content:"\f147"}.fa-level-up:before{content:"\f148"}.fa-level-down:before{content:"\f149"}.fa-check-square:before{content:"\f14a"}.fa-pencil-square:before{content:"\f14b"}.fa-external-link-square:before{content:"\f14c"}.fa-share-square:before{content:"\f14d"}.fa-compass:before{content:"\f14e"}.fa-toggle-down:before,.fa-caret-square-o-down:before{content:"\f150"}.fa-toggle-up:before,.fa-caret-square-o-up:before{content:"\f151"}.fa-toggle-right:before,.fa-caret-square-o-right:before{content:"\f152"}.fa-euro:before,.fa-eur:before{content:"\f153"}.fa-gbp:before{content:"\f154"}.fa-dollar:before,.fa-usd:before{content:"\f155"}.fa-rupee:before,.fa-inr:before{content:"\f156"}.fa-cny:before,.fa-rmb:before,.fa-yen:before,.fa-jpy:before{content:"\f157"}.fa-ruble:before,.fa-rouble:before,.fa-rub:before{content:"\f158"}.fa-won:before,.fa-krw:before{content:"\f159"}.fa-bitcoin:before,.fa-btc:before{content:"\f15a"}.fa-file:before{content:"\f15b"}.fa-file-text:before{content:"\f15c"}.fa-sort-alpha-asc:before{content:"\f15d"}.fa-sort-alpha-desc:before{content:"\f15e"}.fa-sort-amount-asc:before{content:"\f160"}.fa-sort-amount-desc:before{content:"\f161"}.fa-sort-numeric-asc:before{content:"\f162"}.fa-sort-numeric-desc:before{content:"\f163"}.fa-thumbs-up:before{content:"\f164"}.fa-thumbs-down:before{content:"\f165"}.fa-youtube-square:before{content:"\f166"}.fa-youtube:before{content:"\f167"}.fa-xing:before{content:"\f168"}.fa-xing-square:before{content:"\f169"}.fa-youtube-play:before{content:"\f16a"}.fa-dropbox:before{content:"\f16b"}.fa-stack-overflow:before{content:"\f16c"}.fa-instagram:before{content:"\f16d"}.fa-flickr:before{content:"\f16e"}.fa-adn:before{content:"\f170"}.fa-bitbucket:before{content:"\f171"}.fa-bitbucket-square:before{content:"\f172"}.fa-tumblr:before{content:"\f173"}.fa-tumblr-square:before{content:"\f174"}.fa-long-arrow-down:before{content:"\f175"}.fa-long-arrow-up:before{content:"\f176"}.fa-long-arrow-left:before{content:"\f177"}.fa-long-arrow-right:before{content:"\f178"}.fa-apple:before{content:"\f179"}.fa-windows:before{content:"\f17a"}.fa-android:before{content:"\f17b"}.fa-linux:before{content:"\f17c"}.fa-dribbble:before{content:"\f17d"}.fa-skype:before{content:"\f17e"}.fa-foursquare:before{content:"\f180"}.fa-trello:before{content:"\f181"}.fa-female:before{content:"\f182"}.fa-male:before{content:"\f183"}.fa-gittip:before,.fa-gratipay:before{content:"\f184"}.fa-sun-o:before{content:"\f185"}.fa-moon-o:before{content:"\f186"}.fa-archive:before{content:"\f187"}.fa-bug:before{content:"\f188"}.fa-vk:before{content:"\f189"}.fa-weibo:before{content:"\f18a"}.fa-renren:before{content:"\f18b"}.fa-pagelines:before{content:"\f18c"}.fa-stack-exchange:before{content:"\f18d"}.fa-arrow-circle-o-right:before{content:"\f18e"}.fa-arrow-circle-o-left:before{content:"\f190"}.fa-toggle-left:before,.fa-caret-square-o-left:before{content:"\f191"}.fa-dot-circle-o:before{content:"\f192"}.fa-wheelchair:before{content:"\f193"}.fa-vimeo-square:before{content:"\f194"}.fa-turkish-lira:before,.fa-try:before{content:"\f195"}.fa-plus-square-o:before{content:"\f196"}.fa-space-shuttle:before{content:"\f197"}.fa-slack:before{content:"\f198"}.fa-envelope-square:before{content:"\f199"}.fa-wordpress:before{content:"\f19a"}.fa-openid:before{content:"\f19b"}.fa-institution:before,.fa-bank:before,.fa-university:before{content:"\f19c"}.fa-mortar-board:before,.fa-graduation-cap:before{content:"\f19d"}.fa-yahoo:before{content:"\f19e"}.fa-google:before{content:"\f1a0"}.fa-reddit:before{content:"\f1a1"}.fa-reddit-square:before{content:"\f1a2"}.fa-stumbleupon-circle:before{content:"\f1a3"}.fa-stumbleupon:before{content:"\f1a4"}.fa-delicious:before{content:"\f1a5"}.fa-digg:before{content:"\f1a6"}.fa-pied-piper-pp:before{content:"\f1a7"}.fa-pied-piper-alt:before{content:"\f1a8"}.fa-drupal:before{content:"\f1a9"}.fa-joomla:before{content:"\f1aa"}.fa-language:before{content:"\f1ab"}.fa-fax:before{content:"\f1ac"}.fa-building:before{content:"\f1ad"}.fa-child:before{content:"\f1ae"}.fa-paw:before{content:"\f1b0"}.fa-spoon:before{content:"\f1b1"}.fa-cube:before{content:"\f1b2"}.fa-cubes:before{content:"\f1b3"}.fa-behance:before{content:"\f1b4"}.fa-behance-square:before{content:"\f1b5"}.fa-steam:before{content:"\f1b6"}.fa-steam-square:before{content:"\f1b7"}.fa-recycle:before{content:"\f1b8"}.fa-automobile:before,.fa-car:before{content:"\f1b9"}.fa-cab:before,.fa-taxi:before{content:"\f1ba"}.fa-tree:before{content:"\f1bb"}.fa-spotify:before{content:"\f1bc"}.fa-deviantart:before{content:"\f1bd"}.fa-soundcloud:before{content:"\f1be"}.fa-database:before{content:"\f1c0"}.fa-file-pdf-o:before{content:"\f1c1"}.fa-file-word-o:before{content:"\f1c2"}.fa-file-excel-o:before{content:"\f1c3"}.fa-file-powerpoint-o:before{content:"\f1c4"}.fa-file-photo-o:before,.fa-file-picture-o:before,.fa-file-image-o:before{content:"\f1c5"}.fa-file-zip-o:before,.fa-file-archive-o:before{content:"\f1c6"}.fa-file-sound-o:before,.fa-file-audio-o:before{content:"\f1c7"}.fa-file-movie-o:before,.fa-file-video-o:before{content:"\f1c8"}.fa-file-code-o:before{content:"\f1c9"}.fa-vine:before{content:"\f1ca"}.fa-codepen:before{content:"\f1cb"}.fa-jsfiddle:before{content:"\f1cc"}.fa-life-bouy:before,.fa-life-buoy:before,.fa-life-saver:before,.fa-support:before,.fa-life-ring:before{content:"\f1cd"}.fa-circle-o-notch:before{content:"\f1ce"}.fa-ra:before,.fa-resistance:before,.fa-rebel:before{content:"\f1d0"}.fa-ge:before,.fa-empire:before{content:"\f1d1"}.fa-git-square:before{content:"\f1d2"}.fa-git:before{content:"\f1d3"}.fa-y-combinator-square:before,.fa-yc-square:before,.fa-hacker-news:before{content:"\f1d4"}.fa-tencent-weibo:before{content:"\f1d5"}.fa-qq:before{content:"\f1d6"}.fa-wechat:before,.fa-weixin:before{content:"\f1d7"}.fa-send:before,.fa-paper-plane:before{content:"\f1d8"}.fa-send-o:before,.fa-paper-plane-o:before{content:"\f1d9"}.fa-history:before{content:"\f1da"}.fa-circle-thin:before{content:"\f1db"}.fa-header:before{content:"\f1dc"}.fa-paragraph:before{content:"\f1dd"}.fa-sliders:before{content:"\f1de"}.fa-share-alt:before{content:"\f1e0"}.fa-share-alt-square:before{content:"\f1e1"}.fa-bomb:before{content:"\f1e2"}.fa-soccer-ball-o:before,.fa-futbol-o:before{content:"\f1e3"}.fa-tty:before{content:"\f1e4"}.fa-binoculars:before{content:"\f1e5"}.fa-plug:before{content:"\f1e6"}.fa-slideshare:before{content:"\f1e7"}.fa-twitch:before{content:"\f1e8"}.fa-yelp:before{content:"\f1e9"}.fa-newspaper-o:before{content:"\f1ea"}.fa-wifi:before{content:"\f1eb"}.fa-calculator:before{content:"\f1ec"}.fa-paypal:before{content:"\f1ed"}.fa-google-wallet:before{content:"\f1ee"}.fa-cc-visa:before{content:"\f1f0"}.fa-cc-mastercard:before{content:"\f1f1"}.fa-cc-discover:before{content:"\f1f2"}.fa-cc-amex:before{content:"\f1f3"}.fa-cc-paypal:before{content:"\f1f4"}.fa-cc-stripe:before{content:"\f1f5"}.fa-bell-slash:before{content:"\f1f6"}.fa-bell-slash-o:before{content:"\f1f7"}.fa-trash:before{content:"\f1f8"}.fa-copyright:before{content:"\f1f9"}.fa-at:before{content:"\f1fa"}.fa-eyedropper:before{content:"\f1fb"}.fa-paint-brush:before{content:"\f1fc"}.fa-birthday-cake:before{content:"\f1fd"}.fa-area-chart:before{content:"\f1fe"}.fa-pie-chart:before{content:"\f200"}.fa-line-chart:before{content:"\f201"}.fa-lastfm:before{content:"\f202"}.fa-lastfm-square:before{content:"\f203"}.fa-toggle-off:before{content:"\f204"}.fa-toggle-on:before{content:"\f205"}.fa-bicycle:before{content:"\f206"}.fa-bus:before{content:"\f207"}.fa-ioxhost:before{content:"\f208"}.fa-angellist:before{content:"\f209"}.fa-cc:before{content:"\f20a"}.fa-shekel:before,.fa-sheqel:before,.fa-ils:before{content:"\f20b"}.fa-meanpath:before{content:"\f20c"}.fa-buysellads:before{content:"\f20d"}.fa-connectdevelop:before{content:"\f20e"}.fa-dashcube:before{content:"\f210"}.fa-forumbee:before{content:"\f211"}.fa-leanpub:before{content:"\f212"}.fa-sellsy:before{content:"\f213"}.fa-shirtsinbulk:before{content:"\f214"}.fa-simplybuilt:before{content:"\f215"}.fa-skyatlas:before{content:"\f216"}.fa-cart-plus:before{content:"\f217"}.fa-cart-arrow-down:before{content:"\f218"}.fa-diamond:before{content:"\f219"}.fa-ship:before{content:"\f21a"}.fa-user-secret:before{content:"\f21b"}.fa-motorcycle:before{content:"\f21c"}.fa-street-view:before{content:"\f21d"}.fa-heartbeat:before{content:"\f21e"}.fa-venus:before{content:"\f221"}.fa-mars:before{content:"\f222"}.fa-mercury:before{content:"\f223"}.fa-intersex:before,.fa-transgender:before{content:"\f224"}.fa-transgender-alt:before{content:"\f225"}.fa-venus-double:before{content:"\f226"}.fa-mars-double:before{content:"\f227"}.fa-venus-mars:before{content:"\f228"}.fa-mars-stroke:before{content:"\f229"}.fa-mars-stroke-v:before{content:"\f22a"}.fa-mars-stroke-h:before{content:"\f22b"}.fa-neuter:before{content:"\f22c"}.fa-genderless:before{content:"\f22d"}.fa-facebook-official:before{content:"\f230"}.fa-pinterest-p:before{content:"\f231"}.fa-whatsapp:before{content:"\f232"}.fa-server:before{content:"\f233"}.fa-user-plus:before{content:"\f234"}.fa-user-times:before{content:"\f235"}.fa-hotel:before,.fa-bed:before{content:"\f236"}.fa-viacoin:before{content:"\f237"}.fa-train:before{content:"\f238"}.fa-subway:before{content:"\f239"}.fa-medium:before{content:"\f23a"}.fa-yc:before,.fa-y-combinator:before{content:"\f23b"}.fa-optin-monster:before{content:"\f23c"}.fa-opencart:before{content:"\f23d"}.fa-expeditedssl:before{content:"\f23e"}.fa-battery-4:before,.fa-battery:before,.fa-battery-full:before{content:"\f240"}.fa-battery-3:before,.fa-battery-three-quarters:before{content:"\f241"}.fa-battery-2:before,.fa-battery-half:before{content:"\f242"}.fa-battery-1:before,.fa-battery-quarter:before{content:"\f243"}.fa-battery-0:before,.fa-battery-empty:before{content:"\f244"}.fa-mouse-pointer:before{content:"\f245"}.fa-i-cursor:before{content:"\f246"}.fa-object-group:before{content:"\f247"}.fa-object-ungroup:before{content:"\f248"}.fa-sticky-note:before{content:"\f249"}.fa-sticky-note-o:before{content:"\f24a"}.fa-cc-jcb:before{content:"\f24b"}.fa-cc-diners-club:before{content:"\f24c"}.fa-clone:before{content:"\f24d"}.fa-balance-scale:before{content:"\f24e"}.fa-hourglass-o:before{content:"\f250"}.fa-hourglass-1:before,.fa-hourglass-start:before{content:"\f251"}.fa-hourglass-2:before,.fa-hourglass-half:before{content:"\f252"}.fa-hourglass-3:before,.fa-hourglass-end:before{content:"\f253"}.fa-hourglass:before{content:"\f254"}.fa-hand-grab-o:before,.fa-hand-rock-o:before{content:"\f255"}.fa-hand-stop-o:before,.fa-hand-paper-o:before{content:"\f256"}.fa-hand-scissors-o:before{content:"\f257"}.fa-hand-lizard-o:before{content:"\f258"}.fa-hand-spock-o:before{content:"\f259"}.fa-hand-pointer-o:before{content:"\f25a"}.fa-hand-peace-o:before{content:"\f25b"}.fa-trademark:before{content:"\f25c"}.fa-registered:before{content:"\f25d"}.fa-creative-commons:before{content:"\f25e"}.fa-gg:before{content:"\f260"}.fa-gg-circle:before{content:"\f261"}.fa-tripadvisor:before{content:"\f262"}.fa-odnoklassniki:before{content:"\f263"}.fa-odnoklassniki-square:before{content:"\f264"}.fa-get-pocket:before{content:"\f265"}.fa-wikipedia-w:before{content:"\f266"}.fa-safari:before{content:"\f267"}.fa-chrome:before{content:"\f268"}.fa-firefox:before{content:"\f269"}.fa-opera:before{content:"\f26a"}.fa-internet-explorer:before{content:"\f26b"}.fa-tv:before,.fa-television:before{content:"\f26c"}.fa-contao:before{content:"\f26d"}.fa-500px:before{content:"\f26e"}.fa-amazon:before{content:"\f270"}.fa-calendar-plus-o:before{content:"\f271"}.fa-calendar-minus-o:before{content:"\f272"}.fa-calendar-times-o:before{content:"\f273"}.fa-calendar-check-o:before{content:"\f274"}.fa-industry:before{content:"\f275"}.fa-map-pin:before{content:"\f276"}.fa-map-signs:before{content:"\f277"}.fa-map-o:before{content:"\f278"}.fa-map:before{content:"\f279"}.fa-commenting:before{content:"\f27a"}.fa-commenting-o:before{content:"\f27b"}.fa-houzz:before{content:"\f27c"}.fa-vimeo:before{content:"\f27d"}.fa-black-tie:before{content:"\f27e"}.fa-fonticons:before{content:"\f280"}.fa-reddit-alien:before{content:"\f281"}.fa-edge:before{content:"\f282"}.fa-credit-card-alt:before{content:"\f283"}.fa-codiepie:before{content:"\f284"}.fa-modx:before{content:"\f285"}.fa-fort-awesome:before{content:"\f286"}.fa-usb:before{content:"\f287"}.fa-product-hunt:before{content:"\f288"}.fa-mixcloud:before{content:"\f289"}.fa-scribd:before{content:"\f28a"}.fa-pause-circle:before{content:"\f28b"}.fa-pause-circle-o:before{content:"\f28c"}.fa-stop-circle:before{content:"\f28d"}.fa-stop-circle-o:before{content:"\f28e"}.fa-shopping-bag:before{content:"\f290"}.fa-shopping-basket:before{content:"\f291"}.fa-hashtag:before{content:"\f292"}.fa-bluetooth:before{content:"\f293"}.fa-bluetooth-b:before{content:"\f294"}.fa-percent:before{content:"\f295"}.fa-gitlab:before{content:"\f296"}.fa-wpbeginner:before{content:"\f297"}.fa-wpforms:before{content:"\f298"}.fa-envira:before{content:"\f299"}.fa-universal-access:before{content:"\f29a"}.fa-wheelchair-alt:before{content:"\f29b"}.fa-question-circle-o:before{content:"\f29c"}.fa-blind:before{content:"\f29d"}.fa-audio-description:before{content:"\f29e"}.fa-volume-control-phone:before{content:"\f2a0"}.fa-braille:before{content:"\f2a1"}.fa-assistive-listening-systems:before{content:"\f2a2"}.fa-asl-interpreting:before,.fa-american-sign-language-interpreting:before{content:"\f2a3"}.fa-deafness:before,.fa-hard-of-hearing:before,.fa-deaf:before{content:"\f2a4"}.fa-glide:before{content:"\f2a5"}.fa-glide-g:before{content:"\f2a6"}.fa-signing:before,.fa-sign-language:before{content:"\f2a7"}.fa-low-vision:before{content:"\f2a8"}.fa-viadeo:before{content:"\f2a9"}.fa-viadeo-square:before{content:"\f2aa"}.fa-snapchat:before{content:"\f2ab"}.fa-snapchat-ghost:before{content:"\f2ac"}.fa-snapchat-square:before{content:"\f2ad"}.fa-pied-piper:before{content:"\f2ae"}.fa-first-order:before{content:"\f2b0"}.fa-yoast:before{content:"\f2b1"}.fa-themeisle:before{content:"\f2b2"}.fa-google-plus-circle:before,.fa-google-plus-official:before{content:"\f2b3"}.fa-fa:before,.fa-font-awesome:before{content:"\f2b4"}.fa-handshake-o:before{content:"\f2b5"}.fa-envelope-open:before{content:"\f2b6"}.fa-envelope-open-o:before{content:"\f2b7"}.fa-linode:before{content:"\f2b8"}.fa-address-book:before{content:"\f2b9"}.fa-address-book-o:before{content:"\f2ba"}.fa-vcard:before,.fa-address-card:before{content:"\f2bb"}.fa-vcard-o:before,.fa-address-card-o:before{content:"\f2bc"}.fa-user-circle:before{content:"\f2bd"}.fa-user-circle-o:before{content:"\f2be"}.fa-user-o:before{content:"\f2c0"}.fa-id-badge:before{content:"\f2c1"}.fa-drivers-license:before,.fa-id-card:before{content:"\f2c2"}.fa-drivers-license-o:before,.fa-id-card-o:before{content:"\f2c3"}.fa-quora:before{content:"\f2c4"}.fa-free-code-camp:before{content:"\f2c5"}.fa-telegram:before{content:"\f2c6"}.fa-thermometer-4:before,.fa-thermometer:before,.fa-thermometer-full:before{content:"\f2c7"}.fa-thermometer-3:before,.fa-thermometer-three-quarters:before{content:"\f2c8"}.fa-thermometer-2:before,.fa-thermometer-half:before{content:"\f2c9"}.fa-thermometer-1:before,.fa-thermometer-quarter:before{content:"\f2ca"}.fa-thermometer-0:before,.fa-thermometer-empty:before{content:"\f2cb"}.fa-shower:before{content:"\f2cc"}.fa-bathtub:before,.fa-s15:before,.fa-bath:before{content:"\f2cd"}.fa-podcast:before{content:"\f2ce"}.fa-window-maximize:before{content:"\f2d0"}.fa-window-minimize:before{content:"\f2d1"}.fa-window-restore:before{content:"\f2d2"}.fa-times-rectangle:before,.fa-window-close:before{content:"\f2d3"}.fa-times-rectangle-o:before,.fa-window-close-o:before{content:"\f2d4"}.fa-bandcamp:before{content:"\f2d5"}.fa-grav:before{content:"\f2d6"}.fa-etsy:before{content:"\f2d7"}.fa-imdb:before{content:"\f2d8"}.fa-ravelry:before{content:"\f2d9"}.fa-eercast:before{content:"\f2da"}.fa-microchip:before{content:"\f2db"}.fa-snowflake-o:before{content:"\f2dc"}.fa-superpowers:before{content:"\f2dd"}.fa-wpexplorer:before{content:"\f2de"}.fa-meetup:before{content:"\f2e0"}.sr-only{position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0, 0, 0, 0);border:0}.sr-only-focusable:active,.sr-only-focusable:focus{position:static;width:auto;height:auto;margin:0;overflow:visible;clip:auto} From c322cdd411fb456afb22bdff9c5a01bd3e249d8c Mon Sep 17 00:00:00 2001 From: klaokai <573984425@qq.com> Date: Wed, 11 Sep 2024 10:19:00 +0800 Subject: [PATCH 07/11] =?UTF-8?q?refactor=EF=BC=88=E4=BB=BF=E7=85=A7Spring?= =?UTF-8?q?Doc=E7=BB=93=E6=9E=84=E8=BF=9B=E8=A1=8C=E6=94=B9=E9=80=A0?= =?UTF-8?q?=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../configurer/WebControllerAdvice.java | 40 - .../SpringDocConfigProperties.java | 1511 ----------------- .../configuration/SpringDocConfiguration.java | 35 +- .../properties/SpringDocConfigProperties.java | 47 + .../core/providers/SpringWebProvider.java | 2 +- .../common/core/utils/Constants.java | 6 +- .../main/resources/META-INF/spring.factories | 2 +- .../webmvc/api/core/SpringWebMvcProvider.java | 2 +- .../pom.xml | 7 +- .../generatorui/webmvc/ui/SwaggerConfig.java | 4 +- .../ui/{SwaggerUiHome.java => UiHome.java} | 12 +- .../generatorui/webmvc/ui}/WebConfigurer.java | 8 +- .../resources/codetpls/controller.java.btl | 0 .../src/main/resources/codetpls/dto.btl | 0 .../main/resources/codetpls/entity.java.btl | 0 .../main/resources/codetpls/mapper.java.btl | 0 .../main/resources/codetpls/mapper.xml.btl | 0 .../main/resources/codetpls/mapperMethods.btl | 0 .../src/main/resources/codetpls/resultMap.btl | 0 .../main/resources/codetpls/service.java.btl | 0 .../resources/codetpls/serviceImpl.java.btl | 0 .../public/_nuxt/09694b79d33cba9c2850.js | 0 .../public/_nuxt/27503bae7f340bb103e0.js | 0 .../public/_nuxt/27503bae7f340bb103e0.js.map | 0 .../public/_nuxt/4d665454dfb48fc57305.js | 0 .../public/_nuxt/52cc4ad706f1ab56fd67.js | 0 .../public/_nuxt/77f28fc3ed6d061a9232.js | 0 .../public/_nuxt/7b68d0166b8d500e2875.js | 0 .../public/_nuxt/86adaf226d0c8490dad4.js | 0 .../public/_nuxt/9d53f74ea8103025e271.js | 0 .../src/main/resources/public/_nuxt/LICENSES | 0 .../public/_nuxt/cf49cb65f4df44b6a375.js | 0 .../public/_nuxt/cf49cb65f4df44b6a375.js.map | 0 .../public/_nuxt/e5273501af6c8ff2839e.js | 0 .../resources/public/_nuxt/fonts/535877f.woff | Bin .../resources/public/_nuxt/fonts/674f50d.eot | Bin .../resources/public/_nuxt/fonts/732389d.ttf | Bin .../public/_nuxt/fonts/af7ae50.woff2 | Bin .../resources/public/_nuxt/fonts/b06871f.ttf | Bin .../resources/public/_nuxt/fonts/fee66e7.woff | Bin .../resources/public/_nuxt/img/acf3dcb.svg | 0 .../resources/public/_nuxt/img/af9195e.png | Bin .../src/main/resources/public/index.html | 0 .../public/libs/adminlte/adminlte.min.css | 0 .../public/libs/adminlte/adminlte.min.js | 0 .../libs/bootstrap/css/bootstrap.min.css | 0 .../libs/bootstrap/css/bootstrap.min.css.map | 0 .../public/libs/bootstrap/js/bootstrap.min.js | 0 .../font-awesome/css/font-awesome.min.css | 0 .../libs/font-awesome/fonts/FontAwesome.otf | Bin .../fonts/fontawesome-webfont.eot | Bin .../fonts/fontawesome-webfont.svg | 0 .../fonts/fontawesome-webfont.ttf | Bin .../fonts/fontawesome-webfont.woff | Bin .../fonts/fontawesome-webfont.woff2 | Bin .../public/libs/jquery.fullscreen-min.js | 0 .../main/resources/public/libs/jquery.min.js | 0 .../pom.xml | 2 +- 58 files changed, 103 insertions(+), 1575 deletions(-) delete mode 100644 mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/configurer/WebControllerAdvice.java delete mode 100644 mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/SpringDocConfigProperties.java create mode 100644 mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/properties/SpringDocConfigProperties.java rename mybatis-plus-generator-ui-starter-webmvc-ui/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/ui/{SwaggerUiHome.java => UiHome.java} (88%) rename {mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/configurer => mybatis-plus-generator-ui-starter-webmvc-ui/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/ui}/WebConfigurer.java (81%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/codetpls/controller.java.btl (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/codetpls/dto.btl (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/codetpls/entity.java.btl (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/codetpls/mapper.java.btl (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/codetpls/mapper.xml.btl (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/codetpls/mapperMethods.btl (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/codetpls/resultMap.btl (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/codetpls/service.java.btl (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/codetpls/serviceImpl.java.btl (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/public/_nuxt/09694b79d33cba9c2850.js (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/public/_nuxt/27503bae7f340bb103e0.js (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/public/_nuxt/27503bae7f340bb103e0.js.map (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/public/_nuxt/4d665454dfb48fc57305.js (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/public/_nuxt/52cc4ad706f1ab56fd67.js (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/public/_nuxt/77f28fc3ed6d061a9232.js (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/public/_nuxt/7b68d0166b8d500e2875.js (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/public/_nuxt/86adaf226d0c8490dad4.js (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/public/_nuxt/9d53f74ea8103025e271.js (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/public/_nuxt/LICENSES (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/public/_nuxt/cf49cb65f4df44b6a375.js (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/public/_nuxt/cf49cb65f4df44b6a375.js.map (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/public/_nuxt/e5273501af6c8ff2839e.js (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/public/_nuxt/fonts/535877f.woff (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/public/_nuxt/fonts/674f50d.eot (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/public/_nuxt/fonts/732389d.ttf (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/public/_nuxt/fonts/af7ae50.woff2 (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/public/_nuxt/fonts/b06871f.ttf (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/public/_nuxt/fonts/fee66e7.woff (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/public/_nuxt/img/acf3dcb.svg (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/public/_nuxt/img/af9195e.png (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/public/index.html (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/public/libs/adminlte/adminlte.min.css (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/public/libs/adminlte/adminlte.min.js (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/public/libs/bootstrap/css/bootstrap.min.css (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/public/libs/bootstrap/css/bootstrap.min.css.map (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/public/libs/bootstrap/js/bootstrap.min.js (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/public/libs/font-awesome/css/font-awesome.min.css (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/public/libs/font-awesome/fonts/FontAwesome.otf (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.eot (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.svg (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.ttf (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.woff (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.woff2 (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/public/libs/jquery.fullscreen-min.js (100%) rename {mybatis-plus-generator-ui-starter-common => mybatis-plus-generator-ui-starter-webmvc-ui}/src/main/resources/public/libs/jquery.min.js (100%) diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/configurer/WebControllerAdvice.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/configurer/WebControllerAdvice.java deleted file mode 100644 index 529d9fc..0000000 --- a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/configurer/WebControllerAdvice.java +++ /dev/null @@ -1,40 +0,0 @@ -package com.github.davidfantasy.mybatisplus.generatorui.common.configurer; - -import com.github.davidfantasy.mybatisplus.generatorui.common.api.Result; -import com.github.davidfantasy.mybatisplus.generatorui.common.api.ResultCode; -import com.github.davidfantasy.mybatisplus.generatorui.common.api.ServiceException; -import lombok.extern.slf4j.Slf4j; -import org.springframework.web.bind.annotation.ControllerAdvice; -import org.springframework.web.bind.annotation.ExceptionHandler; -import org.springframework.web.bind.annotation.ResponseBody; -import org.springframework.web.servlet.NoHandlerFoundException; - - - -/** - * 用于全局异常处理 - */ -@ControllerAdvice -@Slf4j -public class WebControllerAdvice { - - @ExceptionHandler(value = Exception.class) - @ResponseBody - public Result exceptionHandler(Exception e) { - Result result = new Result(); - log.info("未捕获的异常:" + e.getMessage(), e); - if (e instanceof ServiceException) { - result.setCode(ResultCode.FAIL).setMessage(e.getMessage()); - } else if (e instanceof NoHandlerFoundException) { - NoHandlerFoundException ex = (NoHandlerFoundException) e; - result.setCode(ResultCode.NOT_FOUND).setMessage("接口 [" + ex.getRequestURL() + "] 不存在"); - } else if (e instanceof RuntimeException) { - result.setCode(ResultCode.FAIL).setMessage(e.getMessage()); - } else { - result.setCode(ResultCode.INTERNAL_SERVER_ERROR).setMessage("系统发生内部错误,请联系管理员"); - log.error("系统发生内部错误,请查看控制台日志了解详情", e); - } - return result; - } - -} diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/SpringDocConfigProperties.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/SpringDocConfigProperties.java deleted file mode 100644 index 3623af3..0000000 --- a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/SpringDocConfigProperties.java +++ /dev/null @@ -1,1511 +0,0 @@ -/* - * - * * - * * * - * * * * Copyright 2019-2022 the original author or authors. - * * * * - * * * * Licensed under the Apache License, Version 2.0 (the "License"); - * * * * you may not use this file except in compliance with the License. - * * * * You may obtain a copy of the License at - * * * * - * * * * https://www.apache.org/licenses/LICENSE-2.0 - * * * * - * * * * Unless required by applicable law or agreed to in writing, software - * * * * distributed under the License is distributed on an "AS IS" BASIS, - * * * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * * * * See the License for the specific language governing permissions and - * * * * limitations under the License. - * * * - * * - * - */ - -package com.github.davidfantasy.mybatisplus.generatorui.common.core.configuration; - -import com.github.davidfantasy.mybatisplus.generatorui.common.core.utils.Constants; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Lazy; -import org.springframework.http.MediaType; - -import java.util.ArrayList; -import java.util.List; - -/** - * The type Spring doc config properties. - * - * @author bnasslahsen - */ -@Lazy(false) -@Configuration(proxyBeanMethods = false) -@ConfigurationProperties(prefix = Constants.SPRINGDOC_PREFIX) -@ConditionalOnProperty(name = Constants.SPRINGDOC_ENABLED, matchIfMissing = true) -public class SpringDocConfigProperties { - - /** - * The Show actuator. - */ - private boolean showActuator; - - /** - * The Webjars. - */ - private Webjars webjars = new Webjars(); - - /** - * The Api docs. - */ - private ApiDocs apiDocs = new ApiDocs(); - - /** - * The Packages to scan. - */ - private List packagesToScan; - - /** - * The Packages to exclude. - */ - private List packagesToExclude; - - /** - * The Paths to match. - */ - private List pathsToMatch; - - /** - * The Paths to exclude. - */ - private List pathsToExclude; - - /** - * The Produces to match. - */ - private List producesToMatch; - - /** - * The Headers to match. - */ - private List headersToMatch; - - /** - * The Consumes to match. - */ - private List consumesToMatch; - - /** - * The Cache. - */ - private Cache cache = new Cache(); - - /** - * The Group configs. - */ - private List groupConfigs = new ArrayList<>(); - - /** - * The Auto tag classes. - */ - private boolean autoTagClasses = true; - - /** - * The Model and view allowed. - */ - private boolean modelAndViewAllowed; - - /** - * The Override with generic response. - */ - private Boolean overrideWithGenericResponse; - - /** - * The Remove broken reference definitions. - */ - private boolean removeBrokenReferenceDefinitions = true; - - /** - * The Writer with default pretty printer. - */ - private boolean writerWithDefaultPrettyPrinter; - - /** - * The Writer with order by keys. - */ - private boolean writerWithOrderByKeys; - - /** - * The Default consumes media type. - */ - private String defaultConsumesMediaType = MediaType.APPLICATION_JSON_VALUE; - - /** - * The Default produces media type. - */ - private String defaultProducesMediaType = MediaType.ALL_VALUE; - - /** - * Use fully qualified name - */ - private boolean useFqn; - - /** - * The Show login endpoint. - */ - private boolean showLoginEndpoint; - - /** - * Allow for pre-loading OpenAPI - */ - private boolean preLoadingEnabled; - - /** - * If set to true, exposes the swagger-ui on the actuator management port. - */ - private boolean useManagementPort; - - /** - * The Disable i18n. - */ - private boolean disableI18n; - - /** - * The Show spring cloud functions. - */ - private boolean showSpringCloudFunctions; - - /** - * The param default flatten - */ - private boolean defaultFlatParamObject; - - /** - * convert query param to form data when consumes is multipart/form-data - */ - private boolean defaultSupportFormData; - - /** - * The model Converters - */ - private ModelConverters modelConverters = new ModelConverters(); - - /** - * The Sort converter. - */ - private ModelConverters.SortConverter sortConverter = new ModelConverters.SortConverter(); - - /** - * The Nullable request parameter enabled. - */ - private boolean nullableRequestParameterEnabled; - - /** - * The Show oauth2 endpoints. - */ - private boolean showOauth2Endpoints; - - /** - * Gets override with generic response. - * - * @return the override with generic response - */ - public Boolean getOverrideWithGenericResponse() { - return overrideWithGenericResponse; - } - - /** - * Is nullable request parameter enabled boolean. - * - * @return the boolean - */ - public boolean isNullableRequestParameterEnabled() { - return nullableRequestParameterEnabled; - } - - /** - * Sets nullable request parameter enabled. - * - * @param nullableRequestParameterEnabled the nullable request parameter enabled - */ - public void setNullableRequestParameterEnabled(boolean nullableRequestParameterEnabled) { - this.nullableRequestParameterEnabled = nullableRequestParameterEnabled; - } - - /** - * Is default support form data boolean. - * - * @return the boolean - */ - public boolean isDefaultSupportFormData() { - return defaultSupportFormData; - } - - /** - * Sets default support form data. - * - * @param defaultSupportFormData the default support form data - */ - public void setDefaultSupportFormData(boolean defaultSupportFormData) { - this.defaultSupportFormData = defaultSupportFormData; - } - - /** - * Gets sort converter. - * - * @return the sort converter - */ - public ModelConverters.SortConverter getSortConverter() { - return sortConverter; - } - - /** - * Sets sort converter. - * - * @param sortConverter the sort converter - */ - public void setSortConverter(ModelConverters.SortConverter sortConverter) { - this.sortConverter = sortConverter; - } - - /** - * Is show spring cloud functions boolean. - * - * @return the boolean - */ - public boolean isShowSpringCloudFunctions() { - return showSpringCloudFunctions; - } - - /** - * Sets show spring cloud functions. - * - * @param showSpringCloudFunctions the show spring cloud functions - */ - public void setShowSpringCloudFunctions(boolean showSpringCloudFunctions) { - this.showSpringCloudFunctions = showSpringCloudFunctions; - } - - /** - * Is default flat param object - * - * @return the boolean - */ - public boolean isDefaultFlatParamObject() { - return defaultFlatParamObject; - } - - /** - * Sets default flat param object. - * - * @param defaultFlatParamObject the default flat param object - */ - public void setDefaultFlatParamObject(boolean defaultFlatParamObject) { - this.defaultFlatParamObject = defaultFlatParamObject; - } - - /** - * Gets model converters. - * - * @return the model converters - */ - public ModelConverters getModelConverters() { - return modelConverters; - } - - /** - * Sets model converters. - * - * @param modelConverters the model converters - */ - public void setModelConverters(ModelConverters modelConverters) { - this.modelConverters = modelConverters; - } - - - /** - * Is use management port boolean. - * - * @return the boolean - */ - public boolean isUseManagementPort() { - return useManagementPort; - } - - /** - * Sets use management port. - * - * @param useManagementPort the use management port - */ - public void setUseManagementPort(boolean useManagementPort) { - this.useManagementPort = useManagementPort; - } - - /** - * Gets produces to match. - * - * @return the produces to match - */ - public List getProducesToMatch() { - return producesToMatch; - } - - /** - * Sets produces to match. - * - * @param producesToMatch the produces to match - */ - public void setProducesToMatch(List producesToMatch) { - this.producesToMatch = producesToMatch; - } - - /** - * Gets headers to match. - * - * @return the headers to match - */ - public List getHeadersToMatch() { - return headersToMatch; - } - - /** - * Sets headers to match. - * - * @param headersToMatch the headers to match - */ - public void setHeadersToMatch(List headersToMatch) { - this.headersToMatch = headersToMatch; - } - - /** - * Gets consumes to match. - * - * @return the consumes to match - */ - public List getConsumesToMatch() { - return consumesToMatch; - } - - /** - * Sets consumes to match. - * - * @param consumesToMatch the consumes to match - */ - public void setConsumesToMatch(List consumesToMatch) { - this.consumesToMatch = consumesToMatch; - } - - /** - * Is use fqn boolean. - * - * @return the boolean - */ - public boolean isUseFqn() { - return useFqn; - } - - /** - * Sets use fqn. - * - * @param useFqn the use fqn - */ - public void setUseFqn(boolean useFqn) { - this.useFqn = useFqn; - } - - /** - * Is auto tag classes boolean. - * - * @return the boolean - */ - public boolean isAutoTagClasses() { - return autoTagClasses; - } - - /** - * Sets auto tag classes. - * - * @param autoTagClasses the auto tag classes - */ - public void setAutoTagClasses(boolean autoTagClasses) { - this.autoTagClasses = autoTagClasses; - } - - /** - * Is model and view allowed boolean. - * - * @return the boolean - */ - public boolean isModelAndViewAllowed() { - return modelAndViewAllowed; - } - - /** - * Sets model and view allowed. - * - * @param modelAndViewAllowed the model and view allowed - */ - public void setModelAndViewAllowed(boolean modelAndViewAllowed) { - this.modelAndViewAllowed = modelAndViewAllowed; - } - - /** - * Gets packages to exclude. - * - * @return the packages to exclude - */ - public List getPackagesToExclude() { - return packagesToExclude; - } - - /** - * Sets packages to exclude. - * - * @param packagesToExclude the packages to exclude - */ - public void setPackagesToExclude(List packagesToExclude) { - this.packagesToExclude = packagesToExclude; - } - - /** - * Gets paths to exclude. - * - * @return the paths to exclude - */ - public List getPathsToExclude() { - return pathsToExclude; - } - - /** - * Sets paths to exclude. - * - * @param pathsToExclude the paths to exclude - */ - public void setPathsToExclude(List pathsToExclude) { - this.pathsToExclude = pathsToExclude; - } - - /** - * Is show login endpoint boolean. - * - * @return the boolean - */ - public boolean isShowLoginEndpoint() { - return showLoginEndpoint; - } - - /** - * Sets show login endpoint. - * - * @param showLoginEndpoint the show login endpoint - */ - public void setShowLoginEndpoint(boolean showLoginEndpoint) { - this.showLoginEndpoint = showLoginEndpoint; - } - - /** - * Gets packages to scan. - * - * @return the packages to scan - */ - public List getPackagesToScan() { - return packagesToScan; - } - - /** - * Sets packages to scan. - * - * @param packagesToScan the packages to scan - */ - public void setPackagesToScan(List packagesToScan) { - this.packagesToScan = packagesToScan; - } - - /** - * Is show actuator boolean. - * - * @return the boolean - */ - public boolean isShowActuator() { - return showActuator; - } - - /** - * Sets show actuator. - * - * @param showActuator the show actuator - */ - public void setShowActuator(boolean showActuator) { - this.showActuator = showActuator; - } - - /** - * Gets webjars. - * - * @return the webjars - */ - public Webjars getWebjars() { - return webjars; - } - - /** - * Sets webjars. - * - * @param webjars the webjars - */ - public void setWebjars(Webjars webjars) { - this.webjars = webjars; - } - - /** - * Gets api docs. - * - * @return the api docs - */ - public ApiDocs getApiDocs() { - return apiDocs; - } - - /** - * Sets api docs. - * - * @param apiDocs the api docs - */ - public void setApiDocs(ApiDocs apiDocs) { - this.apiDocs = apiDocs; - } - - /** - * Gets paths to match. - * - * @return the paths to match - */ - public List getPathsToMatch() { - return pathsToMatch; - } - - /** - * Sets paths to match. - * - * @param pathsToMatch the paths to match - */ - public void setPathsToMatch(List pathsToMatch) { - this.pathsToMatch = pathsToMatch; - } - - /** - * Gets cache. - * - * @return the cache - */ - public Cache getCache() { - return cache; - } - - /** - * Sets cache. - * - * @param cache the cache - */ - public void setCache(Cache cache) { - this.cache = cache; - } - - /** - * Is cache disabled boolean. - * - * @return the boolean - */ - public boolean isCacheDisabled() { - return cache.isDisabled(); - } - - /** - * Gets group configs. - * - * @return the group configs - */ - public List getGroupConfigs() { - return groupConfigs; - } - - /** - * Sets group configs. - * - * @param groupConfigs the group configs - */ - public void setGroupConfigs(List groupConfigs) { - this.groupConfigs = groupConfigs; - } - - /** - * Add group config. - * - * @param groupConfigs the group configs - */ - public void addGroupConfig(GroupConfig groupConfigs) { - this.groupConfigs.add(groupConfigs); - } - - /** - * Gets default consumes media type. - * - * @return the default consumes media type - */ - public String getDefaultConsumesMediaType() { - return defaultConsumesMediaType; - } - - /** - * Sets default consumes media type. - * - * @param defaultConsumesMediaType the default consumes media type - */ - public void setDefaultConsumesMediaType(String defaultConsumesMediaType) { - this.defaultConsumesMediaType = defaultConsumesMediaType; - } - - /** - * Gets default produces media type. - * - * @return the default produces media type - */ - public String getDefaultProducesMediaType() { - return defaultProducesMediaType; - } - - /** - * Sets default produces media type. - * - * @param defaultProducesMediaType the default produces media type - */ - public void setDefaultProducesMediaType(String defaultProducesMediaType) { - this.defaultProducesMediaType = defaultProducesMediaType; - } - - /** - * Is override with generic response boolean. - * - * @return the boolean - */ - public boolean isOverrideWithGenericResponse() { - return overrideWithGenericResponse != null && overrideWithGenericResponse; - } - - /** - * Sets override with generic response. - * - * @param overrideWithGenericResponse the override with generic response - */ - public void setOverrideWithGenericResponse(Boolean overrideWithGenericResponse) { - this.overrideWithGenericResponse = overrideWithGenericResponse; - } - - /** - * Gets default override with generic response. - * - * @return the default override with generic response - */ - public boolean isDefaultOverrideWithGenericResponse() { - if (overrideWithGenericResponse == null) { - return true; - } else { - return overrideWithGenericResponse; - } - } - - /** - * Is remove broken reference definitions boolean. - * - * @return the boolean - */ - public boolean isRemoveBrokenReferenceDefinitions() { - return removeBrokenReferenceDefinitions; - } - - /** - * Sets remove broken reference definitions. - * - * @param removeBrokenReferenceDefinitions the remove broken reference definitions - */ - public void setRemoveBrokenReferenceDefinitions(boolean removeBrokenReferenceDefinitions) { - this.removeBrokenReferenceDefinitions = removeBrokenReferenceDefinitions; - } - - /** - * Is writer wither order by keys boolean. - * - * @return the boolean - */ - public boolean isWriterWithOrderByKeys() { - return writerWithOrderByKeys; - } - - /** - * Sets writer wither order by keys. - * - * @param writerWithOrderByKeys the writer wither order by keys - */ - public void setWriterWithOrderByKeys(boolean writerWithOrderByKeys) { - this.writerWithOrderByKeys = writerWithOrderByKeys; - } - - /** - * Is writer with default pretty printer boolean. - * - * @return the boolean - */ - public boolean isWriterWithDefaultPrettyPrinter() { - return writerWithDefaultPrettyPrinter; - } - - /** - * Sets writer with default pretty printer. - * - * @param writerWithDefaultPrettyPrinter the writer with default pretty printer - */ - public void setWriterWithDefaultPrettyPrinter(boolean writerWithDefaultPrettyPrinter) { - this.writerWithDefaultPrettyPrinter = writerWithDefaultPrettyPrinter; - } - - /** - * Is disable i 18 n boolean. - * - * @return the boolean - */ - public boolean isDisableI18n() { - return disableI18n; - } - - /** - * Sets disable i 18 n. - * - * @param disableI18n the disable i 18 n - */ - public void setDisableI18n(boolean disableI18n) { - this.disableI18n = disableI18n; - } - - /** - * Is pre loading enabled boolean. - * - * @return the boolean - */ - public boolean isPreLoadingEnabled() { - return preLoadingEnabled; - } - - /** - * Sets pre loading enabled. - * - * @param preLoadingEnabled the pre loading enabled - */ - public void setPreLoadingEnabled(boolean preLoadingEnabled) { - this.preLoadingEnabled = preLoadingEnabled; - } - - public boolean isShowOauth2Endpoints() { - return showOauth2Endpoints; - } - - public void setShowOauth2Endpoints(boolean showOauth2Endpoint) { - this.showOauth2Endpoints = showOauth2Endpoint; - } - - /** - * The type Model converters. - * - * @author bnasslashen - */ - public static class ModelConverters { - - /** - * The Deprecating converter. - */ - private DeprecatingConverter deprecatingConverter = new DeprecatingConverter(); - - /** - * The Pageable converter. - */ - private PageableConverter pageableConverter = new PageableConverter(); - - /** - * The Polymorphic model converter. - */ - private PolymorphicConverter polymorphicConverter = new PolymorphicConverter(); - - - /** - * Gets deprecating converter. - * - * @return the deprecating converter - */ - public DeprecatingConverter getDeprecatingConverter() { - return deprecatingConverter; - } - - /** - * Sets deprecating converter. - * - * @param deprecatingConverter the deprecating converter - */ - public void setDeprecatingConverter(DeprecatingConverter deprecatingConverter) { - this.deprecatingConverter = deprecatingConverter; - } - - /** - * Gets pageable converter. - * - * @return the pageable converter - */ - public PageableConverter getPageableConverter() { - return pageableConverter; - } - - /** - * Sets pageable converter. - * - * @param pageableConverter the pageable converter - */ - public void setPageableConverter(PageableConverter pageableConverter) { - this.pageableConverter = pageableConverter; - } - - /** - * Gets polymorphic model converter. - * - * @return the polymorphic model converter - */ - public PolymorphicConverter getPolymorphicConverter() { - return polymorphicConverter; - } - - /** - * Sets polymorphic model converter. - * - * @param polymorphicConverter the polymorphic model converter - */ - public void setPolymorphicConverter(PolymorphicConverter polymorphicConverter) { - this.polymorphicConverter = polymorphicConverter; - } - - /** - * The type Sort converter. - * - * @author daniel -shuy - */ - public static class SortConverter { - - /** - * The Enabled. - */ - private boolean enabled; - - /** - * Is enabled boolean. - * - * @return the boolean - */ - public boolean isEnabled() { - return enabled; - } - - /** - * Sets enabled. - * - * @param enabled the enabled - */ - public void setEnabled(boolean enabled) { - this.enabled = enabled; - } - } - - /** - * The type Deprecating converter. - * - * @author bnasslashen - */ - public static class DeprecatingConverter { - - /** - * The Enabled. - */ - private boolean enabled; - - /** - * Is enabled boolean. - * - * @return the boolean - */ - public boolean isEnabled() { - return enabled; - } - - /** - * Sets enabled. - * - * @param enabled the enabled - */ - public void setEnabled(boolean enabled) { - this.enabled = enabled; - } - } - - /** - * The type Polymorphic model converter. - */ - public static class PolymorphicConverter { - - /** - * The Enabled. - */ - private boolean enabled; - - /** - * Is enabled boolean. - * - * @return the boolean - */ - public boolean isEnabled() { - return enabled; - } - - /** - * Sets enabled. - * - * @param enabled the enabled - */ - public void setEnabled(boolean enabled) { - this.enabled = enabled; - } - } - - - /** - * The type Pageable converter. - * - * @author bnasslashen - */ - public static class PageableConverter { - - /** - * The Enabled. - */ - private boolean enabled; - - /** - * Is enabled boolean. - * - * @return the boolean - */ - public boolean isEnabled() { - return enabled; - } - - /** - * Sets enabled. - * - * @param enabled the enabled - */ - public void setEnabled(boolean enabled) { - this.enabled = enabled; - } - } - } - - /** - * The type Webjars. - * - * @author bnasslahsen - */ - public static class Webjars { - /** - * The Prefix. - */ - private String prefix = Constants.DEFAULT_WEB_JARS_PREFIX_URL; - - /** - * Gets prefix. - * - * @return the prefix - */ - public String getPrefix() { - return prefix; - } - - /** - * Sets prefix. - * - * @param prefix the prefix - */ - public void setPrefix(String prefix) { - this.prefix = prefix; - } - } - - /** - * The type Api docs. - * - * @author bnasslahsen - */ - public static class ApiDocs { - /** - * Path to the generated OpenAPI documentation. For a yaml file, append ".yaml" to the path. - */ - private String path = Constants.DEFAULT_API_DOCS_URL; - - /** - * Whether to generate and serve an OpenAPI document. - */ - private boolean enabled = true; - - /** - * The Resolve schema properties. - */ - private boolean resolveSchemaProperties; - - /** - * The Groups. - */ - private Groups groups = new Groups(); - - /** - * The OpenAPI version. - */ - private OpenApiVersion version; - - /** - * Gets path. - * - * @return the path - */ - public String getPath() { - return path; - } - - /** - * Sets path. - * - * @param path the path - */ - public void setPath(String path) { - this.path = path; - } - - /** - * Is enabled boolean. - * - * @return the boolean - */ - public boolean isEnabled() { - return enabled; - } - - /** - * Sets enabled. - * - * @param enabled the enabled - */ - public void setEnabled(boolean enabled) { - this.enabled = enabled; - } - - /** - * Gets groups. - * - * @return the groups - */ - public Groups getGroups() { - return groups; - } - - /** - * Sets groups. - * - * @param groups the groups - */ - public void setGroups(Groups groups) { - this.groups = groups; - } - - /** - * Is resolve schema properties boolean. - * - * @return the boolean - */ - public boolean isResolveSchemaProperties() { - return resolveSchemaProperties; - } - - /** - * Sets resolve schema properties. - * - * @param resolveSchemaProperties the resolve schema properties - */ - public void setResolveSchemaProperties(boolean resolveSchemaProperties) { - this.resolveSchemaProperties = resolveSchemaProperties; - } - - /** - * Gets version. - * - * @return the version - */ - public OpenApiVersion getVersion() { - return version; - } - - /** - * Sets version. - * - * @param version the version - */ - public void setVersion(OpenApiVersion version) { - this.version = version; - } - - /** - * The enum OpenApiVersion. - */ - public enum OpenApiVersion { - /** - * Openapi 3.0.1 version. - */ - OPENAPI_3_0("3.0.1"), - /** - * Openapi 3.1.0 version. - */ - OPENAPI_3_1("3.1.0"); - - /** - * The Open api version. - */ - private final String version; - - /** - * Instantiates a new OpenApiVersion. - * - * @param openApiVersion the open api version - */ - OpenApiVersion(String openApiVersion) { - this.version = openApiVersion; - } - - /** - * Gets open api version. - * - * @return the open api version - */ - public String getVersion() { - return version; - } - } - } - - /** - * The type Groups. - * - * @author bnasslahsen - */ - public static class Groups { - /** - * The Enabled. - */ - private boolean enabled; - - /** - * Is enabled boolean. - * - * @return the boolean - */ - public boolean isEnabled() { - return enabled; - } - - /** - * Sets enabled. - * - * @param enabled the enabled - */ - public void setEnabled(boolean enabled) { - this.enabled = enabled; - } - } - - /** - * The type Cache. - * - * @author bnasslahsen - */ - public static class Cache { - /** - * The Disabled. - */ - private boolean disabled; - - /** - * Is disabled boolean. - * - * @return the boolean - */ - public boolean isDisabled() { - return disabled; - } - - /** - * Sets disabled. - * - * @param disabled the disabled - */ - public void setDisabled(boolean disabled) { - this.disabled = disabled; - } - } - - /** - * The type Group config. - * - * @author bnasslahsen - */ - public static class GroupConfig { - - /** - * The Paths to match. - */ - private List pathsToMatch; - - /** - * The Packages to scan. - */ - private List packagesToScan; - - /** - * The Packages to exclude. - */ - private List packagesToExclude; - - /** - * The Paths to exclude. - */ - private List pathsToExclude; - - /** - * The Group. - */ - private String group; - - /** - * The Produces to match. - */ - private List producesToMatch; - - /** - * The Headers to match. - */ - private List headersToMatch; - - /** - * The Consumes to match. - */ - private List consumesToMatch; - - /** - * The Display name. - */ - private String displayName; - - /** - * Instantiates a new Group config. - */ - public GroupConfig() { - } - - /** - * Instantiates a new Group config. - * - * @param group the group - * @param pathsToMatch the paths to match - * @param packagesToScan the packages to scan - * @param packagesToExclude the packages to exclude - * @param pathsToExclude the paths to exclude - * @param producesToMatch the produces to match - * @param consumesToMatch the consumes to match - * @param headersToMatch the headers to match - * @param displayName the display name - */ - public GroupConfig(String group, List pathsToMatch, List packagesToScan, - List packagesToExclude, List pathsToExclude, - List producesToMatch, List consumesToMatch, List headersToMatch, - String displayName) { - this.pathsToMatch = pathsToMatch; - this.pathsToExclude = pathsToExclude; - this.packagesToExclude = packagesToExclude; - this.packagesToScan = packagesToScan; - this.group = group; - this.producesToMatch = producesToMatch; - this.consumesToMatch = consumesToMatch; - this.headersToMatch = headersToMatch; - this.displayName = displayName; - } - - /** - * Gets headers to match. - * - * @return the headers to match - */ - public List getHeadersToMatch() { - return headersToMatch; - } - - /** - * Sets headers to match. - * - * @param headersToMatch the headers to match - */ - public void setHeadersToMatch(List headersToMatch) { - this.headersToMatch = headersToMatch; - } - - /** - * Gets consumes to match. - * - * @return the consumes to match - */ - public List getConsumesToMatch() { - return consumesToMatch; - } - - /** - * Sets consumes to match. - * - * @param consumesToMatch the consumes to match - */ - public void setConsumesToMatch(List consumesToMatch) { - this.consumesToMatch = consumesToMatch; - } - - /** - * Gets paths to match. - * - * @return the paths to match - */ - public List getPathsToMatch() { - return pathsToMatch; - } - - /** - * Sets paths to match. - * - * @param pathsToMatch the paths to match - */ - public void setPathsToMatch(List pathsToMatch) { - this.pathsToMatch = pathsToMatch; - } - - /** - * Gets packages to scan. - * - * @return the packages to scan - */ - public List getPackagesToScan() { - return packagesToScan; - } - - /** - * Sets packages to scan. - * - * @param packagesToScan the packages to scan - */ - public void setPackagesToScan(List packagesToScan) { - this.packagesToScan = packagesToScan; - } - - /** - * Gets group. - * - * @return the group - */ - public String getGroup() { - return group; - } - - /** - * Sets group. - * - * @param group the group - */ - public void setGroup(String group) { - this.group = group; - } - - /** - * Gets packages to exclude. - * - * @return the packages to exclude - */ - public List getPackagesToExclude() { - return packagesToExclude; - } - - /** - * Sets packages to exclude. - * - * @param packagesToExclude the packages to exclude - */ - public void setPackagesToExclude(List packagesToExclude) { - this.packagesToExclude = packagesToExclude; - } - - /** - * Gets paths to exclude. - * - * @return the paths to exclude - */ - public List getPathsToExclude() { - return pathsToExclude; - } - - /** - * Sets paths to exclude. - * - * @param pathsToExclude the paths to exclude - */ - public void setPathsToExclude(List pathsToExclude) { - this.pathsToExclude = pathsToExclude; - } - - /** - * Gets produces to match. - * - * @return the produces to match - */ - public List getProducesToMatch() { - return producesToMatch; - } - - /** - * Sets produces to match. - * - * @param producesToMatch the produces to match - */ - public void setProducesToMatch(List producesToMatch) { - this.producesToMatch = producesToMatch; - } - - /** - * Gets display name. - * - * @return the display name - */ - public String getDisplayName() { - return displayName; - } - - /** - * Sets display name. - * - * @param displayName the display name - */ - public void setDisplayName(String displayName) { - this.displayName = displayName; - } - } -} diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/SpringDocConfiguration.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/SpringDocConfiguration.java index 7a3e869..d579c0e 100644 --- a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/SpringDocConfiguration.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/SpringDocConfiguration.java @@ -2,9 +2,11 @@ import com.github.davidfantasy.mybatisplus.generatorui.common.ApplicationConfigure; import com.github.davidfantasy.mybatisplus.generatorui.common.api.Result; +import com.github.davidfantasy.mybatisplus.generatorui.common.api.ResultCode; import com.github.davidfantasy.mybatisplus.generatorui.common.api.ResultGenerator; import com.github.davidfantasy.mybatisplus.generatorui.common.api.ServiceException; import com.github.davidfantasy.mybatisplus.generatorui.common.core.utils.Constants; +import lombok.extern.slf4j.Slf4j; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.context.annotation.Bean; @@ -14,9 +16,8 @@ import org.springframework.core.LocalVariableTableParameterNameDiscoverer; import org.springframework.http.HttpStatus; import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.ExceptionHandler; -import org.springframework.web.bind.annotation.ResponseStatus; -import org.springframework.web.bind.annotation.RestControllerAdvice; +import org.springframework.web.bind.annotation.*; +import org.springframework.web.servlet.NoHandlerFoundException; @Lazy(false) @Configuration(proxyBeanMethods = false) @@ -61,4 +62,32 @@ public ResponseEntity handleNoHandlerFound(ServiceException e) { .body(ResultGenerator.genFailResult(e.getMessage())); } } + + /** + * 用于全局异常处理 + */ + @ControllerAdvice + @Slf4j + public class WebControllerAdvice { + + @ExceptionHandler(value = Exception.class) + @ResponseBody + public Result exceptionHandler(Exception e) { + Result result = new Result(); + log.info("未捕获的异常:" + e.getMessage(), e); + if (e instanceof ServiceException) { + result.setCode(ResultCode.FAIL).setMessage(e.getMessage()); + } else if (e instanceof NoHandlerFoundException) { + NoHandlerFoundException ex = (NoHandlerFoundException) e; + result.setCode(ResultCode.NOT_FOUND).setMessage("接口 [" + ex.getRequestURL() + "] 不存在"); + } else if (e instanceof RuntimeException) { + result.setCode(ResultCode.FAIL).setMessage(e.getMessage()); + } else { + result.setCode(ResultCode.INTERNAL_SERVER_ERROR).setMessage("系统发生内部错误,请联系管理员"); + log.error("系统发生内部错误,请查看控制台日志了解详情", e); + } + return result; + } + + } } diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/properties/SpringDocConfigProperties.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/properties/SpringDocConfigProperties.java new file mode 100644 index 0000000..45bf744 --- /dev/null +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/properties/SpringDocConfigProperties.java @@ -0,0 +1,47 @@ +/* + * + * * + * * * + * * * * Copyright 2019-2022 the original author or authors. + * * * * + * * * * Licensed under the Apache License, Version 2.0 (the "License"); + * * * * you may not use this file except in compliance with the License. + * * * * You may obtain a copy of the License at + * * * * + * * * * https://www.apache.org/licenses/LICENSE-2.0 + * * * * + * * * * Unless required by applicable law or agreed to in writing, software + * * * * distributed under the License is distributed on an "AS IS" BASIS, + * * * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * * * * See the License for the specific language governing permissions and + * * * * limitations under the License. + * * * + * * + * + */ + +package com.github.davidfantasy.mybatisplus.generatorui.common.core.properties; + +import com.github.davidfantasy.mybatisplus.generatorui.common.core.utils.Constants; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.context.properties.ConfigurationProperties; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Lazy; +import org.springframework.http.MediaType; + +import java.util.ArrayList; +import java.util.List; + +/** + * The type Spring doc config properties. + * + * @author bnasslahsen + */ +@Lazy(false) +@Configuration(proxyBeanMethods = false) +@ConfigurationProperties(prefix = Constants.SPRINGDOC_PREFIX) +@ConditionalOnProperty(name = Constants.SPRINGDOC_ENABLED, matchIfMissing = true) +public class SpringDocConfigProperties { + + +} diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/providers/SpringWebProvider.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/providers/SpringWebProvider.java index 47d68b3..836b185 100644 --- a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/providers/SpringWebProvider.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/providers/SpringWebProvider.java @@ -1,6 +1,6 @@ package com.github.davidfantasy.mybatisplus.generatorui.common.core.providers; -import com.github.davidfantasy.mybatisplus.generatorui.common.core.configuration.SpringDocConfigProperties; +import com.github.davidfantasy.mybatisplus.generatorui.common.core.properties.SpringDocConfigProperties; import org.springframework.beans.BeansException; import org.springframework.context.ApplicationContext; import org.springframework.context.ApplicationContextAware; diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/Constants.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/Constants.java index a8c8ba3..65a54fb 100644 --- a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/Constants.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/Constants.java @@ -221,14 +221,14 @@ public final class Constants { public static final String APPLICATION_OPENAPI_YAML = "application/vnd.oai.openapi"; /** - * The constant DEFAULT_SWAGGER_UI_PATH. + * The constant DEFAULT_MYBATIS_GENERATOR_UI_PATH. */ - public static final String DEFAULT_SWAGGER_UI_PATH = DEFAULT_PATH_SEPARATOR + "swagger-ui.html"; + public static final String DEFAULT_MYBATIS_GENERATOR_UI_PATH = DEFAULT_PATH_SEPARATOR + "index.html"; /** * The constant SWAGGER_UI_PATH. */ - public static final String SWAGGER_UI_PATH = "${springdoc.swagger-ui.path:#{T(com.github.davidfantasy.mybatisplus.generatorui.common.core.utils.Constants).DEFAULT_SWAGGER_UI_PATH}}"; + public static final String MYBATIS_GENERATOR_UI_PATH = "${springdoc.swagger-ui.path:#{T(com.github.davidfantasy.mybatisplus.generatorui.common.core.utils.Constants).DEFAULT_MYBATIS_GENERATOR_UI_PATH}}"; /** * The constant DEFAULT_GROUP_NAME. diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/META-INF/spring.factories b/mybatis-plus-generator-ui-starter-common/src/main/resources/META-INF/spring.factories index 1b3e800..8cc29e6 100644 --- a/mybatis-plus-generator-ui-starter-common/src/main/resources/META-INF/spring.factories +++ b/mybatis-plus-generator-ui-starter-common/src/main/resources/META-INF/spring.factories @@ -1,3 +1,3 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ com.github.davidfantasy.mybatisplus.generatorui.common.core.configuration.SpringDocConfiguration,\ -com.github.davidfantasy.mybatisplus.generatorui.common.core.configuration.SpringDocConfigProperties \ No newline at end of file +com.github.davidfantasy.mybatisplus.generatorui.common.core.properties.SpringDocConfigProperties \ No newline at end of file diff --git a/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/core/SpringWebMvcProvider.java b/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/core/SpringWebMvcProvider.java index f001cd6..2202478 100644 --- a/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/core/SpringWebMvcProvider.java +++ b/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/core/SpringWebMvcProvider.java @@ -22,7 +22,7 @@ package com.github.davidfantasy.mybatisplus.generatorui.webmvc.api.core; import cn.hutool.core.util.StrUtil; -import com.github.davidfantasy.mybatisplus.generatorui.common.core.configuration.SpringDocConfigProperties; +import com.github.davidfantasy.mybatisplus.generatorui.common.core.properties.SpringDocConfigProperties; import com.github.davidfantasy.mybatisplus.generatorui.common.core.providers.SpringWebProvider; import org.springframework.util.CollectionUtils; import org.springframework.web.method.HandlerMethod; diff --git a/mybatis-plus-generator-ui-starter-webmvc-ui/pom.xml b/mybatis-plus-generator-ui-starter-webmvc-ui/pom.xml index 83b5408..92b7dfe 100644 --- a/mybatis-plus-generator-ui-starter-webmvc-ui/pom.xml +++ b/mybatis-plus-generator-ui-starter-webmvc-ui/pom.xml @@ -34,5 +34,10 @@ tomcat-embed-core test - + + org.projectlombok + lombok + true + + \ No newline at end of file diff --git a/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/ui/SwaggerConfig.java b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/ui/SwaggerConfig.java index af4c2a5..8e34d74 100644 --- a/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/ui/SwaggerConfig.java +++ b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/ui/SwaggerConfig.java @@ -49,7 +49,7 @@ SpringWebProvider springWebProvider() { @ConditionalOnMissingBean @ConditionalOnProperty(name = SPRINGDOC_USE_ROOT_PATH, havingValue = "true") @Lazy(false) - SwaggerUiHome swaggerUiHome() { - return new SwaggerUiHome(); + UiHome swaggerUiHome() { + return new UiHome(); } } diff --git a/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/ui/SwaggerUiHome.java b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/ui/UiHome.java similarity index 88% rename from mybatis-plus-generator-ui-starter-webmvc-ui/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/ui/SwaggerUiHome.java rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/ui/UiHome.java index 55f0dce..060d027 100644 --- a/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/ui/SwaggerUiHome.java +++ b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/ui/UiHome.java @@ -31,18 +31,18 @@ import org.springframework.web.bind.annotation.GetMapping; import static com.github.davidfantasy.mybatisplus.generatorui.common.core.utils.Constants.MVC_SERVLET_PATH; -import static com.github.davidfantasy.mybatisplus.generatorui.common.core.utils.Constants.SWAGGER_UI_PATH; +import static com.github.davidfantasy.mybatisplus.generatorui.common.core.utils.Constants.MYBATIS_GENERATOR_UI_PATH; import static org.springframework.util.AntPathMatcher.DEFAULT_PATH_SEPARATOR; -import static org.springframework.web.servlet.view.UrlBasedViewResolver.REDIRECT_URL_PREFIX; +import static org.springframework.web.servlet.view.UrlBasedViewResolver.FORWARD_URL_PREFIX; /** * Home redirection to swagger api documentation */ @Controller -public class SwaggerUiHome { +public class UiHome { - @Value(SWAGGER_UI_PATH) - private String swaggerUiPath; + @Value(MYBATIS_GENERATOR_UI_PATH) + private String mybatisGeneratorUiPath; @Value(MVC_SERVLET_PATH) private String mvcServletPath; @@ -59,6 +59,6 @@ public String index() { uiRootPath.append(mvcServletPath); } - return REDIRECT_URL_PREFIX + uiRootPath + swaggerUiPath; + return FORWARD_URL_PREFIX + uiRootPath + mybatisGeneratorUiPath; } } \ No newline at end of file diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/configurer/WebConfigurer.java b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/ui/WebConfigurer.java similarity index 81% rename from mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/configurer/WebConfigurer.java rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/ui/WebConfigurer.java index 3f88c7e..28a0c46 100644 --- a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/configurer/WebConfigurer.java +++ b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/ui/WebConfigurer.java @@ -1,11 +1,10 @@ -package com.github.davidfantasy.mybatisplus.generatorui.common.configurer; +package com.github.davidfantasy.mybatisplus.generatorui.webmvc.ui; import org.springframework.boot.web.server.ErrorPage; import org.springframework.boot.web.server.ErrorPageRegistrar; import org.springframework.boot.web.server.ErrorPageRegistry; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.core.Ordered; import org.springframework.http.HttpStatus; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; @@ -18,11 +17,10 @@ public class WebConfigurer implements WebMvcConfigurer { @Override public void addViewControllers(ViewControllerRegistry registry) { - registry.addViewController("/").setViewName("forward:/index.html"); - registry.setOrder(Ordered.HIGHEST_PRECEDENCE); + // registry.addViewController("/").setViewName("forward:/index.html"); + // registry.setOrder(Ordered.HIGHEST_PRECEDENCE); } - @Bean public ErrorPageRegistrar errorPageRegistrar() { return new MyErrorPageRegistrar(); diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/controller.java.btl b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/codetpls/controller.java.btl similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/controller.java.btl rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/codetpls/controller.java.btl diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/dto.btl b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/codetpls/dto.btl similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/dto.btl rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/codetpls/dto.btl diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/entity.java.btl b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/codetpls/entity.java.btl similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/entity.java.btl rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/codetpls/entity.java.btl diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/mapper.java.btl b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/codetpls/mapper.java.btl similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/mapper.java.btl rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/codetpls/mapper.java.btl diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/mapper.xml.btl b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/codetpls/mapper.xml.btl similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/mapper.xml.btl rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/codetpls/mapper.xml.btl diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/mapperMethods.btl b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/codetpls/mapperMethods.btl similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/mapperMethods.btl rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/codetpls/mapperMethods.btl diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/resultMap.btl b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/codetpls/resultMap.btl similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/resultMap.btl rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/codetpls/resultMap.btl diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/service.java.btl b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/codetpls/service.java.btl similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/service.java.btl rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/codetpls/service.java.btl diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/serviceImpl.java.btl b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/codetpls/serviceImpl.java.btl similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/serviceImpl.java.btl rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/codetpls/serviceImpl.java.btl diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/09694b79d33cba9c2850.js b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/09694b79d33cba9c2850.js similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/09694b79d33cba9c2850.js rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/09694b79d33cba9c2850.js diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/27503bae7f340bb103e0.js b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/27503bae7f340bb103e0.js similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/27503bae7f340bb103e0.js rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/27503bae7f340bb103e0.js diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/27503bae7f340bb103e0.js.map b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/27503bae7f340bb103e0.js.map similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/27503bae7f340bb103e0.js.map rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/27503bae7f340bb103e0.js.map diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/4d665454dfb48fc57305.js b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/4d665454dfb48fc57305.js similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/4d665454dfb48fc57305.js rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/4d665454dfb48fc57305.js diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/52cc4ad706f1ab56fd67.js b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/52cc4ad706f1ab56fd67.js similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/52cc4ad706f1ab56fd67.js rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/52cc4ad706f1ab56fd67.js diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/77f28fc3ed6d061a9232.js b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/77f28fc3ed6d061a9232.js similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/77f28fc3ed6d061a9232.js rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/77f28fc3ed6d061a9232.js diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/7b68d0166b8d500e2875.js b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/7b68d0166b8d500e2875.js similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/7b68d0166b8d500e2875.js rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/7b68d0166b8d500e2875.js diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/86adaf226d0c8490dad4.js b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/86adaf226d0c8490dad4.js similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/86adaf226d0c8490dad4.js rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/86adaf226d0c8490dad4.js diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/9d53f74ea8103025e271.js b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/9d53f74ea8103025e271.js similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/9d53f74ea8103025e271.js rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/9d53f74ea8103025e271.js diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/LICENSES b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/LICENSES similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/LICENSES rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/LICENSES diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/cf49cb65f4df44b6a375.js b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/cf49cb65f4df44b6a375.js similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/cf49cb65f4df44b6a375.js rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/cf49cb65f4df44b6a375.js diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/cf49cb65f4df44b6a375.js.map b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/cf49cb65f4df44b6a375.js.map similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/cf49cb65f4df44b6a375.js.map rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/cf49cb65f4df44b6a375.js.map diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/e5273501af6c8ff2839e.js b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/e5273501af6c8ff2839e.js similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/e5273501af6c8ff2839e.js rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/e5273501af6c8ff2839e.js diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/fonts/535877f.woff b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/fonts/535877f.woff similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/fonts/535877f.woff rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/fonts/535877f.woff diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/fonts/674f50d.eot b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/fonts/674f50d.eot similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/fonts/674f50d.eot rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/fonts/674f50d.eot diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/fonts/732389d.ttf b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/fonts/732389d.ttf similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/fonts/732389d.ttf rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/fonts/732389d.ttf diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/fonts/af7ae50.woff2 b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/fonts/af7ae50.woff2 similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/fonts/af7ae50.woff2 rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/fonts/af7ae50.woff2 diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/fonts/b06871f.ttf b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/fonts/b06871f.ttf similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/fonts/b06871f.ttf rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/fonts/b06871f.ttf diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/fonts/fee66e7.woff b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/fonts/fee66e7.woff similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/fonts/fee66e7.woff rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/fonts/fee66e7.woff diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/img/acf3dcb.svg b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/img/acf3dcb.svg similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/img/acf3dcb.svg rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/img/acf3dcb.svg diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/img/af9195e.png b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/img/af9195e.png similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/public/_nuxt/img/af9195e.png rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/_nuxt/img/af9195e.png diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/public/index.html b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/index.html similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/public/index.html rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/index.html diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/adminlte/adminlte.min.css b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/libs/adminlte/adminlte.min.css similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/adminlte/adminlte.min.css rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/libs/adminlte/adminlte.min.css diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/adminlte/adminlte.min.js b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/libs/adminlte/adminlte.min.js similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/adminlte/adminlte.min.js rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/libs/adminlte/adminlte.min.js diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/bootstrap/css/bootstrap.min.css b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/libs/bootstrap/css/bootstrap.min.css similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/bootstrap/css/bootstrap.min.css rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/libs/bootstrap/css/bootstrap.min.css diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/bootstrap/css/bootstrap.min.css.map b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/libs/bootstrap/css/bootstrap.min.css.map similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/bootstrap/css/bootstrap.min.css.map rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/libs/bootstrap/css/bootstrap.min.css.map diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/bootstrap/js/bootstrap.min.js b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/libs/bootstrap/js/bootstrap.min.js similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/bootstrap/js/bootstrap.min.js rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/libs/bootstrap/js/bootstrap.min.js diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/font-awesome/css/font-awesome.min.css b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/libs/font-awesome/css/font-awesome.min.css similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/font-awesome/css/font-awesome.min.css rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/libs/font-awesome/css/font-awesome.min.css diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/font-awesome/fonts/FontAwesome.otf b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/libs/font-awesome/fonts/FontAwesome.otf similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/font-awesome/fonts/FontAwesome.otf rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/libs/font-awesome/fonts/FontAwesome.otf diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.eot b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.eot similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.eot rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.eot diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.svg b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.svg similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.svg rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.svg diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.ttf b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.ttf similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.ttf rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.ttf diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.woff b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.woff similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.woff rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.woff diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.woff2 b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.woff2 similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.woff2 rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/libs/font-awesome/fonts/fontawesome-webfont.woff2 diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/jquery.fullscreen-min.js b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/libs/jquery.fullscreen-min.js similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/jquery.fullscreen-min.js rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/libs/jquery.fullscreen-min.js diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/jquery.min.js b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/libs/jquery.min.js similarity index 100% rename from mybatis-plus-generator-ui-starter-common/src/main/resources/public/libs/jquery.min.js rename to mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/public/libs/jquery.min.js diff --git a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/pom.xml b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/pom.xml index ac9a450..abe7aac 100644 --- a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/pom.xml +++ b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/pom.xml @@ -11,7 +11,7 @@ com.github.davidfantasy - mybatis-plus-generator-ui-starter-webmvc-api + mybatis-plus-generator-ui-starter-webmvc-ui ${project.version} From 192f46d709f4b19a99056dfe0acdd7650e01cfa7 Mon Sep 17 00:00:00 2001 From: klaokai <573984425@qq.com> Date: Wed, 11 Sep 2024 12:00:03 +0800 Subject: [PATCH 08/11] =?UTF-8?q?feat:=20=E6=9B=B4=E6=94=B9=E6=88=90?= =?UTF-8?q?=E8=83=BD=E4=B8=8A=E7=BA=BF=E4=BD=BF=E7=94=A8=E7=9A=84=E6=A1=86?= =?UTF-8?q?=E6=9E=B6?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../common/ApplicationConfigure.java | 19 + .../generatorui/common/GeneratorConfig.java | 4 + .../MybatisPlusToolsApplication.java | 33 +- .../common/ProjectPathResolver.java | 2 +- .../generatorui/common/api/Result.java | 13 +- ...batisplusGeneratoruiAutoConfiguration.java | 71 +++ .../configuration/OpenApiResourceAdvice.java | 31 ++ .../configuration/SpringDocConfiguration.java | 93 ---- .../configuration/WebControllerAdvice.java | 38 ++ .../properties/SpringDocConfigProperties.java | 66 ++- .../core/providers/SpringWebProvider.java | 55 --- .../common/core/utils/Constants.java | 420 ------------------ .../common/core/utils/JsonUtil.java | 64 --- .../generatorui/common/core/utils/OSUtil.java | 24 - .../common/core/utils/PathUtil.java | 41 -- .../common/core/utils/SpringDocUtils.java | 58 --- .../generatorui/common/util/Constants.java | 81 ++++ .../main/resources/META-INF/spring.factories | 3 +- .../resources/application-test.properties | 4 - .../pom.xml | 3 + .../api/MultipleOpenApiActuatorResource.java | 27 -- .../webmvc/api/api/OpenApiWebMvcResource.java | 2 +- .../core/SpringDocWebMvcConfiguration.java | 21 +- .../webmvc/api/core/SpringWebMvcProvider.java | 112 ----- .../pom.xml | 3 + .../generatorui/webmvc/ui/SwaggerConfig.java | 55 --- .../generatorui/webmvc/ui/UiHome.java | 24 +- .../generatorui/webmvc/ui/WebConfigurer.java | 27 +- .../main/resources/META-INF/spring.factories | 2 +- .../MybatisplusGeneratoruiConfiguration.java | 34 ++ .../generatorui/ServerApplication.java | 24 +- .../src/main/resources/application.yaml | 15 +- .../generatorui/AbstractSpringDocTest.java | 73 --- .../generatorui/app2/SpringDocApp2Test.java | 29 -- .../generatorui/AbstractCommonTest.java | 2 +- .../generatorui/AbstractSpringDocTest.java | 40 ++ .../generatorui/TestApplication.java | 11 +- .../generatorui/TestSqlParser.java | 2 +- .../generatorui/app2/SpringDocApp2Test.java | 10 + .../generatorui/app3/SpringDocApp3Test.java | 4 +- .../resources/application-test.properties | 5 - .../src/test/resources/application-test.yml | 21 + 42 files changed, 501 insertions(+), 1165 deletions(-) rename mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/{ => common}/MybatisPlusToolsApplication.java (76%) create mode 100644 mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/MybatisplusGeneratoruiAutoConfiguration.java create mode 100644 mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/OpenApiResourceAdvice.java delete mode 100644 mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/SpringDocConfiguration.java create mode 100644 mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/WebControllerAdvice.java delete mode 100644 mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/providers/SpringWebProvider.java delete mode 100644 mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/Constants.java delete mode 100644 mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/JsonUtil.java delete mode 100644 mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/OSUtil.java delete mode 100644 mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/PathUtil.java delete mode 100644 mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/SpringDocUtils.java create mode 100644 mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/util/Constants.java delete mode 100644 mybatis-plus-generator-ui-starter-common/src/test/resources/application-test.properties delete mode 100644 mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api/MultipleOpenApiActuatorResource.java delete mode 100644 mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/core/SpringWebMvcProvider.java delete mode 100644 mybatis-plus-generator-ui-starter-webmvc-ui/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/ui/SwaggerConfig.java create mode 100644 mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/MybatisplusGeneratoruiConfiguration.java delete mode 100644 mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/AbstractSpringDocTest.java delete mode 100644 mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/app2/SpringDocApp2Test.java rename mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/{ => test}/com/github/davidfantasy/mybatisplus/generatorui/AbstractCommonTest.java (94%) create mode 100644 mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/test/com/github/davidfantasy/mybatisplus/generatorui/AbstractSpringDocTest.java rename mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/{ => test}/com/github/davidfantasy/mybatisplus/generatorui/TestApplication.java (68%) rename mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/{ => test}/com/github/davidfantasy/mybatisplus/generatorui/TestSqlParser.java (99%) create mode 100644 mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/test/com/github/davidfantasy/mybatisplus/generatorui/app2/SpringDocApp2Test.java rename mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/{ => test}/com/github/davidfantasy/mybatisplus/generatorui/app3/SpringDocApp3Test.java (91%) delete mode 100644 mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/resources/application-test.properties create mode 100644 mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/resources/application-test.yml diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/ApplicationConfigure.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/ApplicationConfigure.java index a84f2fd..ed7fb0c 100644 --- a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/ApplicationConfigure.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/ApplicationConfigure.java @@ -8,6 +8,8 @@ import com.zaxxer.hikari.HikariDataSource; import org.springframework.beans.factory.ObjectProvider; import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.web.server.WebServerFactoryCustomizer; +import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.jdbc.core.JdbcTemplate; @@ -16,6 +18,23 @@ @Configuration public class ApplicationConfigure { + /** + * 通过注入一个WebServerFactoryCustomizer来达到修改服务器端口的目的 + * + * @param config + * @return + */ + @Bean + public WebServerFactoryCustomizer containerConfig(GeneratorConfig config) { + return factory -> { + if (config.getPort() != null) { + factory.setPort(config.getPort()); + } else { + factory.setPort(8080); + } + factory.setContextPath(""); + }; + } @Bean public ProjectPathResolver projectPathResolver(GeneratorConfig config) { diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/GeneratorConfig.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/GeneratorConfig.java index 0d64066..37bce28 100644 --- a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/GeneratorConfig.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/GeneratorConfig.java @@ -5,11 +5,15 @@ import com.baomidou.mybatisplus.generator.config.rules.DateType; import com.github.davidfantasy.mybatisplus.generatorui.common.mbp.NameConverter; import com.github.davidfantasy.mybatisplus.generatorui.common.mbp.TemplateVaribleInjecter; +import lombok.AllArgsConstructor; import lombok.Builder; import lombok.Data; +import lombok.NoArgsConstructor; @Builder @Data +@NoArgsConstructor +@AllArgsConstructor public class GeneratorConfig { /** diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/MybatisPlusToolsApplication.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/MybatisPlusToolsApplication.java similarity index 76% rename from mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/MybatisPlusToolsApplication.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/MybatisPlusToolsApplication.java index 4328eae..00df29f 100644 --- a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/MybatisPlusToolsApplication.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/MybatisPlusToolsApplication.java @@ -1,6 +1,5 @@ -package com.github.davidfantasy.mybatisplus.generatorui; +package com.github.davidfantasy.mybatisplus.generatorui.common; -import com.github.davidfantasy.mybatisplus.generatorui.common.GeneratorConfig; import com.google.common.base.Strings; import com.google.common.collect.Maps; import lombok.extern.slf4j.Slf4j; @@ -11,6 +10,7 @@ import org.springframework.boot.builder.SpringApplicationBuilder; import org.springframework.boot.web.server.WebServerFactoryCustomizer; import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory; +import org.springframework.context.ConfigurableApplicationContext; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; import org.springframework.context.annotation.Configuration; @@ -51,42 +51,27 @@ public static void run(Class clazz, String[] args, GeneratorConfig generatorC props.put("spring.datasource.driver-class-name", generatorConfig.getDriverClassName()); props.put("spring.datasource.username", generatorConfig.getUserName()); props.put("spring.datasource.password", generatorConfig.getPassword()); - new SpringApplicationBuilder() + ConfigurableApplicationContext run = new SpringApplicationBuilder() .properties(props) .sources(clazz) .run(args); + } - @Configuration +/* @Configuration public static class MainConfigutration { - /** - * 通过注入一个WebServerFactoryCustomizer来达到修改服务器端口的目的 - * - * @param config - * @return - */ - @Bean - public WebServerFactoryCustomizer containerConfig(GeneratorConfig config) { - return factory -> { - if (config.getPort() != null) { - factory.setPort(MybatisPlusToolsApplication.generatorConfig.getPort()); - } else { - factory.setPort(8080); - } - factory.setContextPath(""); - }; - } - /** + + *//** * 注入项目配置 * * @return 项目配置的对象 - */ + *//* @Bean public GeneratorConfig generatorConfig() { return MybatisPlusToolsApplication.generatorConfig; } - } + }*/ } diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/ProjectPathResolver.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/ProjectPathResolver.java index 0545e5e..6d0351b 100644 --- a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/ProjectPathResolver.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/ProjectPathResolver.java @@ -1,7 +1,7 @@ package com.github.davidfantasy.mybatisplus.generatorui.common; import com.github.davidfantasy.mybatisplus.generatorui.common.api.ServiceException; -import com.github.davidfantasy.mybatisplus.generatorui.common.core.utils.OSUtil; +import com.github.davidfantasy.mybatisplus.generatorui.common.util.OSUtil; import com.github.davidfantasy.mybatisplus.generatorui.common.util.PathUtil; import com.google.common.base.Strings; import lombok.Getter; diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/api/Result.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/api/Result.java index d2d2211..203c704 100644 --- a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/api/Result.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/api/Result.java @@ -1,5 +1,6 @@ package com.github.davidfantasy.mybatisplus.generatorui.common.api; -import com.github.davidfantasy.mybatisplus.generatorui.common.core.utils.JsonUtil; + +import com.github.davidfantasy.mybatisplus.generatorui.common.util.JsonUtil; /** * 统一API响应结果封装 @@ -21,15 +22,15 @@ public class Result { */ private Object data; + public int getCode() { + return code; + } + public Result setCode(ResultCode resultCode) { this.code = resultCode.code; return this; } - public int getCode() { - return code; - } - public Result setCode(int code) { this.code = code; return this; @@ -57,5 +58,5 @@ public Result setData(Object data) { public String toString() { return JsonUtil.obj2json(this); } - + } diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/MybatisplusGeneratoruiAutoConfiguration.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/MybatisplusGeneratoruiAutoConfiguration.java new file mode 100644 index 0000000..1b7c2dd --- /dev/null +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/MybatisplusGeneratoruiAutoConfiguration.java @@ -0,0 +1,71 @@ +package com.github.davidfantasy.mybatisplus.generatorui.common.core.configuration; + +import com.baomidou.mybatisplus.generator.config.ITypeConvert; +import com.github.davidfantasy.mybatisplus.generatorui.common.ApplicationConfigure; +import com.github.davidfantasy.mybatisplus.generatorui.common.GeneratorConfig; +import com.github.davidfantasy.mybatisplus.generatorui.common.core.properties.SpringDocConfigProperties; +import com.github.davidfantasy.mybatisplus.generatorui.common.util.Constants; +import com.github.davidfantasy.mybatisplus.generatorui.common.mbp.NameConverter; +import com.github.davidfantasy.mybatisplus.generatorui.common.mbp.TemplateVaribleInjecter; +import lombok.extern.slf4j.Slf4j; +import org.springframework.beans.factory.ObjectProvider; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; +import org.springframework.boot.context.properties.EnableConfigurationProperties; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; +import org.springframework.context.annotation.Lazy; +import org.springframework.core.LocalVariableTableParameterNameDiscoverer; + +@Slf4j +@Lazy(false) +@Configuration(proxyBeanMethods = false) +@ConditionalOnProperty(name = Constants.MYBATISPLUS_GENETATORUI_ENABLED, matchIfMissing = true) +@ConditionalOnWebApplication +@Import({ApplicationConfigure.class}) +@EnableConfigurationProperties({SpringDocConfigProperties.class}) +public class MybatisplusGeneratoruiAutoConfiguration { + /** + * Local spring doc parameter name discoverer local variable table parameter name discoverer. + * + * @return the local variable table parameter name discoverer + */ + @Bean + @Lazy(false) + LocalVariableTableParameterNameDiscoverer localSpringDocParameterNameDiscoverer() { + return new LocalVariableTableParameterNameDiscoverer(); + } + + + /** + * 注入项目配置 + * + * @return 项目配置的对象 + */ + @Bean + public GeneratorConfig generatorConfig(@Autowired SpringDocConfigProperties properties, + ObjectProvider nameConverterObjectProvider, + ObjectProvider typeConvertObjectProvider, + ObjectProvider templateVaribleInjecterObjectProvider + + ) { + return GeneratorConfig.builder() + .jdbcUrl(properties.getJdbcUrl()) + .userName(properties.getUserName()) + .password(properties.getPassword()) + .port(properties.getPort()) + .driverClassName(properties.getDriverClassName()) + .basePackage(properties.getBasePackage()) + .schemaName(properties.getSchemaName()) + //数据库表前缀,生成entity名称时会去掉 + .tablePrefix(properties.getTablePrefix()) + .idType(properties.getIdType()) + .dateType(properties.getDateType()) + .nameConverter(nameConverterObjectProvider.getIfAvailable()) + .typeConvert(typeConvertObjectProvider.getIfAvailable()) + .templateVaribleInjecter(templateVaribleInjecterObjectProvider.getIfAvailable()) + .build(); + } +} diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/OpenApiResourceAdvice.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/OpenApiResourceAdvice.java new file mode 100644 index 0000000..6c9f9d9 --- /dev/null +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/OpenApiResourceAdvice.java @@ -0,0 +1,31 @@ +package com.github.davidfantasy.mybatisplus.generatorui.common.core.configuration; + +import com.github.davidfantasy.mybatisplus.generatorui.common.api.Result; +import com.github.davidfantasy.mybatisplus.generatorui.common.api.ResultGenerator; +import com.github.davidfantasy.mybatisplus.generatorui.common.api.ServiceException; +import org.springframework.http.HttpStatus; +import org.springframework.http.ResponseEntity; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.ResponseStatus; +import org.springframework.web.bind.annotation.RestControllerAdvice; + +/** + * The type Open api resource advice. + * + * @author bnasslashen + */ +@RestControllerAdvice +class OpenApiResourceAdvice { + /** + * Handle no handler found response entity. + * + * @param e the e + * @return the response entity + */ + @ExceptionHandler(ServiceException.class) + @ResponseStatus(HttpStatus.NOT_FOUND) + public ResponseEntity handleNoHandlerFound(ServiceException e) { + return ResponseEntity.status(HttpStatus.NOT_FOUND) + .body(ResultGenerator.genFailResult(e.getMessage())); + } +} diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/SpringDocConfiguration.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/SpringDocConfiguration.java deleted file mode 100644 index d579c0e..0000000 --- a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/SpringDocConfiguration.java +++ /dev/null @@ -1,93 +0,0 @@ -package com.github.davidfantasy.mybatisplus.generatorui.common.core.configuration; - -import com.github.davidfantasy.mybatisplus.generatorui.common.ApplicationConfigure; -import com.github.davidfantasy.mybatisplus.generatorui.common.api.Result; -import com.github.davidfantasy.mybatisplus.generatorui.common.api.ResultCode; -import com.github.davidfantasy.mybatisplus.generatorui.common.api.ResultGenerator; -import com.github.davidfantasy.mybatisplus.generatorui.common.api.ServiceException; -import com.github.davidfantasy.mybatisplus.generatorui.common.core.utils.Constants; -import lombok.extern.slf4j.Slf4j; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Import; -import org.springframework.context.annotation.Lazy; -import org.springframework.core.LocalVariableTableParameterNameDiscoverer; -import org.springframework.http.HttpStatus; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.servlet.NoHandlerFoundException; - -@Lazy(false) -@Configuration(proxyBeanMethods = false) -@ConditionalOnProperty(name = Constants.SPRINGDOC_ENABLED, matchIfMissing = true) -@ConditionalOnWebApplication -@Import({ApplicationConfigure.class}) -public class SpringDocConfiguration { - - /** - * The constant BINDRESULT_CLASS. - */ - private static final String BINDRESULT_CLASS = "org.springframework.boot.context.properties.bind.BindResult"; - - /** - * Local spring doc parameter name discoverer local variable table parameter name discoverer. - * - * @return the local variable table parameter name discoverer - */ - @Bean - @Lazy(false) - LocalVariableTableParameterNameDiscoverer localSpringDocParameterNameDiscoverer() { - return new LocalVariableTableParameterNameDiscoverer(); - } - - /** - * The type Open api resource advice. - * - * @author bnasslashen - */ - @RestControllerAdvice - class OpenApiResourceAdvice { - /** - * Handle no handler found response entity. - * - * @param e the e - * @return the response entity - */ - @ExceptionHandler(ServiceException.class) - @ResponseStatus(HttpStatus.NOT_FOUND) - public ResponseEntity handleNoHandlerFound(ServiceException e) { - return ResponseEntity.status(HttpStatus.NOT_FOUND) - .body(ResultGenerator.genFailResult(e.getMessage())); - } - } - - /** - * 用于全局异常处理 - */ - @ControllerAdvice - @Slf4j - public class WebControllerAdvice { - - @ExceptionHandler(value = Exception.class) - @ResponseBody - public Result exceptionHandler(Exception e) { - Result result = new Result(); - log.info("未捕获的异常:" + e.getMessage(), e); - if (e instanceof ServiceException) { - result.setCode(ResultCode.FAIL).setMessage(e.getMessage()); - } else if (e instanceof NoHandlerFoundException) { - NoHandlerFoundException ex = (NoHandlerFoundException) e; - result.setCode(ResultCode.NOT_FOUND).setMessage("接口 [" + ex.getRequestURL() + "] 不存在"); - } else if (e instanceof RuntimeException) { - result.setCode(ResultCode.FAIL).setMessage(e.getMessage()); - } else { - result.setCode(ResultCode.INTERNAL_SERVER_ERROR).setMessage("系统发生内部错误,请联系管理员"); - log.error("系统发生内部错误,请查看控制台日志了解详情", e); - } - return result; - } - - } -} diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/WebControllerAdvice.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/WebControllerAdvice.java new file mode 100644 index 0000000..1a1884e --- /dev/null +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/WebControllerAdvice.java @@ -0,0 +1,38 @@ +package com.github.davidfantasy.mybatisplus.generatorui.common.core.configuration; + +import com.github.davidfantasy.mybatisplus.generatorui.common.api.Result; +import com.github.davidfantasy.mybatisplus.generatorui.common.api.ResultCode; +import com.github.davidfantasy.mybatisplus.generatorui.common.api.ServiceException; +import lombok.extern.slf4j.Slf4j; +import org.springframework.web.bind.annotation.ControllerAdvice; +import org.springframework.web.bind.annotation.ExceptionHandler; +import org.springframework.web.bind.annotation.ResponseBody; +import org.springframework.web.servlet.NoHandlerFoundException; + +/** + * 用于全局异常处理 + */ +@ControllerAdvice +@Slf4j +public class WebControllerAdvice { + + @ExceptionHandler(value = Exception.class) + @ResponseBody + public Result exceptionHandler(Exception e) { + Result result = new Result(); + log.info("未捕获的异常:" + e.getMessage(), e); + if (e instanceof ServiceException) { + result.setCode(ResultCode.FAIL).setMessage(e.getMessage()); + } else if (e instanceof NoHandlerFoundException) { + NoHandlerFoundException ex = (NoHandlerFoundException) e; + result.setCode(ResultCode.NOT_FOUND).setMessage("接口 [" + ex.getRequestURL() + "] 不存在"); + } else if (e instanceof RuntimeException) { + result.setCode(ResultCode.FAIL).setMessage(e.getMessage()); + } else { + result.setCode(ResultCode.INTERNAL_SERVER_ERROR).setMessage("系统发生内部错误,请联系管理员"); + log.error("系统发生内部错误,请查看控制台日志了解详情", e); + } + return result; + } + +} \ No newline at end of file diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/properties/SpringDocConfigProperties.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/properties/SpringDocConfigProperties.java index 45bf744..a527d9a 100644 --- a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/properties/SpringDocConfigProperties.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/properties/SpringDocConfigProperties.java @@ -22,26 +22,72 @@ package com.github.davidfantasy.mybatisplus.generatorui.common.core.properties; -import com.github.davidfantasy.mybatisplus.generatorui.common.core.utils.Constants; +import com.baomidou.mybatisplus.annotation.IdType; +import com.baomidou.mybatisplus.generator.config.rules.DateType; +import com.github.davidfantasy.mybatisplus.generatorui.common.util.Constants; +import lombok.Data; import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; import org.springframework.boot.context.properties.ConfigurationProperties; -import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Lazy; -import org.springframework.http.MediaType; - -import java.util.ArrayList; -import java.util.List; /** - * The type Spring doc config properties. + * 关于生成器的配置文件 * * @author bnasslahsen */ +@Data @Lazy(false) -@Configuration(proxyBeanMethods = false) -@ConfigurationProperties(prefix = Constants.SPRINGDOC_PREFIX) -@ConditionalOnProperty(name = Constants.SPRINGDOC_ENABLED, matchIfMissing = true) +@ConfigurationProperties(prefix = Constants.MYBATISPLUS_GENETATORUI_PREFIX) +@ConditionalOnProperty(name = Constants.MYBATISPLUS_GENETATORUI_ENABLED, matchIfMissing = true) public class SpringDocConfigProperties { + /** + * 服务启动的端口号 + */ + private Integer port = 8068; + + /** + * 生成的文件所保存的包路径 + */ + private String basePackage = "generatorui.default"; + + /** + * 数据库地址 + */ + private String jdbcUrl; + + /** + * 数据库schema,POSTGRE_SQL,ORACLE,DB2,MSSQL类型的数据库需要指定 + */ + private String schemaName; + + /** + * 数据库用户名 + */ + private String userName; + + /** + * 数据库密码 + */ + private String password; + + /** + * 数据库驱动名 + */ + private String driverClassName = "com.mysql.cj.jdbc.Driver"; + + /** + * 数据库时间类型与java class的对应策略 + */ + private DateType dateType; + + /** + * 表前缀,如果设置后会在生成entity名称时去掉该后缀 + */ + private String tablePrefix; + /** + * 全局指定数据表中ID的生成模式,影响自动生成的Entity中ID字段的注解 + */ + private IdType idType; } diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/providers/SpringWebProvider.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/providers/SpringWebProvider.java deleted file mode 100644 index 836b185..0000000 --- a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/providers/SpringWebProvider.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.github.davidfantasy.mybatisplus.generatorui.common.core.providers; - -import com.github.davidfantasy.mybatisplus.generatorui.common.core.properties.SpringDocConfigProperties; -import org.springframework.beans.BeansException; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; - -import java.util.Map; -import java.util.Set; - -/** - * The type Spring web provider. - * - * @author bnasslahsen - */ -public abstract class SpringWebProvider implements ApplicationContextAware { - - /** - * The Application context. - */ - protected ApplicationContext applicationContext; - - /** - * The Handler methods. - */ - protected Map handlerMethods; - - /** - * Gets handler methods. - * - * @return the handler methods - */ - public abstract Map getHandlerMethods(); - - /** - * Find path prefix string. - * - * @param springDocConfigProperties the spring doc config properties - * @return the string - */ - public abstract String findPathPrefix(SpringDocConfigProperties springDocConfigProperties); - - /** - * Gets active patterns. - * - * @param requestMappingInfo the request mapping info - * @return the active patterns - */ - public abstract Set getActivePatterns(Object requestMappingInfo); - - @Override - public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { - this.applicationContext = applicationContext; - } -} diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/Constants.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/Constants.java deleted file mode 100644 index 65a54fb..0000000 --- a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/Constants.java +++ /dev/null @@ -1,420 +0,0 @@ -/* - * - * * - * * * - * * * * - * * * * * Copyright 2019-2022 the original author or authors. - * * * * * - * * * * * Licensed under the Apache License, Version 2.0 (the "License"); - * * * * * you may not use this file except in compliance with the License. - * * * * * You may obtain a copy of the License at - * * * * * - * * * * * https://www.apache.org/licenses/LICENSE-2.0 - * * * * * - * * * * * Unless required by applicable law or agreed to in writing, software - * * * * * distributed under the License is distributed on an "AS IS" BASIS, - * * * * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * * * * * See the License for the specific language governing permissions and - * * * * * limitations under the License. - * * * * - * * * - * * - * - */ - -package com.github.davidfantasy.mybatisplus.generatorui.common.core.utils; - -import org.springframework.util.ResourceUtils; - -import static org.springframework.util.AntPathMatcher.DEFAULT_PATH_SEPARATOR; - -/** - * The type Constants. - * @author bnasslahsen - */ -public final class Constants { - - /** - * The constant SPRINGDOC_PREFIX. - */ - public static final String SPRINGDOC_PREFIX = "springdoc"; - - /** - * The constant DEFAULT_API_DOCS_URL. - */ - public static final String DEFAULT_API_DOCS_URL = "/v3/api-docs"; - - /** - * The constant DEFAULT_SERVER_DESCRIPTION. - */ - public static final String DEFAULT_SERVER_DESCRIPTION = "Generated server url"; - - /** - * The constant API_DOCS_URL. - */ - public static final String API_DOCS_URL = "${springdoc.api-docs.path:#{T(com.github.davidfantasy.mybatisplus.generatorui.common.core.utils.Constants).DEFAULT_API_DOCS_URL}}"; - - /** - * The constant SWAGGER_CONFIG_FILE. - */ - public static final String SWAGGER_CONFIG_FILE = "swagger-config"; - - /** - * The constant SWAGGER_CONFIG_URL. - */ - public static final String SWAGGER_CONFIG_URL = API_DOCS_URL + DEFAULT_PATH_SEPARATOR + SWAGGER_CONFIG_FILE; - - /** - * The constant YAML. - */ - public static final String YAML = "yaml"; - - /** - * The constant DOT. - */ - public static final String DOT = "."; - - /** - * The constant DEFAULT_API_DOCS_URL_YAML. - */ - public static final String DEFAULT_API_DOCS_URL_YAML = API_DOCS_URL + DOT + YAML; - - /** - * The constant SPRINGDOC_ENABLED. - */ - public static final String SPRINGDOC_ENABLED = "springdoc.api-docs.enabled"; - - /** - * The constant SPRINGDOC_DEPRECATING_CONVERTER_ENABLED. - */ - public static final String SPRINGDOC_DEPRECATING_CONVERTER_ENABLED = "springdoc.model-converters.deprecating-converter.enabled"; - - /** - * The constant SPRINGDOC_PAGEABLE_CONVERTER_ENABLED. - */ - public static final String SPRINGDOC_PAGEABLE_CONVERTER_ENABLED = "springdoc.model-converters.pageable-converter.enabled"; - - /** - * The constant SPRINGDOC_POLYMORPHIC_CONVERTER_ENABLED. - */ - public static final String SPRINGDOC_POLYMORPHIC_CONVERTER_ENABLED = "springdoc.model-converters.polymorphic-converter.enabled"; - - /** - * The constant SPRINGDOC_SCHEMA_RESOLVE_PROPERTIES. - */ - public static final String SPRINGDOC_SCHEMA_RESOLVE_PROPERTIES = "springdoc.api-docs.resolve-schema-properties"; - - /** - * The constant SPRINGDOC_SHOW_LOGIN_ENDPOINT. - */ - public static final String SPRINGDOC_SHOW_LOGIN_ENDPOINT = "springdoc.show-login-endpoint"; - - /** - * The constant SPRINGDOC_SHOW_OAUTH2_ENDPOINTS. - */ - public static final String SPRINGDOC_SHOW_OAUTH2_ENDPOINTS = "springdoc.show-oauth2-endpoints"; - - /** - * The constant SPRINGDOC_CACHE_DISABLED. - */ - public static final String SPRINGDOC_CACHE_DISABLED = "springdoc.cache.disabled"; - - /** - * The constant SPRINGDOC_SWAGGER_UI_ENABLED. - */ - public static final String SPRINGDOC_SWAGGER_UI_ENABLED = "springdoc.swagger-ui.enabled"; - - /** - * The constant NULL. - */ - public static final String NULL = ":#{null}"; - - /** - * The constant SPRING_MVC_SERVLET_PATH. - */ - public static final String SPRING_MVC_SERVLET_PATH = "spring.mvc.servlet.path"; - - /** - * The constant MVC_SERVLET_PATH. - */ - public static final String MVC_SERVLET_PATH = "${" + SPRING_MVC_SERVLET_PATH + NULL + "}"; - - /** - * The constant SPRINGDOC_SHOW_ACTUATOR. - */ - public static final String SPRINGDOC_SHOW_ACTUATOR = "springdoc.show-actuator"; - - /** - * The constant SPRINGDOC_SHOW_SPRING_CLOUD_FUNCTIONS. - */ - public static final String SPRINGDOC_SHOW_SPRING_CLOUD_FUNCTIONS = "springdoc.show-spring-cloud-functions"; - - /** - * The constant SPRINGDOC_ACTUATOR_TAG. - */ - public static final String SPRINGDOC_ACTUATOR_TAG = "Actuator"; - - /** - * The constant SPRINGDOC_ACTUATOR_DESCRIPTION. - */ - public static final String SPRINGDOC_ACTUATOR_DESCRIPTION = "Monitor and interact"; - - /** - * The constant SPRINGDOC_ACTUATOR_DOC_URL. - */ - public static final String SPRINGDOC_ACTUATOR_DOC_URL = "https://docs.spring.io/spring-boot/docs/current/actuator-api/html/"; - - /** - * The constant SPRINGDOC_ACTUATOR_DOC_DESCRIPTION. - */ - public static final String SPRINGDOC_ACTUATOR_DOC_DESCRIPTION = "Spring Boot Actuator Web API Documentation"; - - /** - * The constant DEFAULT_WEB_JARS_PREFIX_URL. - */ - public static final String DEFAULT_WEB_JARS_PREFIX_URL = "/webjars"; - - /** - * The constant CLASSPATH_RESOURCE_LOCATION. - */ - public static final String CLASSPATH_RESOURCE_LOCATION = ResourceUtils.CLASSPATH_URL_PREFIX + "/META-INF/resources"; - - - /** - * The constant SWAGGER_UI_PREFIX. - */ - public static final String SWAGGER_UI_PREFIX = "/swagger-ui"; - - /** - * The constant INDEX_PAGE. - */ - public static final String INDEX_PAGE = "/index.html"; - - /** - * The constant SWAGGER_UI_URL. - */ - public static final String SWAGGER_UI_URL = SWAGGER_UI_PREFIX + INDEX_PAGE; - - /** - * The constant SWAGGER_INITIALIZER_JS. - */ - public static final String SWAGGER_INITIALIZER_JS = "swagger-initializer.js"; - - /** - * The constant SWAGGER_INITIALIZER_URL. - */ - public static final String SWAGGER_INITIALIZER_URL = SWAGGER_UI_PREFIX + "/" + SWAGGER_INITIALIZER_JS; - - /** - * the constant OAUTH_REDIRECT_PAGE. - */ - public static final String OAUTH_REDIRECT_PAGE = "/oauth2-redirect.html"; - - /** - * The constant SWAGGER_UI_OAUTH_REDIRECT_URL. - */ - public static final String SWAGGER_UI_OAUTH_REDIRECT_URL = SWAGGER_UI_PREFIX + OAUTH_REDIRECT_PAGE; - - /** - * The constant APPLICATION_OPENAPI_YAML. - */ - public static final String APPLICATION_OPENAPI_YAML = "application/vnd.oai.openapi"; - - /** - * The constant DEFAULT_MYBATIS_GENERATOR_UI_PATH. - */ - public static final String DEFAULT_MYBATIS_GENERATOR_UI_PATH = DEFAULT_PATH_SEPARATOR + "index.html"; - - /** - * The constant SWAGGER_UI_PATH. - */ - public static final String MYBATIS_GENERATOR_UI_PATH = "${springdoc.swagger-ui.path:#{T(com.github.davidfantasy.mybatisplus.generatorui.common.core.utils.Constants).DEFAULT_MYBATIS_GENERATOR_UI_PATH}}"; - - /** - * The constant DEFAULT_GROUP_NAME. - */ - public static final String DEFAULT_GROUP_NAME = "springdocDefault"; - - /** - * The constant GROUP_CONFIG_FIRST_PROPERTY. - */ - public static final String GROUP_CONFIG_FIRST_PROPERTY = "springdoc.group-configs[0].group"; - - /** - * The constant GROUP_NAME_NOT_NULL. - */ - public static final String GROUP_NAME_NOT_NULL_OR_EMPTY = "Group name can not be null or empty"; - - /** - * The constant GET_METHOD. - */ - public static final String GET_METHOD = "get"; - - /** - * The constant POST_METHOD. - */ - public static final String POST_METHOD = "post"; - - /** - * The constant PUT_METHOD. - */ - public static final String PUT_METHOD = "put"; - - /** - * The constant DELETE_METHOD. - */ - public static final String DELETE_METHOD = "delete"; - - /** - * The constant PATCH_METHOD. - */ - public static final String PATCH_METHOD = "patch"; - - /** - * The constant TRACE_METHOD. - */ - public static final String TRACE_METHOD = "trace"; - - /** - * The constant HEAD_METHOD. - */ - public static final String HEAD_METHOD = "head"; - - /** - * The constant OPTIONS_METHOD. - */ - public static final String OPTIONS_METHOD = "options"; - - /** - * The constant QUERY_PARAM. - */ - public static final String QUERY_PARAM = "query"; - - /** - * The constant DEFAULT_DESCRIPTION. - */ - public static final String DEFAULT_DESCRIPTION = "default response"; - - /** - * The constant DEFAULT_TITLE. - */ - public static final String DEFAULT_TITLE = "OpenAPI definition"; - - /** - * The constant DEFAULT_VERSION. - */ - public static final String DEFAULT_VERSION = "v0"; - - /** - * The constant OPENAPI_STRING_TYPE. - */ - public static final String OPENAPI_STRING_TYPE = "string"; - - /** - * The constant OPENAPI_ARRAY_TYPE. - */ - public static final String OPENAPI_ARRAY_TYPE = "array"; - - /** - * The constant GRACEFUL_EXCEPTION_OCCURRED. - */ - public static final String GRACEFUL_EXCEPTION_OCCURRED = "Graceful exception occurred"; - - /** - * The constant SWAGGER_UI_DEFAULT_URL. - */ - public static final String SWAGGER_UI_DEFAULT_URL = "https://petstore.swagger.io/v2/swagger.json"; - - /** - * The constant CSRF_DEFAULT_COOKIE_NAME. - */ - public static final String CSRF_DEFAULT_COOKIE_NAME = "XSRF-TOKEN"; - - /** - * The constant CSRF_DEFAULT_LOCAL_STORAGE_KEY - */ - public static final String CSRF_DEFAULT_LOCAL_STORAGE_KEY = "XSRF-TOKEN"; - - /** - * The constant CSRF_DEFAULT_HEADER_NAME. - */ - public static final String CSRF_DEFAULT_HEADER_NAME = "X-XSRF-TOKEN"; - - /** - * The constant OPERATION_ATTRIBUTE. - */ - public static final String OPERATION_ATTRIBUTE = Constants.class.getName() + ".operation"; - - /** - * The constant MANAGEMENT_ENDPOINTS_WEB. - */ - public static final String MANAGEMENT_ENDPOINTS_WEB = "management.endpoints.web"; - - /** - * The constant ALL_PATTERN. - */ - public static final String ALL_PATTERN = "/**"; - - /** - * The constant HEALTH_PATTERN. - */ - public static final String HEALTH_PATTERN = "/health/*"; - - /** - * The constant SPRINGDOC_USE_MANAGEMENT_PORT. - */ - public static final String SPRINGDOC_USE_MANAGEMENT_PORT = "springdoc.use-management-port"; - - - /** - * The constant SPRINGDOC_ENABLE_DEFAULT_API_DOCS. - */ - public static final String SPRINGDOC_ENABLE_DEFAULT_API_DOCS = "springdoc.enable-default-api-docs"; - - /** - * The constant SPRINGDOC_USE_ROOT_PATH. - */ - public static final String SPRINGDOC_USE_ROOT_PATH = "springdoc.swagger-ui.use-root-path"; - - /** - * The constant DEFAULT_SWAGGER_UI_ACTUATOR_PATH. - */ - public static final String DEFAULT_SWAGGER_UI_ACTUATOR_PATH = "swagger-ui"; - - /** - * The constant DEFAULT_API_DOCS_ACTUATOR_URL. - */ - public static final String DEFAULT_API_DOCS_ACTUATOR_URL = "openapi"; - - /** - * The constant DEFAULT_YAML_API_DOCS_ACTUATOR_PATH. - */ - public static final String DEFAULT_YAML_API_DOCS_ACTUATOR_PATH = DEFAULT_PATH_SEPARATOR + YAML; - - /** - * The constant ACTUATOR_DEFAULT_GROUP. - */ - public static final String ACTUATOR_DEFAULT_GROUP = "x-actuator"; - - /** - * The constant LINKS_SCHEMA_CUSTOMISER. - */ - public static final String LINKS_SCHEMA_CUSTOMISER = "linksSchemaCustomizer"; - - /** - * The constant SPRINGDOC_SORT_CONVERTER_ENABLED. - */ - public static final String SPRINGDOC_SORT_CONVERTER_ENABLED = "springdoc.sort-converter.enabled"; - - /** - * The constant SPRINGDOC_NULLABLE_REQUEST_PARAMETER_ENABLED. - */ - public static final String SPRINGDOC_NULLABLE_REQUEST_PARAMETER_ENABLED = "springdoc.nullable-request-parameter-enabled"; - /** - * Instantiates a new Constants. - */ - private Constants() { - super(); - } - -} diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/JsonUtil.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/JsonUtil.java deleted file mode 100644 index d574595..0000000 --- a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/JsonUtil.java +++ /dev/null @@ -1,64 +0,0 @@ -package com.github.davidfantasy.mybatisplus.generatorui.common.core.utils; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.fasterxml.jackson.core.type.TypeReference; -import com.fasterxml.jackson.databind.JsonNode; -import com.fasterxml.jackson.databind.ObjectMapper; -import com.google.common.base.Strings; - -import java.io.IOException; - -public class JsonUtil { - - private static ObjectMapper mapper = new ObjectMapper(); - - public static String obj2json(Object obj) { - try { - return mapper.writeValueAsString(obj); - } catch (JsonProcessingException e) { - throw new IllegalArgumentException("将对象转换为JSON时发生错误!", e); - } - } - - public static T json2obj(String jsonStr, Class clazz) { - try { - return mapper.readValue(jsonStr, clazz); - } catch (IOException e) { - throw new IllegalArgumentException("将JSON转换为对象时发生错误:" + jsonStr, e); - } - } - - public static T json2obj(String jsonStr, TypeReference clazzType) { - try { - return mapper.readValue(jsonStr, clazzType); - } catch (IOException e) { - throw new IllegalArgumentException("将JSON转换为对象时发生错误:" + jsonStr, e); - } - } - - public static T json2obj(String content, String path, Class clazz) throws IOException { - if (!Strings.isNullOrEmpty(path)) { - JsonNode node = mapper.readTree(content); - String[] pathes = path.split("\\."); - for (String p : pathes) { - node = node.get(p); - } - content = node.toString(); - } - return json2obj(content, clazz); - } - - public static T json2obj(String content, String path, TypeReference clazzType) throws IOException { - if (!Strings.isNullOrEmpty(path)) { - JsonNode node = mapper.readTree(content); - String[] pathes = path.split("\\."); - for (String p : pathes) { - node = node.get(p); - } - content = node.toString(); - } - return json2obj(content, clazzType); - } - - -} diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/OSUtil.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/OSUtil.java deleted file mode 100644 index 43e82a7..0000000 --- a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/OSUtil.java +++ /dev/null @@ -1,24 +0,0 @@ -package com.github.davidfantasy.mybatisplus.generatorui.common.core.utils; - -public class OSUtil { - - private static final String OS = System.getProperty("os.name").toLowerCase(); - - public static boolean isLinux() { - return OS.contains("linux"); - } - - public static boolean isMacOS() { - return OS.contains("mac") && OS.contains("os") && OS.contains("x"); - } - - public static boolean isMacOSX() { - return OS.contains("mac") && OS.contains("os") && OS.contains("x"); - } - - public static boolean isWindows() { - return OS.contains("windows"); - } - - -} \ No newline at end of file diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/PathUtil.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/PathUtil.java deleted file mode 100644 index 75029cb..0000000 --- a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/PathUtil.java +++ /dev/null @@ -1,41 +0,0 @@ -package com.github.davidfantasy.mybatisplus.generatorui.common.core.utils; - -import com.google.common.base.Strings; - -import java.io.File; - -public class PathUtil { - - public static String joinPath(String... paths) { - StringBuilder tmp = new StringBuilder(); - for (String path : paths) { - if (!Strings.isNullOrEmpty(path)) { - tmp.append(path); - tmp.append(File.separator); - } - } - return tmp.deleteCharAt(tmp.lastIndexOf(File.separator)).toString(); - } - - public static String joinPackage(String... packages) { - StringBuilder tmp = new StringBuilder(); - for (String aPackage : packages) { - if (!Strings.isNullOrEmpty(aPackage)) { - tmp.append(aPackage); - tmp.append("."); - } - } - return tmp.deleteCharAt(tmp.lastIndexOf(".")).toString(); - } - - public static String getShortNameFromFullRef(String ref) { - if (Strings.isNullOrEmpty(ref)) { - return ""; - } - if (ref.indexOf(".") == -1) { - return ref; - } - return ref.substring(ref.lastIndexOf(".")+1, ref.length()); - } - -} diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/SpringDocUtils.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/SpringDocUtils.java deleted file mode 100644 index 6b03dad..0000000 --- a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/utils/SpringDocUtils.java +++ /dev/null @@ -1,58 +0,0 @@ -/* - * - * * - * * * - * * * * - * * * * * Copyright 2019-2022 the original author or authors. - * * * * * - * * * * * Licensed under the Apache License, Version 2.0 (the "License"); - * * * * * you may not use this file except in compliance with the License. - * * * * * You may obtain a copy of the License at - * * * * * - * * * * * https://www.apache.org/licenses/LICENSE-2.0 - * * * * * - * * * * * Unless required by applicable law or agreed to in writing, software - * * * * * distributed under the License is distributed on an "AS IS" BASIS, - * * * * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * * * * * See the License for the specific language governing permissions and - * * * * * limitations under the License. - * * * * - * * * - * * - * - */ - -package com.github.davidfantasy.mybatisplus.generatorui.common.core.utils; - - -import cn.hutool.core.util.StrUtil; - -/** - * The type Spring doc utils. - * - * @author bnasslahsen - */ -public class SpringDocUtils { - - /** - * The constant springDocConfig. - */ - private static final SpringDocUtils springDocConfig = new SpringDocUtils(); - - - /** - * Is valid path boolean. - * - * @param path the path - * @return the boolean - */ - public static boolean isValidPath(String path) { - if (StrUtil.isNotBlank(path) && !path.equals("/")) { - return true; - } - return false; - } - - -} - diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/util/Constants.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/util/Constants.java new file mode 100644 index 0000000..e93b8b2 --- /dev/null +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/util/Constants.java @@ -0,0 +1,81 @@ +package com.github.davidfantasy.mybatisplus.generatorui.common.util; + +import static org.springframework.util.AntPathMatcher.DEFAULT_PATH_SEPARATOR; + +/** + * The type Constants. + * + * @author bnasslahsen + */ +public final class Constants { + + /** + * The constant SPRINGDOC_PREFIX. + */ + public static final String MYBATISPLUS_GENETATORUI_PREFIX = "mybatisplus-genetatorui"; + + /** + * The constant DEFAULT_API_DOCS_URL. + * 不能删除,后面有用 + */ + public static final String DEFAULT_API_DOCS_URL = "/v3/api-docs"; + + /** + * The constant API_DOCS_URL. + */ + public static final String API_DOCS_URL = "${springdoc.api-docs.path:#{T(com.github.davidfantasy.mybatisplus.generatorui.common.util.Constants).DEFAULT_API_DOCS_URL}}"; + + /** + * The constant DOT. + */ + public static final String DOT = "."; + + /** + * The constant SPRINGDOC_ENABLED. + */ + public static final String MYBATISPLUS_GENETATORUI_ENABLED = MYBATISPLUS_GENETATORUI_PREFIX + ".enabled"; + + /** + * The constant NULL. + */ + public static final String NULL = ":#{null}"; + + /** + * The constant SPRING_MVC_SERVLET_PATH. + */ + public static final String SPRING_MVC_SERVLET_PATH = "spring.mvc.servlet.path"; + + /** + * The constant MVC_SERVLET_PATH. + */ + public static final String MVC_SERVLET_PATH = "${" + SPRING_MVC_SERVLET_PATH + NULL + "}"; + + /** + * The constant INDEX_PAGE. + */ + public static final String INDEX_PAGE = DEFAULT_PATH_SEPARATOR + "index.html"; + + /** + * The constant DEFAULT_MYBATIS_GENERATOR_UI_PATH. + * 不能删除,后面有用 + */ + public static final String DEFAULT_MYBATISPLUS_GENERATORUI_PATH = INDEX_PAGE; + + /** + * The constant SWAGGER_UI_PATH. + */ + public static final String MYBATISPLUS_GENERATORUI_PATH = "${springdoc.swagger-ui.path:#{T(com.github.davidfantasy.mybatisplus.generatorui.common.util.Constants).DEFAULT_MYBATISPLUS_GENERATORUI_PATH}}"; + + /** + * The constant SPRINGDOC_USE_ROOT_PATH. + */ + public static final String SPRINGDOC_USE_ROOT_PATH = "springdoc.swagger-ui.use-root-path"; + + /** + * Instantiates a new Constants. + */ + private Constants() { + super(); + } + +} diff --git a/mybatis-plus-generator-ui-starter-common/src/main/resources/META-INF/spring.factories b/mybatis-plus-generator-ui-starter-common/src/main/resources/META-INF/spring.factories index 8cc29e6..696305a 100644 --- a/mybatis-plus-generator-ui-starter-common/src/main/resources/META-INF/spring.factories +++ b/mybatis-plus-generator-ui-starter-common/src/main/resources/META-INF/spring.factories @@ -1,3 +1,2 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -com.github.davidfantasy.mybatisplus.generatorui.common.core.configuration.SpringDocConfiguration,\ -com.github.davidfantasy.mybatisplus.generatorui.common.core.properties.SpringDocConfigProperties \ No newline at end of file +com.github.davidfantasy.mybatisplus.generatorui.common.core.configuration.MybatisplusGeneratoruiAutoConfiguration \ No newline at end of file diff --git a/mybatis-plus-generator-ui-starter-common/src/test/resources/application-test.properties b/mybatis-plus-generator-ui-starter-common/src/test/resources/application-test.properties deleted file mode 100644 index 73334b5..0000000 --- a/mybatis-plus-generator-ui-starter-common/src/test/resources/application-test.properties +++ /dev/null @@ -1,4 +0,0 @@ -spring.main.banner-mode=off -logging.level.root=off -logging.pattern.console=%m%n -spring.main.lazy-initialization=true \ No newline at end of file diff --git a/mybatis-plus-generator-ui-starter-webmvc-api/pom.xml b/mybatis-plus-generator-ui-starter-webmvc-api/pom.xml index 16f4d2d..bcffd73 100644 --- a/mybatis-plus-generator-ui-starter-webmvc-api/pom.xml +++ b/mybatis-plus-generator-ui-starter-webmvc-api/pom.xml @@ -7,6 +7,9 @@ 2.0.5 mybatis-plus-generator-ui-starter-webmvc-api + + 这一层留给用户按照API自己开发接口 + diff --git a/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api/MultipleOpenApiActuatorResource.java b/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api/MultipleOpenApiActuatorResource.java deleted file mode 100644 index bf52dba..0000000 --- a/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api/MultipleOpenApiActuatorResource.java +++ /dev/null @@ -1,27 +0,0 @@ -package com.github.davidfantasy.mybatisplus.generatorui.webmvc.api.api; - -import com.fasterxml.jackson.core.JsonProcessingException; -import com.github.davidfantasy.mybatisplus.generatorui.common.api.Result; -import com.github.davidfantasy.mybatisplus.generatorui.common.api.ResultGenerator; -import org.springframework.boot.actuate.endpoint.web.annotation.RestControllerEndpoint; -import org.springframework.http.MediaType; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PathVariable; - -import static com.github.davidfantasy.mybatisplus.generatorui.common.core.utils.Constants.DEFAULT_API_DOCS_ACTUATOR_URL; - -/** - * The type Multiple open api actuator resource. - * - * @author bnasslashen - */ -@RestControllerEndpoint(id = DEFAULT_API_DOCS_ACTUATOR_URL) -public class MultipleOpenApiActuatorResource { - - @GetMapping(value = "/{group}", produces = MediaType.APPLICATION_JSON_VALUE) - public Result openapiJson(@PathVariable String group) - throws JsonProcessingException { - return ResultGenerator.genSuccessResult("你好," + group); - } - -} diff --git a/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api/OpenApiWebMvcResource.java b/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api/OpenApiWebMvcResource.java index 5e1868b..7aaef52 100644 --- a/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api/OpenApiWebMvcResource.java +++ b/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api/OpenApiWebMvcResource.java @@ -7,7 +7,7 @@ import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RestController; -import static com.github.davidfantasy.mybatisplus.generatorui.common.core.utils.Constants.API_DOCS_URL; +import static com.github.davidfantasy.mybatisplus.generatorui.common.util.Constants.API_DOCS_URL; /** * The type Open api resource. diff --git a/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/core/SpringDocWebMvcConfiguration.java b/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/core/SpringDocWebMvcConfiguration.java index 84aceef..df5a8e2 100644 --- a/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/core/SpringDocWebMvcConfiguration.java +++ b/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/core/SpringDocWebMvcConfiguration.java @@ -1,14 +1,13 @@ package com.github.davidfantasy.mybatisplus.generatorui.webmvc.api.core; -import com.github.davidfantasy.mybatisplus.generatorui.common.core.configuration.SpringDocConfiguration; -import com.github.davidfantasy.mybatisplus.generatorui.common.core.providers.SpringWebProvider; +import com.github.davidfantasy.mybatisplus.generatorui.common.core.configuration.MybatisplusGeneratoruiAutoConfiguration; import org.springframework.boot.autoconfigure.condition.*; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Lazy; import org.springframework.web.servlet.function.RouterFunction; -import static com.github.davidfantasy.mybatisplus.generatorui.common.core.utils.Constants.SPRINGDOC_ENABLED; +import static com.github.davidfantasy.mybatisplus.generatorui.common.util.Constants.MYBATISPLUS_GENETATORUI_ENABLED; /** * The type Spring doc web mvc configuration. @@ -18,25 +17,13 @@ @Lazy(false) @Configuration(proxyBeanMethods = false) @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET) -@ConditionalOnProperty(name = SPRINGDOC_ENABLED, matchIfMissing = true) -@ConditionalOnBean(SpringDocConfiguration.class) +@ConditionalOnProperty(name = MYBATISPLUS_GENETATORUI_ENABLED, matchIfMissing = true) +@ConditionalOnBean(MybatisplusGeneratoruiAutoConfiguration.class) public class SpringDocWebMvcConfiguration { static { } - /** - * Spring web provider spring web provider. - * - * @return the spring web provider - */ - @Bean - @ConditionalOnMissingBean - @Lazy(false) - SpringWebProvider springWebProvider() { - return new SpringWebMvcProvider(); - } - /** * The type Spring doc web mvc router configuration. * diff --git a/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/core/SpringWebMvcProvider.java b/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/core/SpringWebMvcProvider.java deleted file mode 100644 index 2202478..0000000 --- a/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/core/SpringWebMvcProvider.java +++ /dev/null @@ -1,112 +0,0 @@ -/* - * - * * - * * * - * * * * Copyright 2019-2022 the original author or authors. - * * * * - * * * * Licensed under the Apache License, Version 2.0 (the "License"); - * * * * you may not use this file except in compliance with the License. - * * * * You may obtain a copy of the License at - * * * * - * * * * https://www.apache.org/licenses/LICENSE-2.0 - * * * * - * * * * Unless required by applicable law or agreed to in writing, software - * * * * distributed under the License is distributed on an "AS IS" BASIS, - * * * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * * * * See the License for the specific language governing permissions and - * * * * limitations under the License. - * * * - * * - * - */ -package com.github.davidfantasy.mybatisplus.generatorui.webmvc.api.core; - -import cn.hutool.core.util.StrUtil; -import com.github.davidfantasy.mybatisplus.generatorui.common.core.properties.SpringDocConfigProperties; -import com.github.davidfantasy.mybatisplus.generatorui.common.core.providers.SpringWebProvider; -import org.springframework.util.CollectionUtils; -import org.springframework.web.method.HandlerMethod; -import org.springframework.web.servlet.handler.AbstractHandlerMethodMapping; -import org.springframework.web.servlet.mvc.condition.PathPatternsRequestCondition; -import org.springframework.web.servlet.mvc.condition.PatternsRequestCondition; -import org.springframework.web.servlet.mvc.method.RequestMappingInfo; -import org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerMapping; - -import java.util.Collection; -import java.util.LinkedHashMap; -import java.util.Map; -import java.util.Map.Entry; -import java.util.Set; -import java.util.stream.Collectors; - -/** - * The type Spring web mvc provider. - * - * @author bnasslahsen - */ -public class SpringWebMvcProvider extends SpringWebProvider { - - /** - * Finds path prefix. - * - * @param springDocConfigProperties the spring doc config properties - * @return the path prefix - */ - @Override - public String findPathPrefix(SpringDocConfigProperties springDocConfigProperties) { - Map map = getHandlerMethods(); - for (Entry entry : map.entrySet()) { - RequestMappingInfo requestMappingInfo = entry.getKey(); - Set patterns = getActivePatterns(requestMappingInfo); - if (!CollectionUtils.isEmpty(patterns)) { - for (String operationPath : patterns) { - if (operationPath.endsWith(springDocConfigProperties.getApiDocs().getPath())) { - return operationPath.replace(springDocConfigProperties.getApiDocs().getPath(), StrUtil.EMPTY); - } - } - } - } - return StrUtil.EMPTY; - } - - /** - * Gets active patterns. - * - * @param requestMapping the request mapping info - * @return the active patterns - */ - @Override - public Set getActivePatterns(Object requestMapping) { - Set patterns = null; - RequestMappingInfo requestMappingInfo = (RequestMappingInfo) requestMapping; - PatternsRequestCondition patternsRequestCondition = requestMappingInfo.getPatternsCondition(); - if (patternsRequestCondition != null) { - patterns = patternsRequestCondition.getPatterns(); - } else { - PathPatternsRequestCondition pathPatternsRequestCondition = requestMappingInfo.getPathPatternsCondition(); - if (pathPatternsRequestCondition != null) { - patterns = pathPatternsRequestCondition.getPatternValues(); - } - } - return patterns; - } - - - /** - * Gets handler methods. - * - * @return the handler methods - */ - @Override - public Map getHandlerMethods() { - if (this.handlerMethods == null) { - Map beansOfTypeRequestMappingHandlerMapping = applicationContext.getBeansOfType(RequestMappingHandlerMapping.class); - this.handlerMethods = beansOfTypeRequestMappingHandlerMapping.values().stream() - .map(AbstractHandlerMethodMapping::getHandlerMethods) - .map(Map::entrySet) - .flatMap(Collection::stream) - .collect(Collectors.toMap(Entry::getKey, Entry::getValue, (a1, a2) -> a1, LinkedHashMap::new)); - } - return this.handlerMethods; - } -} diff --git a/mybatis-plus-generator-ui-starter-webmvc-ui/pom.xml b/mybatis-plus-generator-ui-starter-webmvc-ui/pom.xml index 92b7dfe..0942bb1 100644 --- a/mybatis-plus-generator-ui-starter-webmvc-ui/pom.xml +++ b/mybatis-plus-generator-ui-starter-webmvc-ui/pom.xml @@ -6,6 +6,9 @@ 2.0.5 mybatis-plus-generator-ui-starter-webmvc-ui + + 将UI分离出来,方便用户自己开发相对应的界面 + diff --git a/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/ui/SwaggerConfig.java b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/ui/SwaggerConfig.java deleted file mode 100644 index 8e34d74..0000000 --- a/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/ui/SwaggerConfig.java +++ /dev/null @@ -1,55 +0,0 @@ -package com.github.davidfantasy.mybatisplus.generatorui.webmvc.ui; - -import com.github.davidfantasy.mybatisplus.generatorui.common.core.configuration.SpringDocConfiguration; -import com.github.davidfantasy.mybatisplus.generatorui.common.core.providers.SpringWebProvider; -import com.github.davidfantasy.mybatisplus.generatorui.webmvc.api.core.SpringWebMvcProvider; -import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; -import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; -import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; -import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; -import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication.Type; -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import org.springframework.context.annotation.Lazy; - -import static com.github.davidfantasy.mybatisplus.generatorui.common.core.utils.Constants.SPRINGDOC_SWAGGER_UI_ENABLED; -import static com.github.davidfantasy.mybatisplus.generatorui.common.core.utils.Constants.SPRINGDOC_USE_ROOT_PATH; - - -/** - * The type Swagger config. - * - * @author bnasslahsen - */ -@Lazy(false) -@Configuration(proxyBeanMethods = false) -@ConditionalOnProperty(name = SPRINGDOC_SWAGGER_UI_ENABLED, matchIfMissing = true) -@ConditionalOnWebApplication(type = Type.SERVLET) -@ConditionalOnBean(SpringDocConfiguration.class) -public class SwaggerConfig { - - /** - * Spring web provider spring web provider. - * - * @return the spring web provider - */ - @Bean - @ConditionalOnMissingBean - @Lazy(false) - SpringWebProvider springWebProvider() { - return new SpringWebMvcProvider(); - } - - /** - * Swagger ui home swagger ui home. - * - * @return the swagger ui home - */ - @Bean - @ConditionalOnMissingBean - @ConditionalOnProperty(name = SPRINGDOC_USE_ROOT_PATH, havingValue = "true") - @Lazy(false) - UiHome swaggerUiHome() { - return new UiHome(); - } -} diff --git a/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/ui/UiHome.java b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/ui/UiHome.java index 060d027..8141b63 100644 --- a/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/ui/UiHome.java +++ b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/ui/UiHome.java @@ -25,13 +25,13 @@ package com.github.davidfantasy.mybatisplus.generatorui.webmvc.ui; -import com.github.davidfantasy.mybatisplus.generatorui.common.core.utils.SpringDocUtils; +import com.baomidou.mybatisplus.core.toolkit.StringUtils; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; -import static com.github.davidfantasy.mybatisplus.generatorui.common.core.utils.Constants.MVC_SERVLET_PATH; -import static com.github.davidfantasy.mybatisplus.generatorui.common.core.utils.Constants.MYBATIS_GENERATOR_UI_PATH; +import static com.github.davidfantasy.mybatisplus.generatorui.common.util.Constants.MVC_SERVLET_PATH; +import static com.github.davidfantasy.mybatisplus.generatorui.common.util.Constants.MYBATISPLUS_GENERATORUI_PATH; import static org.springframework.util.AntPathMatcher.DEFAULT_PATH_SEPARATOR; import static org.springframework.web.servlet.view.UrlBasedViewResolver.FORWARD_URL_PREFIX; @@ -41,12 +41,22 @@ @Controller public class UiHome { - @Value(MYBATIS_GENERATOR_UI_PATH) + @Value(MYBATISPLUS_GENERATORUI_PATH) private String mybatisGeneratorUiPath; @Value(MVC_SERVLET_PATH) private String mvcServletPath; + /** + * Is valid path boolean. + * + * @param path the path + * @return the boolean + */ + public static boolean isValidPath(String path) { + return StringUtils.isNotBlank(path) && !path.equals("/"); + } + /** * Index string. * @@ -55,9 +65,9 @@ public class UiHome { @GetMapping(DEFAULT_PATH_SEPARATOR) public String index() { StringBuilder uiRootPath = new StringBuilder(); - if (SpringDocUtils.isValidPath(mvcServletPath)) { - uiRootPath.append(mvcServletPath); - } + if (isValidPath(mvcServletPath)) { + uiRootPath.append(mvcServletPath); + } return FORWARD_URL_PREFIX + uiRootPath + mybatisGeneratorUiPath; } diff --git a/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/ui/WebConfigurer.java b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/ui/WebConfigurer.java index 28a0c46..8c20ec8 100644 --- a/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/ui/WebConfigurer.java +++ b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/ui/WebConfigurer.java @@ -1,18 +1,29 @@ package com.github.davidfantasy.mybatisplus.generatorui.webmvc.ui; +import com.github.davidfantasy.mybatisplus.generatorui.common.core.configuration.MybatisplusGeneratoruiAutoConfiguration; +import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.boot.web.server.ErrorPage; import org.springframework.boot.web.server.ErrorPageRegistrar; import org.springframework.boot.web.server.ErrorPageRegistry; import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Lazy; import org.springframework.http.HttpStatus; import org.springframework.web.servlet.config.annotation.ViewControllerRegistry; import org.springframework.web.servlet.config.annotation.WebMvcConfigurer; +import static com.github.davidfantasy.mybatisplus.generatorui.common.util.Constants.SPRINGDOC_USE_ROOT_PATH; + /** * Spring MVC 配置 */ -@Configuration +@Lazy(false) +@Configuration(proxyBeanMethods = false) +@ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET) +@ConditionalOnBean(MybatisplusGeneratoruiAutoConfiguration.class) public class WebConfigurer implements WebMvcConfigurer { @Override @@ -26,6 +37,18 @@ public ErrorPageRegistrar errorPageRegistrar() { return new MyErrorPageRegistrar(); } + /** + * Swagger ui home swagger ui home. + * + * @return the swagger ui home + */ + @Bean + @ConditionalOnMissingBean + @ConditionalOnProperty(name = SPRINGDOC_USE_ROOT_PATH, havingValue = "true") + @Lazy(false) + UiHome swaggerUiHome() { + return new UiHome(); + } private static class MyErrorPageRegistrar implements ErrorPageRegistrar { @Override @@ -33,6 +56,4 @@ public void registerErrorPages(ErrorPageRegistry registry) { registry.addErrorPages(new ErrorPage(HttpStatus.NOT_FOUND, "/index.html")); } } - - } diff --git a/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/META-INF/spring.factories b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/META-INF/spring.factories index 97eb537..202ef58 100644 --- a/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/META-INF/spring.factories +++ b/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/META-INF/spring.factories @@ -1,2 +1,2 @@ org.springframework.boot.autoconfigure.EnableAutoConfiguration=\ -com.github.davidfantasy.mybatisplus.generatorui.webmvc.ui.SwaggerConfig \ No newline at end of file +com.github.davidfantasy.mybatisplus.generatorui.webmvc.ui.WebConfigurer \ No newline at end of file diff --git a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/MybatisplusGeneratoruiConfiguration.java b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/MybatisplusGeneratoruiConfiguration.java new file mode 100644 index 0000000..ab39556 --- /dev/null +++ b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/MybatisplusGeneratoruiConfiguration.java @@ -0,0 +1,34 @@ +package com.github.davidfantasy.mybatisplus.generatorui; + +import com.github.davidfantasy.mybatisplus.generatorui.common.util.Constants; +import com.github.davidfantasy.mybatisplus.generatorui.common.mbp.NameConverter; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; +import org.springframework.context.annotation.Bean; +import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Lazy; + +@Lazy(false) +@Configuration(proxyBeanMethods = false) +@ConditionalOnProperty(name = Constants.MYBATISPLUS_GENETATORUI_ENABLED, matchIfMissing = true) +@ConditionalOnWebApplication +public class MybatisplusGeneratoruiConfiguration { + /** + * 注入一个方便替换名字的类 + * @return + */ + @Bean + public NameConverter nameConverter() { + return new NameConverter() { + @Override + public String serviceNameConvert(String entityName) { + return entityName + "Service1"; + } + + @Override + public String controllerNameConvert(String entityName) { + return entityName + "Action"; + } + }; + } +} diff --git a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/ServerApplication.java b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/ServerApplication.java index 4a7c952..799c7f4 100644 --- a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/ServerApplication.java +++ b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/ServerApplication.java @@ -1,7 +1,5 @@ package com.github.davidfantasy.mybatisplus.generatorui; -import com.github.davidfantasy.mybatisplus.generatorui.common.GeneratorConfig; -import com.github.davidfantasy.mybatisplus.generatorui.common.mbp.NameConverter; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; @@ -9,27 +7,7 @@ public class ServerApplication { public static void main(String[] args) { - GeneratorConfig config = GeneratorConfig.builder().jdbcUrl("jdbc:mysql://192.168.0.101:32888/test?allowMultiQueries=true&useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true&nullCatalogMeansCurrent=true&&allowPublicKeyRetrieval=true") - .userName("root") - .password("admin") - .port(18068) - .driverClassName("com.mysql.cj.jdbc.Driver") - .basePackage("com.github.davidfantasy.mybatisplus.generatorui.example") - //数据库表前缀,生成entity名称时会去掉 - .tablePrefix("t_") - .nameConverter(new NameConverter() { - @Override - public String serviceNameConvert(String entityName) { - return entityName + "Service"; - } - - @Override - public String controllerNameConvert(String entityName) { - return entityName + "Action"; - } - }) - .build(); - MybatisPlusToolsApplication.run(ServerApplication.class, args, config); + SpringApplication.run(ServerApplication.class, args); } } diff --git a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/main/resources/application.yaml b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/main/resources/application.yaml index b44ae75..67f89dc 100644 --- a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/main/resources/application.yaml +++ b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/main/resources/application.yaml @@ -12,6 +12,17 @@ spring: debug: false logging: level: - root: debug + root: info server: - port: 12454 \ No newline at end of file + port: 12454 + +mybatisplus-genetatorui: + port: 18068 + jdbc-url: jdbc:mysql://192.168.0.101:32888/test?allowMultiQueries=true&useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true&nullCatalogMeansCurrent=true&&allowPublicKeyRetrieval=true + user-name: root + password: admin + driverClassName: com.mysql.cj.jdbc.Driver + dateType: TIME_PACK + tablePrefix: t_ + idType: ASSIGN_ID + basePackeage: com.github.davidfantasy.mybatisplus.generatorui.example \ No newline at end of file diff --git a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/AbstractSpringDocTest.java b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/AbstractSpringDocTest.java deleted file mode 100644 index b5849c6..0000000 --- a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/AbstractSpringDocTest.java +++ /dev/null @@ -1,73 +0,0 @@ -package com.github.davidfantasy.mybatisplus.generatorui; - -import com.github.davidfantasy.mybatisplus.generatorui.common.GeneratorConfig; -import com.github.davidfantasy.mybatisplus.generatorui.common.core.utils.Constants; -import com.github.davidfantasy.mybatisplus.generatorui.common.mbp.NameConverter; -import org.junit.jupiter.api.Assertions; -import org.junit.jupiter.api.BeforeAll; -import org.junit.jupiter.api.Test; -import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.http.MediaType; -import org.springframework.test.web.servlet.MvcResult; -import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; - -import java.nio.charset.StandardCharsets; - -import static org.hamcrest.Matchers.is; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; -import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; - -@SpringBootTest(classes = TestApplication.class) -public abstract class AbstractSpringDocTest extends AbstractCommonTest { - - public static String className; - - /** - * 必须要这一段初始化代码, - * 不然jdbc不会配置, - * 启动不了测试 - */ - @BeforeAll - public static final void setUp() { - GeneratorConfig config = GeneratorConfig.builder().jdbcUrl("jdbc:mysql://192.168.0.101:32888/test?allowMultiQueries=true&useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true&nullCatalogMeansCurrent=true&&allowPublicKeyRetrieval=true") - .userName("root") - .password("admin") - .port(18068) - .driverClassName("com.mysql.cj.jdbc.Driver") - .basePackage("com.github.davidfantasy.mybatisplus.generatorui.example") - //数据库表前缀,生成entity名称时会去掉 - .tablePrefix("t_") - .nameConverter(new NameConverter() { - @Override - public String serviceNameConvert(String entityName) { - return entityName + "Service"; - } - - @Override - public String controllerNameConvert(String entityName) { - return entityName + "Action"; - } - }) - .build(); - MybatisPlusToolsApplication.run(TestApplication.class, new String[0], config); - } - - @Test - public void testApp() throws Exception { - className = getClass().getSimpleName(); - String testNumber = className.replaceAll("[^0-9]", ""); - MvcResult mockMvcResult = getMvcResult(); - String result = mockMvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8); - String expected = getContent("results/app" + testNumber + ".json"); - Assertions.assertEquals(expected, result); - } - - @Override - protected MvcResult getMvcResult() throws Exception { - return mockMvc.perform(MockMvcRequestBuilders.get(Constants.DEFAULT_API_DOCS_URL) - .contentType(MediaType.APPLICATION_JSON) //指定请求的contentType头信息 - .accept(MediaType.APPLICATION_JSON)) - .andExpect(status().isOk()) - .andExpect(jsonPath("$.code", is(200))).andReturn(); - } -} diff --git a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/app2/SpringDocApp2Test.java b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/app2/SpringDocApp2Test.java deleted file mode 100644 index 9d0b129..0000000 --- a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/app2/SpringDocApp2Test.java +++ /dev/null @@ -1,29 +0,0 @@ -/* - * - * * Copyright 2019-2020 the original author or authors. - * * - * * Licensed under the Apache License, Version 2.0 (the "License"); - * * you may not use this file except in compliance with the License. - * * You may obtain a copy of the License at - * * - * * https://www.apache.org/licenses/LICENSE-2.0 - * * - * * Unless required by applicable law or agreed to in writing, software - * * distributed under the License is distributed on an "AS IS" BASIS, - * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * * See the License for the specific language governing permissions and - * * limitations under the License. - * - */ - -package com.github.davidfantasy.mybatisplus.generatorui.app2; - -import com.github.davidfantasy.mybatisplus.generatorui.AbstractSpringDocTest; -import org.springframework.boot.autoconfigure.SpringBootApplication; - -/** - * 按照Spring Doc标准进行的单元测试 - */ -public class SpringDocApp2Test extends AbstractSpringDocTest { - -} \ No newline at end of file diff --git a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/AbstractCommonTest.java b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/test/com/github/davidfantasy/mybatisplus/generatorui/AbstractCommonTest.java similarity index 94% rename from mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/AbstractCommonTest.java rename to mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/test/com/github/davidfantasy/mybatisplus/generatorui/AbstractCommonTest.java index 1dad19c..9bba022 100644 --- a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/AbstractCommonTest.java +++ b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/test/com/github/davidfantasy/mybatisplus/generatorui/AbstractCommonTest.java @@ -1,4 +1,4 @@ -package com.github.davidfantasy.mybatisplus.generatorui; +package test.com.github.davidfantasy.mybatisplus.generatorui; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.autoconfigure.web.servlet.AutoConfigureMockMvc; diff --git a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/test/com/github/davidfantasy/mybatisplus/generatorui/AbstractSpringDocTest.java b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/test/com/github/davidfantasy/mybatisplus/generatorui/AbstractSpringDocTest.java new file mode 100644 index 0000000..505fbc5 --- /dev/null +++ b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/test/com/github/davidfantasy/mybatisplus/generatorui/AbstractSpringDocTest.java @@ -0,0 +1,40 @@ +package test.com.github.davidfantasy.mybatisplus.generatorui; + +import com.github.davidfantasy.mybatisplus.generatorui.common.util.Constants; +import org.junit.jupiter.api.Assertions; +import org.junit.jupiter.api.Test; +import org.springframework.boot.test.context.SpringBootTest; +import org.springframework.http.MediaType; +import org.springframework.test.web.servlet.MvcResult; +import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; + +import java.nio.charset.StandardCharsets; + +import static org.hamcrest.Matchers.is; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.jsonPath; +import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.status; + +@SpringBootTest(classes = TestApplication.class) +public abstract class AbstractSpringDocTest extends AbstractCommonTest { + + public static String className; + + @Test + public void testApp() throws Exception { + className = getClass().getSimpleName(); + String testNumber = className.replaceAll("[^0-9]", ""); + MvcResult mockMvcResult = getMvcResult(); + String result = mockMvcResult.getResponse().getContentAsString(StandardCharsets.UTF_8); + String expected = getContent("results/app" + testNumber + ".json"); + Assertions.assertEquals(expected, result); + } + + @Override + protected MvcResult getMvcResult() throws Exception { + return mockMvc.perform(MockMvcRequestBuilders.get(Constants.API_DOCS_URL) + .contentType(MediaType.APPLICATION_JSON) //指定请求的contentType头信息 + .accept(MediaType.APPLICATION_JSON)) + .andExpect(status().isOk()) + .andExpect(jsonPath("$.code", is(200))).andReturn(); + } +} diff --git a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/TestApplication.java b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/test/com/github/davidfantasy/mybatisplus/generatorui/TestApplication.java similarity index 68% rename from mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/TestApplication.java rename to mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/test/com/github/davidfantasy/mybatisplus/generatorui/TestApplication.java index 3c359ea..1375bae 100644 --- a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/TestApplication.java +++ b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/test/com/github/davidfantasy/mybatisplus/generatorui/TestApplication.java @@ -1,17 +1,20 @@ -package com.github.davidfantasy.mybatisplus.generatorui; +package test.com.github.davidfantasy.mybatisplus.generatorui; +import com.github.davidfantasy.mybatisplus.generatorui.common.MybatisPlusToolsApplication; import com.github.davidfantasy.mybatisplus.generatorui.common.GeneratorConfig; import com.github.davidfantasy.mybatisplus.generatorui.common.mbp.NameConverter; import org.springframework.boot.autoconfigure.SpringBootApplication; +import org.springframework.context.annotation.ComponentScan; @SpringBootApplication +@ComponentScan("com.github.davidfantasy.mybatisplus.generatorui") public class TestApplication { public static void main(String[] args) { - GeneratorConfig config = GeneratorConfig.builder().jdbcUrl("jdbc:mysql://localhost:3306/autoapi") + GeneratorConfig config = GeneratorConfig.builder().jdbcUrl("jdbc:mysql://192.168.0.101:32888/test?allowMultiQueries=true&useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true&nullCatalogMeansCurrent=true&&allowPublicKeyRetrieval=true") .userName("root") - .password("root") - .port(8068) + .password("admin") + .port(18068) .driverClassName("com.mysql.cj.jdbc.Driver") .basePackage("com.github.davidfantasy.mybatisplus.generatorui.example") //数据库表前缀,生成entity名称时会去掉 diff --git a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/TestSqlParser.java b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/test/com/github/davidfantasy/mybatisplus/generatorui/TestSqlParser.java similarity index 99% rename from mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/TestSqlParser.java rename to mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/test/com/github/davidfantasy/mybatisplus/generatorui/TestSqlParser.java index 1cad593..e0e3f00 100644 --- a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/TestSqlParser.java +++ b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/test/com/github/davidfantasy/mybatisplus/generatorui/TestSqlParser.java @@ -1,4 +1,4 @@ -package com.github.davidfantasy.mybatisplus.generatorui; +package test.com.github.davidfantasy.mybatisplus.generatorui; import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollectionUtil; diff --git a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/test/com/github/davidfantasy/mybatisplus/generatorui/app2/SpringDocApp2Test.java b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/test/com/github/davidfantasy/mybatisplus/generatorui/app2/SpringDocApp2Test.java new file mode 100644 index 0000000..3e89a3f --- /dev/null +++ b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/test/com/github/davidfantasy/mybatisplus/generatorui/app2/SpringDocApp2Test.java @@ -0,0 +1,10 @@ +package test.com.github.davidfantasy.mybatisplus.generatorui.app2; + +import test.com.github.davidfantasy.mybatisplus.generatorui.AbstractSpringDocTest; + +/** + * 按照Spring Doc标准进行的单元测试 + */ +public class SpringDocApp2Test extends AbstractSpringDocTest { + +} \ No newline at end of file diff --git a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/app3/SpringDocApp3Test.java b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/test/com/github/davidfantasy/mybatisplus/generatorui/app3/SpringDocApp3Test.java similarity index 91% rename from mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/app3/SpringDocApp3Test.java rename to mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/test/com/github/davidfantasy/mybatisplus/generatorui/app3/SpringDocApp3Test.java index 604981d..fbf8643 100644 --- a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/com/github/davidfantasy/mybatisplus/generatorui/app3/SpringDocApp3Test.java +++ b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/test/com/github/davidfantasy/mybatisplus/generatorui/app3/SpringDocApp3Test.java @@ -16,9 +16,9 @@ * */ -package com.github.davidfantasy.mybatisplus.generatorui.app3; +package test.com.github.davidfantasy.mybatisplus.generatorui.app3; -import com.github.davidfantasy.mybatisplus.generatorui.AbstractSpringDocTest; +import test.com.github.davidfantasy.mybatisplus.generatorui.AbstractSpringDocTest; import org.springframework.http.MediaType; import org.springframework.test.web.servlet.MvcResult; import org.springframework.test.web.servlet.request.MockMvcRequestBuilders; diff --git a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/resources/application-test.properties b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/resources/application-test.properties deleted file mode 100644 index c7338ab..0000000 --- a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/resources/application-test.properties +++ /dev/null @@ -1,5 +0,0 @@ -spring.main.banner-mode=off -logging.level.root=debug -debug=true -logging.pattern.console=%m%n -spring.main.lazy-initialization=true \ No newline at end of file diff --git a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/resources/application-test.yml b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/resources/application-test.yml new file mode 100644 index 0000000..30dae40 --- /dev/null +++ b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/resources/application-test.yml @@ -0,0 +1,21 @@ +debug: true +logging: + level: + root: debug + pattern: + console: '%m%n' +spring: + main: + banner-mode: 'off' + lazy-initialization: true + +mybatisplus-genetatorui: + port: 18068 + jdbc-url: jdbc:mysql://192.168.0.101:32888/test?allowMultiQueries=true&useUnicode=true&useSSL=false&characterEncoding=UTF-8&serverTimezone=Asia/Shanghai&autoReconnect=true&nullCatalogMeansCurrent=true&&allowPublicKeyRetrieval=true + user-name: root + password: admin + driverClassName: com.mysql.cj.jdbc.Driver + dateType: TIME_PACK + tablePrefix: t_ + idType: ASSIGN_ID + basePackeage: com.github.davidfantasy.mybatisplus.generatorui.example From 6fac4f8507cef5a69707a91b77d9358536e82e75 Mon Sep 17 00:00:00 2001 From: klaokai <573984425@qq.com> Date: Wed, 11 Sep 2024 15:11:48 +0800 Subject: [PATCH 09/11] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E8=BE=93=E5=87=BA=E4=B8=BA=E7=A9=BA=E6=96=87=E6=9C=AC?= =?UTF-8?q?=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pom.xml | 22 +++++++- .../common/MybatisPlusToolsApplication.java | 25 +-------- .../configuration}/ApplicationConfigure.java | 4 +- ...batisplusGeneratoruiAutoConfiguration.java | 3 +- .../properties}/GeneratorConfig.java | 4 +- .../properties/SpringDocConfigProperties.java | 2 +- .../generatorui/common/mbp/MbpGenerator.java | 42 ++++++++------- .../common/service/SqlGeneratorService.java | 2 +- .../common/service/UserConfigStore.java | 2 +- .../resources/codetpls/controller.java.btl | 0 .../src/main/resources/codetpls/dto.btl | 0 .../main/resources/codetpls/entity.java.btl | 0 .../main/resources/codetpls/mapper.java.btl | 0 .../main/resources/codetpls/mapper.xml.btl | 0 .../main/resources/codetpls/mapperMethods.btl | 0 .../src/main/resources/codetpls/resultMap.btl | 0 .../main/resources/codetpls/service.java.btl | 0 .../resources/codetpls/serviceImpl.java.btl | 0 .../api/api/SqlGeneratorController.java | 3 +- .../generatorui/ControllerPrinter.java | 51 ------------------- .../src/main/resources/application.yaml | 2 +- .../generatorui/TestApplication.java | 2 +- pom.xml | 4 -- 23 files changed, 58 insertions(+), 110 deletions(-) rename mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/{ => core/configuration}/ApplicationConfigure.java (93%) rename mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/{ => core/properties}/GeneratorConfig.java (94%) rename {mybatis-plus-generator-ui-starter-webmvc-ui => mybatis-plus-generator-ui-starter-common}/src/main/resources/codetpls/controller.java.btl (100%) rename {mybatis-plus-generator-ui-starter-webmvc-ui => mybatis-plus-generator-ui-starter-common}/src/main/resources/codetpls/dto.btl (100%) rename {mybatis-plus-generator-ui-starter-webmvc-ui => mybatis-plus-generator-ui-starter-common}/src/main/resources/codetpls/entity.java.btl (100%) rename {mybatis-plus-generator-ui-starter-webmvc-ui => mybatis-plus-generator-ui-starter-common}/src/main/resources/codetpls/mapper.java.btl (100%) rename {mybatis-plus-generator-ui-starter-webmvc-ui => mybatis-plus-generator-ui-starter-common}/src/main/resources/codetpls/mapper.xml.btl (100%) rename {mybatis-plus-generator-ui-starter-webmvc-ui => mybatis-plus-generator-ui-starter-common}/src/main/resources/codetpls/mapperMethods.btl (100%) rename {mybatis-plus-generator-ui-starter-webmvc-ui => mybatis-plus-generator-ui-starter-common}/src/main/resources/codetpls/resultMap.btl (100%) rename {mybatis-plus-generator-ui-starter-webmvc-ui => mybatis-plus-generator-ui-starter-common}/src/main/resources/codetpls/service.java.btl (100%) rename {mybatis-plus-generator-ui-starter-webmvc-ui => mybatis-plus-generator-ui-starter-common}/src/main/resources/codetpls/serviceImpl.java.btl (100%) delete mode 100644 mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/ControllerPrinter.java diff --git a/mybatis-plus-generator-ui-starter-common/pom.xml b/mybatis-plus-generator-ui-starter-common/pom.xml index 855edcb..3eefa91 100644 --- a/mybatis-plus-generator-ui-starter-common/pom.xml +++ b/mybatis-plus-generator-ui-starter-common/pom.xml @@ -1,5 +1,5 @@ - com.github.davidfantasy @@ -81,5 +81,25 @@ javaparser-symbol-solver-core 3.26.1 + + com.fasterxml.jackson.core + jackson-core + provided + + + com.fasterxml.jackson.core + jackson-databind + provided + + + com.fasterxml.jackson.core + jackson-annotations + provided + + + org.springframework.boot + spring-boot-starter-web + provided + diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/MybatisPlusToolsApplication.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/MybatisPlusToolsApplication.java index 00df29f..d993acb 100644 --- a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/MybatisPlusToolsApplication.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/MybatisPlusToolsApplication.java @@ -1,5 +1,6 @@ package com.github.davidfantasy.mybatisplus.generatorui.common; +import com.github.davidfantasy.mybatisplus.generatorui.common.core.properties.GeneratorConfig; import com.google.common.base.Strings; import com.google.common.collect.Maps; import lombok.extern.slf4j.Slf4j; @@ -8,12 +9,8 @@ import org.springframework.boot.autoconfigure.web.servlet.*; import org.springframework.boot.autoconfigure.web.servlet.error.ErrorMvcAutoConfiguration; import org.springframework.boot.builder.SpringApplicationBuilder; -import org.springframework.boot.web.server.WebServerFactoryCustomizer; -import org.springframework.boot.web.servlet.server.ConfigurableServletWebServerFactory; import org.springframework.context.ConfigurableApplicationContext; -import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.ComponentScan; -import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Import; import java.util.Map; @@ -36,14 +33,10 @@ @Slf4j public class MybatisPlusToolsApplication { - private static GeneratorConfig generatorConfig; - public static void run(Class clazz, String[] args, GeneratorConfig generatorConfig) { if (Strings.isNullOrEmpty(generatorConfig.getJdbcUrl())) { throw new IllegalArgumentException("jdbcUrl必须要设置"); } - //本项目的综合配置 - MybatisPlusToolsApplication.generatorConfig = generatorConfig; //启动MyBatis Map props = Maps.newHashMap(); @@ -57,21 +50,5 @@ public static void run(Class clazz, String[] args, GeneratorConfig generatorC .run(args); } - -/* @Configuration - public static class MainConfigutration { - - - *//** - * 注入项目配置 - * - * @return 项目配置的对象 - *//* - @Bean - public GeneratorConfig generatorConfig() { - return MybatisPlusToolsApplication.generatorConfig; - } - - }*/ } diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/ApplicationConfigure.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/ApplicationConfigure.java similarity index 93% rename from mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/ApplicationConfigure.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/ApplicationConfigure.java index ed7fb0c..d243e66 100644 --- a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/ApplicationConfigure.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/ApplicationConfigure.java @@ -1,7 +1,9 @@ -package com.github.davidfantasy.mybatisplus.generatorui.common; +package com.github.davidfantasy.mybatisplus.generatorui.common.core.configuration; import cn.hutool.core.util.StrUtil; import com.baomidou.mybatisplus.generator.config.DataSourceConfig; +import com.github.davidfantasy.mybatisplus.generatorui.common.core.properties.GeneratorConfig; +import com.github.davidfantasy.mybatisplus.generatorui.common.ProjectPathResolver; import com.github.davidfantasy.mybatisplus.generatorui.common.mbp.BeetlTemplateEngine; import com.github.davidfantasy.mybatisplus.generatorui.common.service.UserConfigStore; import com.github.davidfantasy.mybatisplus.generatorui.common.sqlparser.DynamicParamSqlEnhancer; diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/MybatisplusGeneratoruiAutoConfiguration.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/MybatisplusGeneratoruiAutoConfiguration.java index 1b7c2dd..7ff6588 100644 --- a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/MybatisplusGeneratoruiAutoConfiguration.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/configuration/MybatisplusGeneratoruiAutoConfiguration.java @@ -1,8 +1,7 @@ package com.github.davidfantasy.mybatisplus.generatorui.common.core.configuration; import com.baomidou.mybatisplus.generator.config.ITypeConvert; -import com.github.davidfantasy.mybatisplus.generatorui.common.ApplicationConfigure; -import com.github.davidfantasy.mybatisplus.generatorui.common.GeneratorConfig; +import com.github.davidfantasy.mybatisplus.generatorui.common.core.properties.GeneratorConfig; import com.github.davidfantasy.mybatisplus.generatorui.common.core.properties.SpringDocConfigProperties; import com.github.davidfantasy.mybatisplus.generatorui.common.util.Constants; import com.github.davidfantasy.mybatisplus.generatorui.common.mbp.NameConverter; diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/GeneratorConfig.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/properties/GeneratorConfig.java similarity index 94% rename from mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/GeneratorConfig.java rename to mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/properties/GeneratorConfig.java index 37bce28..98022e3 100644 --- a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/GeneratorConfig.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/properties/GeneratorConfig.java @@ -1,4 +1,4 @@ -package com.github.davidfantasy.mybatisplus.generatorui.common; +package com.github.davidfantasy.mybatisplus.generatorui.common.core.properties; import com.baomidou.mybatisplus.annotation.IdType; import com.baomidou.mybatisplus.generator.config.ITypeConvert; @@ -24,7 +24,7 @@ public class GeneratorConfig { /** * 生成的文件所保存的包路径 */ - private String basePackage = "generatorui.default"; + private String basePackage = "generatorui.mydefault"; /** * 数据库地址 diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/properties/SpringDocConfigProperties.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/properties/SpringDocConfigProperties.java index a527d9a..0a7003b 100644 --- a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/properties/SpringDocConfigProperties.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/core/properties/SpringDocConfigProperties.java @@ -48,7 +48,7 @@ public class SpringDocConfigProperties { /** * 生成的文件所保存的包路径 */ - private String basePackage = "generatorui.default"; + private String basePackage = "generatorui.mydefault"; /** * 数据库地址 diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/mbp/MbpGenerator.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/mbp/MbpGenerator.java index f489a1e..cf6b733 100644 --- a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/mbp/MbpGenerator.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/mbp/MbpGenerator.java @@ -10,9 +10,9 @@ import com.baomidou.mybatisplus.generator.config.po.TableField; import com.baomidou.mybatisplus.generator.config.po.TableInfo; import com.baomidou.mybatisplus.generator.fill.Column; -import com.github.davidfantasy.mybatisplus.generatorui.common.GeneratorConfig; import com.github.davidfantasy.mybatisplus.generatorui.common.ProjectPathResolver; import com.github.davidfantasy.mybatisplus.generatorui.common.api.ServiceException; +import com.github.davidfantasy.mybatisplus.generatorui.common.core.properties.GeneratorConfig; import com.github.davidfantasy.mybatisplus.generatorui.common.dto.Constant; import com.github.davidfantasy.mybatisplus.generatorui.common.dto.GenSetting; import com.github.davidfantasy.mybatisplus.generatorui.common.dto.OutputFileInfo; @@ -29,6 +29,7 @@ import java.io.File; import java.util.*; +import java.util.function.Consumer; @Component @Slf4j @@ -69,15 +70,20 @@ public void genCodeBatch(GenSetting genSetting, List tables) { builder.dateType(generatorConfig.getDateType()); //指定所有生成文件的根目录 builder.outputDir(projectPathResolver.getSourcePath()); - builder.author(StringUtils.hasText(genSetting.getAuthor()) ? genSetting.getAuthor(): System.getProperty("user.name")); + builder.author(StringUtils.hasText(genSetting.getAuthor()) ? genSetting.getAuthor() : System.getProperty("user.name")); if (userConfig.getEntityStrategy().isSwagger2()) { builder.enableSwagger(); } }).templateEngine(beetlTemplateEngine).packageConfig(builder -> { configPackage(builder, genSetting.getModuleName(), userConfig); - }).templateConfig(builder -> { - configTemplate(builder, genSetting.getChoosedOutputFiles(), userConfig); - }).injectionConfig(builder -> { + }) + .strategyConfig(new Consumer() { + @Override + public void accept(StrategyConfig.Builder builder) { + configTemplateNew(builder, genSetting.getChoosedOutputFiles(), userConfig); + } + }) + .injectionConfig(builder -> { configInjection(builder, userConfig, genSetting); }).strategyConfig(builder -> { builder.addInclude(String.join(",", tables)) @@ -112,30 +118,30 @@ private void configPackage(PackageConfig.Builder builder, String moduleName, Use .pathInfo(Collections.singletonMap(OutputFile.xml, mapperXmlOutputPath)); } - private void configTemplate(TemplateConfig.Builder builder, List choosedFileTypes, UserConfig userConfig) { - builder.entity(findTemplatePath(Constant.FILE_TYPE_ENTITY, userConfig)); - builder.mapper(findTemplatePath(Constant.FILE_TYPE_MAPPER, userConfig)); - builder.xml(findTemplatePath(Constant.FILE_TYPE_MAPPER_XML, userConfig)); - builder.service(findTemplatePath(Constant.FILE_TYPE_SERVICE, userConfig)); - builder.serviceImpl(findTemplatePath(Constant.FILE_TYPE_SERVICEIMPL, userConfig)); - builder.controller(findTemplatePath(Constant.FILE_TYPE_CONTROLLER, userConfig)); + private void configTemplateNew(StrategyConfig.Builder builder, List choosedFileTypes, UserConfig userConfig) { + builder.entityBuilder().javaTemplate(findTemplatePath(Constant.FILE_TYPE_ENTITY, userConfig)); + builder.mapperBuilder().mapperTemplate(findTemplatePath(Constant.FILE_TYPE_MAPPER, userConfig)); + builder.mapperBuilder().mapperXmlTemplate(findTemplatePath(Constant.FILE_TYPE_MAPPER_XML, userConfig)); + builder.serviceBuilder().serviceTemplate(findTemplatePath(Constant.FILE_TYPE_SERVICE, userConfig)); + builder.serviceBuilder().serviceImplTemplate(findTemplatePath(Constant.FILE_TYPE_SERVICEIMPL, userConfig)); + builder.controllerBuilder().template(findTemplatePath(Constant.FILE_TYPE_CONTROLLER, userConfig)); if (!choosedFileTypes.contains(Constant.FILE_TYPE_ENTITY)) { - builder.disable(TemplateType.ENTITY); + builder.entityBuilder().disable(); } if (!choosedFileTypes.contains(Constant.FILE_TYPE_MAPPER)) { - builder.disable(TemplateType.MAPPER); + builder.mapperBuilder().disableMapper(); } if (!choosedFileTypes.contains(Constant.FILE_TYPE_MAPPER_XML)) { - builder.disable(TemplateType.XML); + builder.mapperBuilder().disableMapperXml(); } if (!choosedFileTypes.contains(Constant.FILE_TYPE_SERVICE)) { - builder.disable(TemplateType.SERVICE); + builder.serviceBuilder().disableService(); } if (!choosedFileTypes.contains(Constant.FILE_TYPE_SERVICEIMPL)) { - builder.disable(TemplateType.SERVICE_IMPL); + builder.serviceBuilder().disableServiceImpl(); } if (!choosedFileTypes.contains(Constant.FILE_TYPE_CONTROLLER)) { - builder.disable(TemplateType.CONTROLLER); + builder.controllerBuilder().disable(); } } diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/service/SqlGeneratorService.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/service/SqlGeneratorService.java index 07a46e6..d99a2a0 100644 --- a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/service/SqlGeneratorService.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/service/SqlGeneratorService.java @@ -6,7 +6,7 @@ import com.baomidou.mybatisplus.generator.config.rules.DateType; import com.baomidou.mybatisplus.generator.config.rules.DbColumnType; import com.baomidou.mybatisplus.generator.config.rules.IColumnType; -import com.github.davidfantasy.mybatisplus.generatorui.common.GeneratorConfig; +import com.github.davidfantasy.mybatisplus.generatorui.common.core.properties.GeneratorConfig; import com.github.davidfantasy.mybatisplus.generatorui.common.ProjectPathResolver; import com.github.davidfantasy.mybatisplus.generatorui.common.api.ServiceException; import com.github.davidfantasy.mybatisplus.generatorui.common.dto.*; diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/service/UserConfigStore.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/service/UserConfigStore.java index eda154f..ab7f8c7 100644 --- a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/service/UserConfigStore.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/service/UserConfigStore.java @@ -2,7 +2,7 @@ import cn.hutool.core.date.DateUtil; import cn.hutool.core.io.FileUtil; -import com.github.davidfantasy.mybatisplus.generatorui.common.GeneratorConfig; +import com.github.davidfantasy.mybatisplus.generatorui.common.core.properties.GeneratorConfig; import com.github.davidfantasy.mybatisplus.generatorui.common.ProjectPathResolver; import com.github.davidfantasy.mybatisplus.generatorui.common.api.ServiceException; import com.github.davidfantasy.mybatisplus.generatorui.common.dto.OutputFileInfo; diff --git a/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/codetpls/controller.java.btl b/mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/controller.java.btl similarity index 100% rename from mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/codetpls/controller.java.btl rename to mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/controller.java.btl diff --git a/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/codetpls/dto.btl b/mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/dto.btl similarity index 100% rename from mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/codetpls/dto.btl rename to mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/dto.btl diff --git a/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/codetpls/entity.java.btl b/mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/entity.java.btl similarity index 100% rename from mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/codetpls/entity.java.btl rename to mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/entity.java.btl diff --git a/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/codetpls/mapper.java.btl b/mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/mapper.java.btl similarity index 100% rename from mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/codetpls/mapper.java.btl rename to mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/mapper.java.btl diff --git a/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/codetpls/mapper.xml.btl b/mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/mapper.xml.btl similarity index 100% rename from mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/codetpls/mapper.xml.btl rename to mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/mapper.xml.btl diff --git a/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/codetpls/mapperMethods.btl b/mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/mapperMethods.btl similarity index 100% rename from mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/codetpls/mapperMethods.btl rename to mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/mapperMethods.btl diff --git a/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/codetpls/resultMap.btl b/mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/resultMap.btl similarity index 100% rename from mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/codetpls/resultMap.btl rename to mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/resultMap.btl diff --git a/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/codetpls/service.java.btl b/mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/service.java.btl similarity index 100% rename from mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/codetpls/service.java.btl rename to mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/service.java.btl diff --git a/mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/codetpls/serviceImpl.java.btl b/mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/serviceImpl.java.btl similarity index 100% rename from mybatis-plus-generator-ui-starter-webmvc-ui/src/main/resources/codetpls/serviceImpl.java.btl rename to mybatis-plus-generator-ui-starter-common/src/main/resources/codetpls/serviceImpl.java.btl diff --git a/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api/SqlGeneratorController.java b/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api/SqlGeneratorController.java index dc50b7e..ac6c920 100644 --- a/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api/SqlGeneratorController.java +++ b/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/api/SqlGeneratorController.java @@ -1,12 +1,11 @@ package com.github.davidfantasy.mybatisplus.generatorui.webmvc.api.api; -import com.github.davidfantasy.mybatisplus.generatorui.common.GeneratorConfig; +import com.github.davidfantasy.mybatisplus.generatorui.common.core.properties.GeneratorConfig; import com.github.davidfantasy.mybatisplus.generatorui.common.api.Result; import com.github.davidfantasy.mybatisplus.generatorui.common.api.ResultGenerator; import com.github.davidfantasy.mybatisplus.generatorui.common.dto.GenDtoFromSqlReq; import com.github.davidfantasy.mybatisplus.generatorui.common.service.SqlGeneratorService; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.web.bind.annotation.*; @RestController diff --git a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/ControllerPrinter.java b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/ControllerPrinter.java deleted file mode 100644 index fd6610e..0000000 --- a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/ControllerPrinter.java +++ /dev/null @@ -1,51 +0,0 @@ -package com.github.davidfantasy.mybatisplus.generatorui; - -import cn.hutool.core.util.StrUtil; -import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationEvent; -import org.springframework.context.ApplicationListener; -import org.springframework.core.annotation.AnnotatedElementUtils; -import org.springframework.core.annotation.AnnotationUtils; -import org.springframework.stereotype.Component; -import org.springframework.web.bind.annotation.RequestMapping; -import org.springframework.web.bind.annotation.RestController; - -import java.util.Arrays; -import java.util.Objects; - -/** - * 打印扫描到的接口 - * - * @author llq - * @Description ApplicationListener实现类 - */ -// @Component -public class ControllerPrinter implements ApplicationListener { - - @Autowired - private ApplicationContext applicationContext; - - @Override - public void onApplicationEvent(ApplicationEvent event) { - System.out.println("-----------------------"); - Arrays.stream(applicationContext.getBeanDefinitionNames()) - .filter(name -> Objects.requireNonNull(applicationContext.getType(name)) - .isAnnotationPresent(RestController.class)) - .forEach(controllerName -> { - Class controllerClass = applicationContext.getType(controllerName); - System.out.println("Controller: " + controllerClass.getName()); - - Arrays.stream(controllerClass.getDeclaredMethods()) - .filter(method -> - null != AnnotationUtils.findAnnotation(method, RequestMapping.class) - ) - .forEach(method -> { - RequestMapping annotation = AnnotatedElementUtils.getMergedAnnotation(method, RequestMapping.class); - System.out.printf("\tMethod: %s%n\t\tRequestMapping: %s%n", - method.getName(), - StrUtil.join(",", AnnotationUtils.getValue(annotation, "value"))); - }); - }); - } -} diff --git a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/main/resources/application.yaml b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/main/resources/application.yaml index 67f89dc..797e237 100644 --- a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/main/resources/application.yaml +++ b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/main/resources/application.yaml @@ -25,4 +25,4 @@ mybatisplus-genetatorui: dateType: TIME_PACK tablePrefix: t_ idType: ASSIGN_ID - basePackeage: com.github.davidfantasy.mybatisplus.generatorui.example \ No newline at end of file + basePackage: com.github.davidfantasy.mybatisplus.generatorui.example \ No newline at end of file diff --git a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/test/com/github/davidfantasy/mybatisplus/generatorui/TestApplication.java b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/test/com/github/davidfantasy/mybatisplus/generatorui/TestApplication.java index 1375bae..037e5f4 100644 --- a/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/test/com/github/davidfantasy/mybatisplus/generatorui/TestApplication.java +++ b/mybatis-plus-generator-ui-tests/mybatis-plus-generator-ui-actuator-webmvc-tests/src/test/java/test/com/github/davidfantasy/mybatisplus/generatorui/TestApplication.java @@ -1,7 +1,7 @@ package test.com.github.davidfantasy.mybatisplus.generatorui; import com.github.davidfantasy.mybatisplus.generatorui.common.MybatisPlusToolsApplication; -import com.github.davidfantasy.mybatisplus.generatorui.common.GeneratorConfig; +import com.github.davidfantasy.mybatisplus.generatorui.common.core.properties.GeneratorConfig; import com.github.davidfantasy.mybatisplus.generatorui.common.mbp.NameConverter; import org.springframework.boot.autoconfigure.SpringBootApplication; import org.springframework.context.annotation.ComponentScan; diff --git a/pom.xml b/pom.xml index baac077..952a6fe 100644 --- a/pom.xml +++ b/pom.xml @@ -61,10 +61,6 @@ - - org.springframework.boot - spring-boot-starter-web - cn.hutool hutool-core From 111db0f7c62bed885a6d301efd2d8d70ae93a765 Mon Sep 17 00:00:00 2001 From: klaokai <573984425@qq.com> Date: Wed, 11 Sep 2024 15:23:43 +0800 Subject: [PATCH 10/11] =?UTF-8?q?chore(=E6=95=B4=E7=90=86=E4=BB=A3?= =?UTF-8?q?=E7=A0=81)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../generatorui/common/dto/GenSetting.java | 6 ++++++ .../generatorui/common/mbp/MbpGenerator.java | 11 +++-------- .../generatorui/common/service/UserConfigStore.java | 5 +++-- 3 files changed, 12 insertions(+), 10 deletions(-) diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/GenSetting.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/GenSetting.java index 01eaec4..1ce502d 100644 --- a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/GenSetting.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/dto/GenSetting.java @@ -13,6 +13,12 @@ public class GenSetting { /** * 需要生成的文件类型 + * @see Constant.FILE_TYPE_ENTITY + * @see Constant.FILE_TYPE_MAPPER + * @see Constant.FILE_TYPE_MAPPER_XML + * @see Constant.FILE_TYPE_CONTROLLER + * @see Constant.FILE_TYPE_SERVICE + * @see Constant.FILE_TYPE_SERVICEIMPL */ private List choosedOutputFiles; diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/mbp/MbpGenerator.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/mbp/MbpGenerator.java index cf6b733..5b4912d 100644 --- a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/mbp/MbpGenerator.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/mbp/MbpGenerator.java @@ -29,7 +29,6 @@ import java.io.File; import java.util.*; -import java.util.function.Consumer; @Component @Slf4j @@ -77,15 +76,11 @@ public void genCodeBatch(GenSetting genSetting, List tables) { }).templateEngine(beetlTemplateEngine).packageConfig(builder -> { configPackage(builder, genSetting.getModuleName(), userConfig); }) - .strategyConfig(new Consumer() { - @Override - public void accept(StrategyConfig.Builder builder) { - configTemplateNew(builder, genSetting.getChoosedOutputFiles(), userConfig); - } - }) .injectionConfig(builder -> { configInjection(builder, userConfig, genSetting); }).strategyConfig(builder -> { + //设置模版移到这个里面来了 + configTemplate(builder, genSetting.getChoosedOutputFiles(), userConfig); builder.addInclude(String.join(",", tables)) .disableSqlFilter() .enableSkipView(); @@ -118,7 +113,7 @@ private void configPackage(PackageConfig.Builder builder, String moduleName, Use .pathInfo(Collections.singletonMap(OutputFile.xml, mapperXmlOutputPath)); } - private void configTemplateNew(StrategyConfig.Builder builder, List choosedFileTypes, UserConfig userConfig) { + private void configTemplate(StrategyConfig.Builder builder, List choosedFileTypes, UserConfig userConfig) { builder.entityBuilder().javaTemplate(findTemplatePath(Constant.FILE_TYPE_ENTITY, userConfig)); builder.mapperBuilder().mapperTemplate(findTemplatePath(Constant.FILE_TYPE_MAPPER, userConfig)); builder.mapperBuilder().mapperXmlTemplate(findTemplatePath(Constant.FILE_TYPE_MAPPER_XML, userConfig)); diff --git a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/service/UserConfigStore.java b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/service/UserConfigStore.java index ab7f8c7..55faad7 100644 --- a/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/service/UserConfigStore.java +++ b/mybatis-plus-generator-ui-starter-common/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/common/service/UserConfigStore.java @@ -22,6 +22,7 @@ import java.io.File; import java.io.IOException; import java.nio.charset.Charset; +import java.nio.charset.StandardCharsets; import java.util.Collections; import java.util.Date; import java.util.List; @@ -66,7 +67,7 @@ public UserConfig getUserConfigFromFile() { if (!FileUtil.exist(this.userConfigPath)) { return null; } - String userConfigStr = FileUtil.readString(userConfigPath, Charset.forName("utf-8")); + String userConfigStr = FileUtil.readString(userConfigPath, StandardCharsets.UTF_8); try { return JsonUtil.json2obj(userConfigStr, UserConfig.class); } catch (Exception e) { @@ -86,7 +87,7 @@ public void saveUserConfig(UserConfig userConfig) throws IOException { } Files.createParentDirs(userConfigFile); userConfigFile.createNewFile(); - FileUtil.writeFromStream(new ByteArrayInputStream(configStr.getBytes(Charset.forName("utf-8"))), userConfigFile); + FileUtil.writeFromStream(new ByteArrayInputStream(configStr.getBytes(StandardCharsets.UTF_8)), userConfigFile); } public String uploadTemplate(MultipartFile file) { From ad280006c656c822c62231920ba627203482e19f Mon Sep 17 00:00:00 2001 From: klaokai <573984425@qq.com> Date: Wed, 11 Sep 2024 15:55:59 +0800 Subject: [PATCH 11/11] =?UTF-8?q?chore(=E6=95=B4=E7=90=86=E4=BB=A3?= =?UTF-8?q?=E7=A0=81)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../core/RouterFunctionWebMvcProvider.java | 41 ------------------- .../core/SpringDocWebMvcConfiguration.java | 39 ++++++------------ 2 files changed, 12 insertions(+), 68 deletions(-) delete mode 100644 mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/core/RouterFunctionWebMvcProvider.java diff --git a/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/core/RouterFunctionWebMvcProvider.java b/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/core/RouterFunctionWebMvcProvider.java deleted file mode 100644 index 871eaf2..0000000 --- a/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/core/RouterFunctionWebMvcProvider.java +++ /dev/null @@ -1,41 +0,0 @@ -/* - * - * * - * * * - * * * * Copyright 2019-2022 the original author or authors. - * * * * - * * * * Licensed under the Apache License, Version 2.0 (the "License"); - * * * * you may not use this file except in compliance with the License. - * * * * You may obtain a copy of the License at - * * * * - * * * * https://www.apache.org/licenses/LICENSE-2.0 - * * * * - * * * * Unless required by applicable law or agreed to in writing, software - * * * * distributed under the License is distributed on an "AS IS" BASIS, - * * * * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * * * * See the License for the specific language governing permissions and - * * * * limitations under the License. - * * * - * * - * - */ - -package com.github.davidfantasy.mybatisplus.generatorui.webmvc.api.core; - -import org.springframework.beans.BeansException; -import org.springframework.context.ApplicationContext; -import org.springframework.context.ApplicationContextAware; - -public class RouterFunctionWebMvcProvider implements ApplicationContextAware { - - /** - * The Application context. - */ - private ApplicationContext applicationContext; - - @Override - public void setApplicationContext(ApplicationContext applicationContext) throws BeansException { - this.applicationContext = applicationContext; - } - -} diff --git a/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/core/SpringDocWebMvcConfiguration.java b/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/core/SpringDocWebMvcConfiguration.java index df5a8e2..861f076 100644 --- a/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/core/SpringDocWebMvcConfiguration.java +++ b/mybatis-plus-generator-ui-starter-webmvc-api/src/main/java/com/github/davidfantasy/mybatisplus/generatorui/webmvc/api/core/SpringDocWebMvcConfiguration.java @@ -1,11 +1,13 @@ package com.github.davidfantasy.mybatisplus.generatorui.webmvc.api.core; import com.github.davidfantasy.mybatisplus.generatorui.common.core.configuration.MybatisplusGeneratoruiAutoConfiguration; -import org.springframework.boot.autoconfigure.condition.*; -import org.springframework.context.annotation.Bean; +import com.github.davidfantasy.mybatisplus.generatorui.webmvc.api.api.*; +import org.springframework.boot.autoconfigure.condition.ConditionalOnBean; +import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty; +import org.springframework.boot.autoconfigure.condition.ConditionalOnWebApplication; import org.springframework.context.annotation.Configuration; +import org.springframework.context.annotation.Import; import org.springframework.context.annotation.Lazy; -import org.springframework.web.servlet.function.RouterFunction; import static com.github.davidfantasy.mybatisplus.generatorui.common.util.Constants.MYBATISPLUS_GENETATORUI_ENABLED; @@ -19,29 +21,12 @@ @ConditionalOnWebApplication(type = ConditionalOnWebApplication.Type.SERVLET) @ConditionalOnProperty(name = MYBATISPLUS_GENETATORUI_ENABLED, matchIfMissing = true) @ConditionalOnBean(MybatisplusGeneratoruiAutoConfiguration.class) +@Import({AutoCompleteController.class, + DatabaseController.class, + MbpGeneratorController.class, + OpenApiWebMvcResource.class, + OutputFileInfoController.class, + SqlGeneratorController.class, + TemplateController.class}) public class SpringDocWebMvcConfiguration { - - static { - } - - /** - * The type Spring doc web mvc router configuration. - * - * @author bnasslahsen - */ - @ConditionalOnClass(RouterFunction.class) - static class SpringDocWebMvcRouterConfiguration { - - /** - * Router function provider router function provider. - * - * @return the router function provider - */ - @Bean - @ConditionalOnMissingBean - @Lazy(false) - RouterFunctionWebMvcProvider routerFunctionProvider() { - return new RouterFunctionWebMvcProvider(); - } - } }