插件
This commit is contained in:
Binary file not shown.
@@ -104,6 +104,10 @@ public class TapeMybatisGeneratorPlugin extends PluginAdapter {
|
|||||||
FullyQualifiedJavaType integerType = new FullyQualifiedJavaType("java.lang.Integer");
|
FullyQualifiedJavaType integerType = new FullyQualifiedJavaType("java.lang.Integer");
|
||||||
FullyQualifiedJavaType booleanType = new FullyQualifiedJavaType("java.lang.Boolean");
|
FullyQualifiedJavaType booleanType = new FullyQualifiedJavaType("java.lang.Boolean");
|
||||||
FullyQualifiedJavaType stringType = new FullyQualifiedJavaType("java.lang.String");
|
FullyQualifiedJavaType stringType = new FullyQualifiedJavaType("java.lang.String");
|
||||||
|
|
||||||
|
String domainObjectName = introspectedTable.getFullyQualifiedTable().getDomainObjectName();
|
||||||
|
String exampleClassName = domainObjectName + "Example";
|
||||||
|
|
||||||
// 添加 startPageNum、maxPageSize、ignorePageSize 字段
|
// 添加 startPageNum、maxPageSize、ignorePageSize 字段
|
||||||
Field maxPageSizeField = ElementTools.generateField(
|
Field maxPageSizeField = ElementTools.generateField(
|
||||||
"maxPageSize",
|
"maxPageSize",
|
||||||
@@ -356,6 +360,31 @@ public class TapeMybatisGeneratorPlugin extends PluginAdapter {
|
|||||||
);
|
);
|
||||||
FormatTools.addMethodWithBestPosition(topLevelClass, getWhereString);
|
FormatTools.addMethodWithBestPosition(topLevelClass, getWhereString);
|
||||||
|
|
||||||
|
Method cloneExample = ElementTools.generateMethod(
|
||||||
|
"cloneExample",
|
||||||
|
JavaVisibility.PUBLIC,
|
||||||
|
topLevelClass.getType()
|
||||||
|
);
|
||||||
|
cloneExample = ElementTools.generateMethodBody(
|
||||||
|
cloneExample,
|
||||||
|
exampleClassName + " newExample = new " + exampleClassName + "();",
|
||||||
|
"newExample.rows = this.rows;",
|
||||||
|
"newExample.offset = this.offset;",
|
||||||
|
"newExample.maxPageSize = this.maxPageSize;",
|
||||||
|
"newExample.ignorePageSize = this.ignorePageSize;",
|
||||||
|
"newExample.startPageNum = startPageNum;",
|
||||||
|
hasBLOBColumns ? "newExample.withBLOBs = withBLOBs;" : "",
|
||||||
|
"if (this.getOredCriteria() != null && !this.getOredCriteria().isEmpty()) {",
|
||||||
|
"for (" + exampleClassName + ".Criteria oldCriteria : this.getOredCriteria()) {",
|
||||||
|
exampleClassName + ".Criteria newCriteria = newExample.or();",
|
||||||
|
"newCriteria.getCriteria().addAll(oldCriteria.getCriteria());",
|
||||||
|
"}",
|
||||||
|
"}",
|
||||||
|
"newExample.setOrderByClause(this.getOrderByClause());",
|
||||||
|
"return newExample;"
|
||||||
|
);
|
||||||
|
FormatTools.addMethodWithBestPosition(topLevelClass, cloneExample);
|
||||||
|
|
||||||
// !!! clear 方法增加 offset 和 rows的清理
|
// !!! clear 方法增加 offset 和 rows的清理
|
||||||
boolean hasClear = false;
|
boolean hasClear = false;
|
||||||
List<Method> methodList = topLevelClass.getMethods();
|
List<Method> methodList = topLevelClass.getMethods();
|
||||||
|
|||||||
@@ -621,7 +621,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
method.addBodyLine("long useTime = new Date().getTime() - startTime;");
|
method.addBodyLine("long useTime = new Date().getTime() - startTime;");
|
||||||
method.addBodyLine("if (useTime > " + getSlowQueryLoggerTime(introspectedTable) + ") {");
|
method.addBodyLine("if (useTime > " + getSlowQueryLoggerTime(introspectedTable) + ") {");
|
||||||
method.addBodyLine("LOGGER." + getSlowQueryLoggerLevel(introspectedTable) + "(\"[SQL] insert " + modelClassName + " long time\" +");
|
method.addBodyLine("LOGGER." + getSlowQueryLoggerLevel(introspectedTable) + "(\"[SQL] insert " + modelClassName + " long time\" +");
|
||||||
method.addBodyLine(" \"\\n\\t|-> use time:\" + useTime + \"ms\" +");
|
method.addBodyLine(" \"\\n\\t|-> use time: \" + useTime + \"ms\" +");
|
||||||
method.addBodyLine(" \"\\n\\t|-----------------------------------\"");
|
method.addBodyLine(" \"\\n\\t|-----------------------------------\"");
|
||||||
method.addBodyLine(");");
|
method.addBodyLine(");");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
@@ -688,7 +688,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
method.addBodyLine("long useTime = new Date().getTime() - startTime;");
|
method.addBodyLine("long useTime = new Date().getTime() - startTime;");
|
||||||
method.addBodyLine("if (useTime > " + getSlowQueryLoggerTime(introspectedTable) + ") {");
|
method.addBodyLine("if (useTime > " + getSlowQueryLoggerTime(introspectedTable) + ") {");
|
||||||
method.addBodyLine("LOGGER." + getSlowQueryLoggerLevel(introspectedTable) + "(\"[SQL] batch insert " + modelClassName + " long time\" +");
|
method.addBodyLine("LOGGER." + getSlowQueryLoggerLevel(introspectedTable) + "(\"[SQL] batch insert " + modelClassName + " long time\" +");
|
||||||
method.addBodyLine(" \"\\n\\t|-> use time:\" + useTime + \"ms\" +");
|
method.addBodyLine(" \"\\n\\t|-> use time: \" + useTime + \"ms\" +");
|
||||||
method.addBodyLine(" \"\\n\\t|-----------------------------------\"");
|
method.addBodyLine(" \"\\n\\t|-----------------------------------\"");
|
||||||
method.addBodyLine(");");
|
method.addBodyLine(");");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
@@ -766,7 +766,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
method.addBodyLine("long useTime = new Date().getTime() - startTime;");
|
method.addBodyLine("long useTime = new Date().getTime() - startTime;");
|
||||||
method.addBodyLine("if (useTime > " + getSlowQueryLoggerTime(introspectedTable) + ") {");
|
method.addBodyLine("if (useTime > " + getSlowQueryLoggerTime(introspectedTable) + ") {");
|
||||||
method.addBodyLine("LOGGER." + getSlowQueryLoggerLevel(introspectedTable) + "(\"[SQL] update " + modelClassName + " long time\" +");
|
method.addBodyLine("LOGGER." + getSlowQueryLoggerLevel(introspectedTable) + "(\"[SQL] update " + modelClassName + " long time\" +");
|
||||||
method.addBodyLine(" \"\\n\\t|-> use time:\" + useTime + \"ms\" +");
|
method.addBodyLine(" \"\\n\\t|-> use time: \" + useTime + \"ms\" +");
|
||||||
method.addBodyLine(" \"\\n\\t|-----------------------------------\"");
|
method.addBodyLine(" \"\\n\\t|-----------------------------------\"");
|
||||||
method.addBodyLine(");");
|
method.addBodyLine(");");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
@@ -791,6 +791,8 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
method.addException(new FullyQualifiedJavaType("Throwable"));
|
method.addException(new FullyQualifiedJavaType("Throwable"));
|
||||||
|
|
||||||
// 方法体
|
// 方法体
|
||||||
|
method.addBodyLine("// clone new example");
|
||||||
|
method.addBodyLine("example = example.cloneExample();");
|
||||||
method.addBodyLine("for (" + exampleClassName + ".Criteria criteria : example.getOredCriteria()) {");
|
method.addBodyLine("for (" + exampleClassName + ".Criteria criteria : example.getOredCriteria()) {");
|
||||||
method.addBodyLine("criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(0);");
|
method.addBodyLine("criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(0);");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
@@ -845,7 +847,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
method.addBodyLine("exampleString += \"\\n\\t|-> where: \" + example.getWhereString();");
|
method.addBodyLine("exampleString += \"\\n\\t|-> where: \" + example.getWhereString();");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
method.addBodyLine("LOGGER." + getSlowQueryLoggerLevel(introspectedTable) + "(\"[SQL] updateByExampleSelective " + modelClassName + " long time\" +");
|
method.addBodyLine("LOGGER." + getSlowQueryLoggerLevel(introspectedTable) + "(\"[SQL] updateByExampleSelective " + modelClassName + " long time\" +");
|
||||||
method.addBodyLine(" \"\\n\\t|-> use time:\" + useTime + \"ms\" +");
|
method.addBodyLine(" \"\\n\\t|-> use time: \" + useTime + \"ms\" +");
|
||||||
method.addBodyLine(" exampleString +");
|
method.addBodyLine(" exampleString +");
|
||||||
method.addBodyLine(" \"\\n\\t|-----------------------------------\"");
|
method.addBodyLine(" \"\\n\\t|-----------------------------------\"");
|
||||||
method.addBodyLine(");");
|
method.addBodyLine(");");
|
||||||
@@ -899,7 +901,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
method.addBodyLine("long useTime = new Date().getTime() - startTime;");
|
method.addBodyLine("long useTime = new Date().getTime() - startTime;");
|
||||||
method.addBodyLine("if (useTime > " + getSlowQueryLoggerTime(introspectedTable) + ") {");
|
method.addBodyLine("if (useTime > " + getSlowQueryLoggerTime(introspectedTable) + ") {");
|
||||||
method.addBodyLine("LOGGER." + getSlowQueryLoggerLevel(introspectedTable) + "(\"[SQL] deleteById " + modelClassName + " long time\" +");
|
method.addBodyLine("LOGGER." + getSlowQueryLoggerLevel(introspectedTable) + "(\"[SQL] deleteById " + modelClassName + " long time\" +");
|
||||||
method.addBodyLine(" \"\\n\\t|-> use time:\" + useTime + \"ms\" +");
|
method.addBodyLine(" \"\\n\\t|-> use time: \" + useTime + \"ms\" +");
|
||||||
method.addBodyLine(" \"\\n\\t|-----------------------------------\"");
|
method.addBodyLine(" \"\\n\\t|-----------------------------------\"");
|
||||||
method.addBodyLine(");");
|
method.addBodyLine(");");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
@@ -947,7 +949,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
method.addBodyLine("long useTime = new Date().getTime() - startTime;");
|
method.addBodyLine("long useTime = new Date().getTime() - startTime;");
|
||||||
method.addBodyLine("if (useTime > " + getSlowQueryLoggerTime(introspectedTable) + ") {");
|
method.addBodyLine("if (useTime > " + getSlowQueryLoggerTime(introspectedTable) + ") {");
|
||||||
method.addBodyLine("LOGGER." + getSlowQueryLoggerLevel(introspectedTable) + "(\"[SQL] trashById " + modelClassName + " long time\" +");
|
method.addBodyLine("LOGGER." + getSlowQueryLoggerLevel(introspectedTable) + "(\"[SQL] trashById " + modelClassName + " long time\" +");
|
||||||
method.addBodyLine(" \"\\n\\t|-> use time:\" + useTime + \"ms\" +");
|
method.addBodyLine(" \"\\n\\t|-> use time: \" + useTime + \"ms\" +");
|
||||||
method.addBodyLine(" \"\\n\\t|-----------------------------------\"");
|
method.addBodyLine(" \"\\n\\t|-----------------------------------\"");
|
||||||
method.addBodyLine(");");
|
method.addBodyLine(");");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
@@ -997,7 +999,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
method.addBodyLine("long useTime = new Date().getTime() - startTime;");
|
method.addBodyLine("long useTime = new Date().getTime() - startTime;");
|
||||||
method.addBodyLine("if (useTime > " + getSlowQueryLoggerTime(introspectedTable) + ") {");
|
method.addBodyLine("if (useTime > " + getSlowQueryLoggerTime(introspectedTable) + ") {");
|
||||||
method.addBodyLine("LOGGER." + getSlowQueryLoggerLevel(introspectedTable) + "(\"[SQL] recoverById " + modelClassName + " long time\" +");
|
method.addBodyLine("LOGGER." + getSlowQueryLoggerLevel(introspectedTable) + "(\"[SQL] recoverById " + modelClassName + " long time\" +");
|
||||||
method.addBodyLine(" \"\\n\\t|-> use time:\" + useTime + \"ms\" +");
|
method.addBodyLine(" \"\\n\\t|-> use time: \" + useTime + \"ms\" +");
|
||||||
method.addBodyLine(" \"\\n\\t|-----------------------------------\"");
|
method.addBodyLine(" \"\\n\\t|-----------------------------------\"");
|
||||||
method.addBodyLine(");");
|
method.addBodyLine(");");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
@@ -1024,6 +1026,8 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
method.addBodyLine("if (release) {");
|
method.addBodyLine("if (release) {");
|
||||||
method.addBodyLine("return " + mapperFieldName + ".deleteByExample(example);");
|
method.addBodyLine("return " + mapperFieldName + ".deleteByExample(example);");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
|
method.addBodyLine("// clone new example");
|
||||||
|
method.addBodyLine("example = example.cloneExample();");
|
||||||
method.addBodyLine("for (" + exampleClassName + ".Criteria criteria : example.getOredCriteria()) {");
|
method.addBodyLine("for (" + exampleClassName + ".Criteria criteria : example.getOredCriteria()) {");
|
||||||
method.addBodyLine("criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(1);");
|
method.addBodyLine("criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(1);");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
@@ -1046,7 +1050,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
method.addBodyLine("long useTime = new Date().getTime() - startTime;");
|
method.addBodyLine("long useTime = new Date().getTime() - startTime;");
|
||||||
method.addBodyLine("if (useTime > " + getSlowQueryLoggerTime(introspectedTable) + ") {");
|
method.addBodyLine("if (useTime > " + getSlowQueryLoggerTime(introspectedTable) + ") {");
|
||||||
method.addBodyLine("LOGGER." + getSlowQueryLoggerLevel(introspectedTable) + "(\"[SQL] deleteAll " + modelClassName + " long time\" +");
|
method.addBodyLine("LOGGER." + getSlowQueryLoggerLevel(introspectedTable) + "(\"[SQL] deleteAll " + modelClassName + " long time\" +");
|
||||||
method.addBodyLine(" \"\\n\\t|-> use time:\" + useTime + \"ms\" +");
|
method.addBodyLine(" \"\\n\\t|-> use time: \" + useTime + \"ms\" +");
|
||||||
method.addBodyLine(" \"\\n\\t|-----------------------------------\"");
|
method.addBodyLine(" \"\\n\\t|-----------------------------------\"");
|
||||||
method.addBodyLine(");");
|
method.addBodyLine(");");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
@@ -1071,6 +1075,8 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
method.addException(new FullyQualifiedJavaType("Throwable"));
|
method.addException(new FullyQualifiedJavaType("Throwable"));
|
||||||
|
|
||||||
// 方法体
|
// 方法体
|
||||||
|
method.addBodyLine("// clone new example");
|
||||||
|
method.addBodyLine("example = example.cloneExample();");
|
||||||
method.addBodyLine("for (" + exampleClassName + ".Criteria criteria : example.getOredCriteria()) {");
|
method.addBodyLine("for (" + exampleClassName + ".Criteria criteria : example.getOredCriteria()) {");
|
||||||
method.addBodyLine("criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(0);");
|
method.addBodyLine("criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(0);");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
@@ -1094,7 +1100,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
method.addBodyLine("long useTime = new Date().getTime() - startTime;");
|
method.addBodyLine("long useTime = new Date().getTime() - startTime;");
|
||||||
method.addBodyLine("if (useTime > " + getSlowQueryLoggerTime(introspectedTable) + ") {");
|
method.addBodyLine("if (useTime > " + getSlowQueryLoggerTime(introspectedTable) + ") {");
|
||||||
method.addBodyLine("LOGGER." + getSlowQueryLoggerLevel(introspectedTable) + "(\"[SQL] trashAll " + modelClassName + " long time\" +");
|
method.addBodyLine("LOGGER." + getSlowQueryLoggerLevel(introspectedTable) + "(\"[SQL] trashAll " + modelClassName + " long time\" +");
|
||||||
method.addBodyLine(" \"\\n\\t|-> use time:\" + useTime + \"ms\" +");
|
method.addBodyLine(" \"\\n\\t|-> use time: \" + useTime + \"ms\" +");
|
||||||
method.addBodyLine(" \"\\n\\t|-----------------------------------\"");
|
method.addBodyLine(" \"\\n\\t|-----------------------------------\"");
|
||||||
method.addBodyLine(");");
|
method.addBodyLine(");");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
@@ -1119,6 +1125,8 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
method.addException(new FullyQualifiedJavaType("Throwable"));
|
method.addException(new FullyQualifiedJavaType("Throwable"));
|
||||||
|
|
||||||
// 方法体
|
// 方法体
|
||||||
|
method.addBodyLine("// clone new example");
|
||||||
|
method.addBodyLine("example = example.cloneExample();");
|
||||||
method.addBodyLine("for (" + exampleClassName + ".Criteria criteria : example.getOredCriteria()) {");
|
method.addBodyLine("for (" + exampleClassName + ".Criteria criteria : example.getOredCriteria()) {");
|
||||||
method.addBodyLine("criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(1);");
|
method.addBodyLine("criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(1);");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
@@ -1142,7 +1150,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
method.addBodyLine("long useTime = new Date().getTime() - startTime;");
|
method.addBodyLine("long useTime = new Date().getTime() - startTime;");
|
||||||
method.addBodyLine("if (useTime > " + getSlowQueryLoggerTime(introspectedTable) + ") {");
|
method.addBodyLine("if (useTime > " + getSlowQueryLoggerTime(introspectedTable) + ") {");
|
||||||
method.addBodyLine("LOGGER." + getSlowQueryLoggerLevel(introspectedTable) + "(\"[SQL] recoverAll " + modelClassName + " long time\" +");
|
method.addBodyLine("LOGGER." + getSlowQueryLoggerLevel(introspectedTable) + "(\"[SQL] recoverAll " + modelClassName + " long time\" +");
|
||||||
method.addBodyLine(" \"\\n\\t|-> use time:\" + useTime + \"ms\" +");
|
method.addBodyLine(" \"\\n\\t|-> use time: \" + useTime + \"ms\" +");
|
||||||
method.addBodyLine(" \"\\n\\t|-----------------------------------\"");
|
method.addBodyLine(" \"\\n\\t|-----------------------------------\"");
|
||||||
method.addBodyLine(");");
|
method.addBodyLine(");");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
@@ -1167,6 +1175,8 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
method.addParameter(new Parameter(new FullyQualifiedJavaType(exampleClassName), "example"));
|
method.addParameter(new Parameter(new FullyQualifiedJavaType(exampleClassName), "example"));
|
||||||
method.addException(new FullyQualifiedJavaType("Throwable"));
|
method.addException(new FullyQualifiedJavaType("Throwable"));
|
||||||
|
|
||||||
|
method.addBodyLine("// clone new example");
|
||||||
|
method.addBodyLine("example = example.cloneExample();");
|
||||||
method.addBodyLine("example.usePage(1, 1);");
|
method.addBodyLine("example.usePage(1, 1);");
|
||||||
method.addBodyLine("List<" + modelClassName + "> dataList = getValidList(example);");
|
method.addBodyLine("List<" + modelClassName + "> dataList = getValidList(example);");
|
||||||
method.addBodyLine("if (dataList != null && !dataList.isEmpty()) {");
|
method.addBodyLine("if (dataList != null && !dataList.isEmpty()) {");
|
||||||
@@ -1185,6 +1195,8 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
method.addParameter(new Parameter(new FullyQualifiedJavaType(exampleClassName), "example"));
|
method.addParameter(new Parameter(new FullyQualifiedJavaType(exampleClassName), "example"));
|
||||||
method.addException(new FullyQualifiedJavaType("Throwable"));
|
method.addException(new FullyQualifiedJavaType("Throwable"));
|
||||||
|
|
||||||
|
method.addBodyLine("// clone new example");
|
||||||
|
method.addBodyLine("example = example.cloneExample();");
|
||||||
method.addBodyLine("example.usePage(1, 1);");
|
method.addBodyLine("example.usePage(1, 1);");
|
||||||
method.addBodyLine("List<" + modelClassName + "> dataList = getTrashList(example);");
|
method.addBodyLine("List<" + modelClassName + "> dataList = getTrashList(example);");
|
||||||
method.addBodyLine("if (dataList != null && !dataList.isEmpty()) {");
|
method.addBodyLine("if (dataList != null && !dataList.isEmpty()) {");
|
||||||
@@ -1204,6 +1216,8 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
method.addParameter(new Parameter(new FullyQualifiedJavaType(exampleClassName), "example"));
|
method.addParameter(new Parameter(new FullyQualifiedJavaType(exampleClassName), "example"));
|
||||||
method.addException(new FullyQualifiedJavaType("Throwable"));
|
method.addException(new FullyQualifiedJavaType("Throwable"));
|
||||||
|
|
||||||
|
method.addBodyLine("// clone new example");
|
||||||
|
method.addBodyLine("example = example.cloneExample();");
|
||||||
method.addBodyLine("for (" + exampleClassName + ".Criteria criteria : example.getOredCriteria()) {");
|
method.addBodyLine("for (" + exampleClassName + ".Criteria criteria : example.getOredCriteria()) {");
|
||||||
method.addBodyLine("criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(0);");
|
method.addBodyLine("criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(0);");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
@@ -1228,7 +1242,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
method.addBodyLine("exampleString += \"\\n\\t|-> limit: \" + example.getLimitString();");
|
method.addBodyLine("exampleString += \"\\n\\t|-> limit: \" + example.getLimitString();");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
method.addBodyLine("LOGGER." + getSlowQueryLoggerLevel(introspectedTable) + "(\"[SQL] select " + modelClassName + " valid list primary key long time\" +");
|
method.addBodyLine("LOGGER." + getSlowQueryLoggerLevel(introspectedTable) + "(\"[SQL] select " + modelClassName + " valid list primary key long time\" +");
|
||||||
method.addBodyLine(" \"\\n\\t|-> use time:\" + findPrimaryKeyTime + \"ms\" +");
|
method.addBodyLine(" \"\\n\\t|-> use time: \" + findPrimaryKeyTime + \"ms\" +");
|
||||||
method.addBodyLine(" exampleString +");
|
method.addBodyLine(" exampleString +");
|
||||||
method.addBodyLine(" \"\\n\\t|-----------------------------------\"");
|
method.addBodyLine(" \"\\n\\t|-----------------------------------\"");
|
||||||
method.addBodyLine(");");
|
method.addBodyLine(");");
|
||||||
@@ -1263,7 +1277,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
method.addBodyLine("exampleString += \"\\n\\t|-> limit: \" + example.getLimitString();");
|
method.addBodyLine("exampleString += \"\\n\\t|-> limit: \" + example.getLimitString();");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
method.addBodyLine("LOGGER." + getSlowQueryLoggerLevel(introspectedTable) + "(\"[SQL] select " + modelClassName + " valid list long time\" +");
|
method.addBodyLine("LOGGER." + getSlowQueryLoggerLevel(introspectedTable) + "(\"[SQL] select " + modelClassName + " valid list long time\" +");
|
||||||
method.addBodyLine(" \"\\n\\t|-> use time:\" + useTime + \"ms\" +");
|
method.addBodyLine(" \"\\n\\t|-> use time: \" + useTime + \"ms\" +");
|
||||||
method.addBodyLine(" exampleString +");
|
method.addBodyLine(" exampleString +");
|
||||||
method.addBodyLine(" \"\\n\\t|-----------------------------------\"");
|
method.addBodyLine(" \"\\n\\t|-----------------------------------\"");
|
||||||
method.addBodyLine(");");
|
method.addBodyLine(");");
|
||||||
@@ -1281,6 +1295,8 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
method.addParameter(new Parameter(new FullyQualifiedJavaType(exampleClassName), "example"));
|
method.addParameter(new Parameter(new FullyQualifiedJavaType(exampleClassName), "example"));
|
||||||
method.addException(new FullyQualifiedJavaType("Throwable"));
|
method.addException(new FullyQualifiedJavaType("Throwable"));
|
||||||
|
|
||||||
|
method.addBodyLine("// clone new example");
|
||||||
|
method.addBodyLine("example = example.cloneExample();");
|
||||||
method.addBodyLine("for (" + exampleClassName + ".Criteria criteria : example.getOredCriteria()) {");
|
method.addBodyLine("for (" + exampleClassName + ".Criteria criteria : example.getOredCriteria()) {");
|
||||||
method.addBodyLine("criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(1);");
|
method.addBodyLine("criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(1);");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
@@ -1305,7 +1321,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
method.addBodyLine("exampleString += \"\\n\\t|-> limit: \" + example.getLimitString();");
|
method.addBodyLine("exampleString += \"\\n\\t|-> limit: \" + example.getLimitString();");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
method.addBodyLine("LOGGER." + getSlowQueryLoggerLevel(introspectedTable) + "(\"[SQL] select " + modelClassName + " trash list primary key long time\" +");
|
method.addBodyLine("LOGGER." + getSlowQueryLoggerLevel(introspectedTable) + "(\"[SQL] select " + modelClassName + " trash list primary key long time\" +");
|
||||||
method.addBodyLine(" \"\\n\\t|-> use time:\" + findPrimaryKeyTime + \"ms\" +");
|
method.addBodyLine(" \"\\n\\t|-> use time: \" + findPrimaryKeyTime + \"ms\" +");
|
||||||
method.addBodyLine(" exampleString +");
|
method.addBodyLine(" exampleString +");
|
||||||
method.addBodyLine(" \"\\n\\t|-----------------------------------\"");
|
method.addBodyLine(" \"\\n\\t|-----------------------------------\"");
|
||||||
method.addBodyLine(");");
|
method.addBodyLine(");");
|
||||||
@@ -1340,7 +1356,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
method.addBodyLine("exampleString += \"\\n\\t|-> limit: \" + example.getLimitString();");
|
method.addBodyLine("exampleString += \"\\n\\t|-> limit: \" + example.getLimitString();");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
method.addBodyLine("LOGGER." + getSlowQueryLoggerLevel(introspectedTable) + "(\"[SQL] select " + modelClassName + " trash list long time\" +");
|
method.addBodyLine("LOGGER." + getSlowQueryLoggerLevel(introspectedTable) + "(\"[SQL] select " + modelClassName + " trash list long time\" +");
|
||||||
method.addBodyLine(" \"\\n\\t|-> use time:\" + useTime + \"ms\" +");
|
method.addBodyLine(" \"\\n\\t|-> use time: \" + useTime + \"ms\" +");
|
||||||
method.addBodyLine(" exampleString +");
|
method.addBodyLine(" exampleString +");
|
||||||
method.addBodyLine(" \"\\n\\t|-----------------------------------\"");
|
method.addBodyLine(" \"\\n\\t|-----------------------------------\"");
|
||||||
method.addBodyLine(");");
|
method.addBodyLine(");");
|
||||||
@@ -1357,6 +1373,8 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
method.addParameter(new Parameter(new FullyQualifiedJavaType(exampleClassName), "example"));
|
method.addParameter(new Parameter(new FullyQualifiedJavaType(exampleClassName), "example"));
|
||||||
method.addException(new FullyQualifiedJavaType("Throwable"));
|
method.addException(new FullyQualifiedJavaType("Throwable"));
|
||||||
|
|
||||||
|
method.addBodyLine("// clone new example");
|
||||||
|
method.addBodyLine("example = example.cloneExample();");
|
||||||
method.addBodyLine("for (" + exampleClassName + ".Criteria criteria : example.getOredCriteria()) {");
|
method.addBodyLine("for (" + exampleClassName + ".Criteria criteria : example.getOredCriteria()) {");
|
||||||
method.addBodyLine("criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(0);");
|
method.addBodyLine("criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(0);");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
@@ -1372,7 +1390,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
method.addBodyLine("exampleString += \"\\n\\t|-> order by: \" + example.getOrderByClause();");
|
method.addBodyLine("exampleString += \"\\n\\t|-> order by: \" + example.getOrderByClause();");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
method.addBodyLine("LOGGER." + getSlowQueryLoggerLevel(introspectedTable) + "(\"[SQL] select " + modelClassName + " valid count long time\" +");
|
method.addBodyLine("LOGGER." + getSlowQueryLoggerLevel(introspectedTable) + "(\"[SQL] select " + modelClassName + " valid count long time\" +");
|
||||||
method.addBodyLine(" \"\\n\\t|-> use time:\" + useTime + \"ms\" +");
|
method.addBodyLine(" \"\\n\\t|-> use time: \" + useTime + \"ms\" +");
|
||||||
method.addBodyLine(" exampleString +");
|
method.addBodyLine(" exampleString +");
|
||||||
method.addBodyLine(" \"\\n\\t|-----------------------------------\"");
|
method.addBodyLine(" \"\\n\\t|-----------------------------------\"");
|
||||||
method.addBodyLine(");");
|
method.addBodyLine(");");
|
||||||
@@ -1407,6 +1425,8 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
method.addParameter(new Parameter(new FullyQualifiedJavaType(exampleClassName), "example"));
|
method.addParameter(new Parameter(new FullyQualifiedJavaType(exampleClassName), "example"));
|
||||||
method.addException(new FullyQualifiedJavaType("Throwable"));
|
method.addException(new FullyQualifiedJavaType("Throwable"));
|
||||||
|
|
||||||
|
method.addBodyLine("// clone new example");
|
||||||
|
method.addBodyLine("example = example.cloneExample();");
|
||||||
method.addBodyLine("for (" + exampleClassName + ".Criteria criteria : example.getOredCriteria()) {");
|
method.addBodyLine("for (" + exampleClassName + ".Criteria criteria : example.getOredCriteria()) {");
|
||||||
method.addBodyLine("criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(1);");
|
method.addBodyLine("criteria.andIsDeleteEqualTo(0).andIsHiddenEqualTo(1);");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
@@ -1422,7 +1442,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
method.addBodyLine("exampleString += \"\\n\\t|-> order by: \" + example.getOrderByClause();");
|
method.addBodyLine("exampleString += \"\\n\\t|-> order by: \" + example.getOrderByClause();");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
method.addBodyLine("LOGGER." + getSlowQueryLoggerLevel(introspectedTable) + "(\"[SQL] select " + modelClassName + " trash count long time\" +");
|
method.addBodyLine("LOGGER." + getSlowQueryLoggerLevel(introspectedTable) + "(\"[SQL] select " + modelClassName + " trash count long time\" +");
|
||||||
method.addBodyLine(" \"\\n\\t|-> use time:\" + useTime + \"ms\" +");
|
method.addBodyLine(" \"\\n\\t|-> use time: \" + useTime + \"ms\" +");
|
||||||
method.addBodyLine(" exampleString +");
|
method.addBodyLine(" exampleString +");
|
||||||
method.addBodyLine(" \"\\n\\t|-----------------------------------\"");
|
method.addBodyLine(" \"\\n\\t|-----------------------------------\"");
|
||||||
method.addBodyLine(");");
|
method.addBodyLine(");");
|
||||||
|
|||||||
@@ -50,7 +50,7 @@ public class TapeRepoviewGeneratorPlugin extends PluginAdapter {
|
|||||||
slowQueryLoggerTime = stringConfig("slowQueryLoggerTime", slowQueryLoggerTime);
|
slowQueryLoggerTime = stringConfig("slowQueryLoggerTime", slowQueryLoggerTime);
|
||||||
slowQueryLoggerLevel = stringConfig("slowQueryLoggerLevel", slowQueryLoggerLevel);
|
slowQueryLoggerLevel = stringConfig("slowQueryLoggerLevel", slowQueryLoggerLevel);
|
||||||
facadeViewRepositoryPackage = stringConfig("facadeViewRepositoryPackage", facadeViewRepositoryPackage);
|
facadeViewRepositoryPackage = stringConfig("facadeViewRepositoryPackage", facadeViewRepositoryPackage);
|
||||||
domainViewRepositoryPackage = stringConfig("facadeViewRepositoryPackage", domainViewRepositoryPackage);
|
domainViewRepositoryPackage = stringConfig("domainViewRepositoryPackage", domainViewRepositoryPackage);
|
||||||
mapperPackage = stringConfig("mapperPackage", mapperPackage);
|
mapperPackage = stringConfig("mapperPackage", mapperPackage);
|
||||||
modelPackage = stringConfig("modelPackage", modelPackage);
|
modelPackage = stringConfig("modelPackage", modelPackage);
|
||||||
}
|
}
|
||||||
@@ -280,6 +280,8 @@ public class TapeRepoviewGeneratorPlugin extends PluginAdapter {
|
|||||||
method.addException(new FullyQualifiedJavaType("Throwable"));
|
method.addException(new FullyQualifiedJavaType("Throwable"));
|
||||||
|
|
||||||
// 方法体
|
// 方法体
|
||||||
|
method.addBodyLine("// clone new example");
|
||||||
|
method.addBodyLine("example = example.cloneExample();");
|
||||||
method.addBodyLine("example.usePage(1, 1);");
|
method.addBodyLine("example.usePage(1, 1);");
|
||||||
method.addBodyLine("List<" + modelClassName + "> dataList = getList(example);");
|
method.addBodyLine("List<" + modelClassName + "> dataList = getList(example);");
|
||||||
method.addBodyLine("if (dataList != null && !dataList.isEmpty()) {");
|
method.addBodyLine("if (dataList != null && !dataList.isEmpty()) {");
|
||||||
@@ -301,6 +303,9 @@ public class TapeRepoviewGeneratorPlugin extends PluginAdapter {
|
|||||||
// 参数名匹配示例(首字母小写)
|
// 参数名匹配示例(首字母小写)
|
||||||
method.addParameter(new Parameter(new FullyQualifiedJavaType(exampleClassName), "example"));
|
method.addParameter(new Parameter(new FullyQualifiedJavaType(exampleClassName), "example"));
|
||||||
method.addException(new FullyQualifiedJavaType("Throwable"));
|
method.addException(new FullyQualifiedJavaType("Throwable"));
|
||||||
|
|
||||||
|
method.addBodyLine("// clone new example");
|
||||||
|
method.addBodyLine("example = example.cloneExample();");
|
||||||
method.addBodyLine("List<" + modelClassName + "> result = null;");
|
method.addBodyLine("List<" + modelClassName + "> result = null;");
|
||||||
method.addBodyLine("long startTime = new Date().getTime();");
|
method.addBodyLine("long startTime = new Date().getTime();");
|
||||||
if (hasBLOBColumns) {
|
if (hasBLOBColumns) {
|
||||||
@@ -325,7 +330,7 @@ public class TapeRepoviewGeneratorPlugin extends PluginAdapter {
|
|||||||
method.addBodyLine("exampleString += \"\\n\\t|-> limit: \" + example.getLimitString();");
|
method.addBodyLine("exampleString += \"\\n\\t|-> limit: \" + example.getLimitString();");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
method.addBodyLine("LOGGER." + getSlowQueryLoggerLevel(introspectedTable) + "(\"[SQL] select " + modelClassName + " view list long time\" +");
|
method.addBodyLine("LOGGER." + getSlowQueryLoggerLevel(introspectedTable) + "(\"[SQL] select " + modelClassName + " view list long time\" +");
|
||||||
method.addBodyLine(" \"\\n\\t|-> use time:\" + useTime + \"ms\" +");
|
method.addBodyLine(" \"\\n\\t|-> use time: \" + useTime + \"ms\" +");
|
||||||
method.addBodyLine(" exampleString +");
|
method.addBodyLine(" exampleString +");
|
||||||
method.addBodyLine(" \"\\n\\t|-----------------------------------\"");
|
method.addBodyLine(" \"\\n\\t|-----------------------------------\"");
|
||||||
method.addBodyLine(");");
|
method.addBodyLine(");");
|
||||||
@@ -347,6 +352,8 @@ public class TapeRepoviewGeneratorPlugin extends PluginAdapter {
|
|||||||
method.addException(new FullyQualifiedJavaType("Throwable"));
|
method.addException(new FullyQualifiedJavaType("Throwable"));
|
||||||
|
|
||||||
// 方法体
|
// 方法体
|
||||||
|
method.addBodyLine("// clone new example");
|
||||||
|
method.addBodyLine("example = example.cloneExample();");
|
||||||
method.addBodyLine("long startTime = new Date().getTime();");
|
method.addBodyLine("long startTime = new Date().getTime();");
|
||||||
method.addBodyLine("long count = " + mapperFieldName + ".countByExample(example);");
|
method.addBodyLine("long count = " + mapperFieldName + ".countByExample(example);");
|
||||||
method.addBodyLine("long useTime = new Date().getTime() - startTime;");
|
method.addBodyLine("long useTime = new Date().getTime() - startTime;");
|
||||||
@@ -359,7 +366,7 @@ public class TapeRepoviewGeneratorPlugin extends PluginAdapter {
|
|||||||
method.addBodyLine("exampleString += \"\\n\\t|-> order by: \" + example.getOrderByClause();");
|
method.addBodyLine("exampleString += \"\\n\\t|-> order by: \" + example.getOrderByClause();");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
method.addBodyLine("LOGGER." + getSlowQueryLoggerLevel(introspectedTable) + "(\"[SQL] select " + modelClassName + " view count long time\" +");
|
method.addBodyLine("LOGGER." + getSlowQueryLoggerLevel(introspectedTable) + "(\"[SQL] select " + modelClassName + " view count long time\" +");
|
||||||
method.addBodyLine(" \"\\n\\t|-> use time:\" + useTime + \"ms\" +");
|
method.addBodyLine(" \"\\n\\t|-> use time: \" + useTime + \"ms\" +");
|
||||||
method.addBodyLine(" exampleString +");
|
method.addBodyLine(" exampleString +");
|
||||||
method.addBodyLine(" \"\\n\\t|-----------------------------------\"");
|
method.addBodyLine(" \"\\n\\t|-----------------------------------\"");
|
||||||
method.addBodyLine(");");
|
method.addBodyLine(");");
|
||||||
|
|||||||
Reference in New Issue
Block a user