慢查询打印limit
This commit is contained in:
Binary file not shown.
@@ -259,6 +259,24 @@ public class TapeMybatisGeneratorPlugin extends PluginAdapter {
|
|||||||
);
|
);
|
||||||
FormatTools.addMethodWithBestPosition(topLevelClass, getOffset);
|
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(
|
Method getWhereString = ElementTools.generateMethod(
|
||||||
"getWhereString",
|
"getWhereString",
|
||||||
JavaVisibility.PUBLIC,
|
JavaVisibility.PUBLIC,
|
||||||
|
|||||||
@@ -1057,6 +1057,9 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
method.addBodyLine("if (example.getOrderByClause() != null) {");
|
method.addBodyLine("if (example.getOrderByClause() != null) {");
|
||||||
method.addBodyLine("exampleString += \"\\n\\t|-> order by: \" + example.getOrderByClause();");
|
method.addBodyLine("exampleString += \"\\n\\t|-> order by: \" + example.getOrderByClause();");
|
||||||
method.addBodyLine("}");
|
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("LOGGER." + slowQueryLoggerLevel + "(\"[SQL] select " + modelClassName + " valid list primary key use long time\" +");
|
||||||
method.addBodyLine(" \"\\n\\t|-> use time:\" + findPrimaryKeyTime + \"ms\" +");
|
method.addBodyLine(" \"\\n\\t|-> use time:\" + findPrimaryKeyTime + \"ms\" +");
|
||||||
method.addBodyLine(" exampleString +");
|
method.addBodyLine(" exampleString +");
|
||||||
@@ -1089,6 +1092,9 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
method.addBodyLine("if (example.getOrderByClause() != null) {");
|
method.addBodyLine("if (example.getOrderByClause() != null) {");
|
||||||
method.addBodyLine("exampleString += \"\\n\\t|-> order by: \" + example.getOrderByClause();");
|
method.addBodyLine("exampleString += \"\\n\\t|-> order by: \" + example.getOrderByClause();");
|
||||||
method.addBodyLine("}");
|
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("LOGGER." + slowQueryLoggerLevel + "(\"[SQL] select " + modelClassName + " valid list use long time\" +");
|
||||||
method.addBodyLine(" \"\\n\\t|-> use time:\" + useTime + \"ms\" +");
|
method.addBodyLine(" \"\\n\\t|-> use time:\" + useTime + \"ms\" +");
|
||||||
method.addBodyLine(" exampleString +");
|
method.addBodyLine(" exampleString +");
|
||||||
@@ -1128,6 +1134,9 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
method.addBodyLine("if (example.getOrderByClause() != null) {");
|
method.addBodyLine("if (example.getOrderByClause() != null) {");
|
||||||
method.addBodyLine("exampleString += \"\\n\\t|-> order by: \" + example.getOrderByClause();");
|
method.addBodyLine("exampleString += \"\\n\\t|-> order by: \" + example.getOrderByClause();");
|
||||||
method.addBodyLine("}");
|
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("LOGGER." + slowQueryLoggerLevel + "(\"[SQL] select " + modelClassName + " trash list primary key use long time\" +");
|
||||||
method.addBodyLine(" \"\\n\\t|-> use time:\" + findPrimaryKeyTime + \"ms\" +");
|
method.addBodyLine(" \"\\n\\t|-> use time:\" + findPrimaryKeyTime + \"ms\" +");
|
||||||
method.addBodyLine(" exampleString +");
|
method.addBodyLine(" exampleString +");
|
||||||
@@ -1160,6 +1169,9 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
method.addBodyLine("if (example.getOrderByClause() != null) {");
|
method.addBodyLine("if (example.getOrderByClause() != null) {");
|
||||||
method.addBodyLine("exampleString += \"\\n\\t|-> order by: \" + example.getOrderByClause();");
|
method.addBodyLine("exampleString += \"\\n\\t|-> order by: \" + example.getOrderByClause();");
|
||||||
method.addBodyLine("}");
|
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("LOGGER." + slowQueryLoggerLevel + "(\"[SQL] select " + modelClassName + " trash list use long time\" +");
|
||||||
method.addBodyLine(" \"\\n\\t|-> use time:\" + useTime + \"ms\" +");
|
method.addBodyLine(" \"\\n\\t|-> use time:\" + useTime + \"ms\" +");
|
||||||
method.addBodyLine(" exampleString +");
|
method.addBodyLine(" exampleString +");
|
||||||
|
|||||||
Reference in New Issue
Block a user