diff --git a/releases/tape-mybatis-generator-plugin-1.0-SNAPSHOT.jar b/releases/tape-mybatis-generator-plugin-1.0-SNAPSHOT.jar index 8732b42..4f1d0af 100644 Binary files a/releases/tape-mybatis-generator-plugin-1.0-SNAPSHOT.jar and b/releases/tape-mybatis-generator-plugin-1.0-SNAPSHOT.jar differ diff --git a/src/main/java/com/iqudoo/framework/mybatis/TapeMybatisGeneratorPlugin.java b/src/main/java/com/iqudoo/framework/mybatis/TapeMybatisGeneratorPlugin.java index 876c2d3..912dec6 100644 --- a/src/main/java/com/iqudoo/framework/mybatis/TapeMybatisGeneratorPlugin.java +++ b/src/main/java/com/iqudoo/framework/mybatis/TapeMybatisGeneratorPlugin.java @@ -259,6 +259,24 @@ public class TapeMybatisGeneratorPlugin extends PluginAdapter { ); FormatTools.addMethodWithBestPosition(topLevelClass, getOffset); + Method getLimitString = ElementTools.generateMethod( + "getLimitString", + JavaVisibility.PUBLIC, + stringType + ); + getLimitString = ElementTools.generateMethodBody( + getLimitString, + "if (getRows() != null) {", + "if (getOffset() != null) {", + "return getOffset() + \",\" + getRows();", + "} else {", + "return getRows() + \"\";", + "}", + "}", + "return null;" + ); + FormatTools.addMethodWithBestPosition(topLevelClass, getLimitString); + Method getWhereString = ElementTools.generateMethod( "getWhereString", JavaVisibility.PUBLIC, diff --git a/src/main/java/com/iqudoo/framework/mybatis/TapeRepositoryGeneratorPlugin.java b/src/main/java/com/iqudoo/framework/mybatis/TapeRepositoryGeneratorPlugin.java index ae16b6f..a615782 100644 --- a/src/main/java/com/iqudoo/framework/mybatis/TapeRepositoryGeneratorPlugin.java +++ b/src/main/java/com/iqudoo/framework/mybatis/TapeRepositoryGeneratorPlugin.java @@ -1057,6 +1057,9 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter { method.addBodyLine("if (example.getOrderByClause() != null) {"); method.addBodyLine("exampleString += \"\\n\\t|-> order by: \" + example.getOrderByClause();"); method.addBodyLine("}"); + method.addBodyLine("if (example.getLimitString() != null) {"); + method.addBodyLine("exampleString += \"\\n\\t|-> limit: \" + example.getLimitString();"); + method.addBodyLine("}"); method.addBodyLine("LOGGER." + slowQueryLoggerLevel + "(\"[SQL] select " + modelClassName + " valid list primary key use long time\" +"); method.addBodyLine(" \"\\n\\t|-> use time:\" + findPrimaryKeyTime + \"ms\" +"); method.addBodyLine(" exampleString +"); @@ -1089,6 +1092,9 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter { method.addBodyLine("if (example.getOrderByClause() != null) {"); method.addBodyLine("exampleString += \"\\n\\t|-> order by: \" + example.getOrderByClause();"); method.addBodyLine("}"); + method.addBodyLine("if (example.getLimitString() != null) {"); + method.addBodyLine("exampleString += \"\\n\\t|-> limit: \" + example.getLimitString();"); + method.addBodyLine("}"); method.addBodyLine("LOGGER." + slowQueryLoggerLevel + "(\"[SQL] select " + modelClassName + " valid list use long time\" +"); method.addBodyLine(" \"\\n\\t|-> use time:\" + useTime + \"ms\" +"); method.addBodyLine(" exampleString +"); @@ -1128,6 +1134,9 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter { method.addBodyLine("if (example.getOrderByClause() != null) {"); method.addBodyLine("exampleString += \"\\n\\t|-> order by: \" + example.getOrderByClause();"); method.addBodyLine("}"); + method.addBodyLine("if (example.getLimitString() != null) {"); + method.addBodyLine("exampleString += \"\\n\\t|-> limit: \" + example.getLimitString();"); + method.addBodyLine("}"); method.addBodyLine("LOGGER." + slowQueryLoggerLevel + "(\"[SQL] select " + modelClassName + " trash list primary key use long time\" +"); method.addBodyLine(" \"\\n\\t|-> use time:\" + findPrimaryKeyTime + \"ms\" +"); method.addBodyLine(" exampleString +"); @@ -1160,6 +1169,9 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter { method.addBodyLine("if (example.getOrderByClause() != null) {"); method.addBodyLine("exampleString += \"\\n\\t|-> order by: \" + example.getOrderByClause();"); method.addBodyLine("}"); + method.addBodyLine("if (example.getLimitString() != null) {"); + method.addBodyLine("exampleString += \"\\n\\t|-> limit: \" + example.getLimitString();"); + method.addBodyLine("}"); method.addBodyLine("LOGGER." + slowQueryLoggerLevel + "(\"[SQL] select " + modelClassName + " trash list use long time\" +"); method.addBodyLine(" \"\\n\\t|-> use time:\" + useTime + \"ms\" +"); method.addBodyLine(" exampleString +");