日志和变更记录,使用table name
This commit is contained in:
Binary file not shown.
@@ -394,6 +394,8 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
IntrospectedTable introspectedTable,
|
IntrospectedTable introspectedTable,
|
||||||
boolean hasBLOBColumns) {
|
boolean hasBLOBColumns) {
|
||||||
|
|
||||||
|
String tableName = introspectedTable.getFullyQualifiedTable().getIntrospectedTableName();
|
||||||
|
|
||||||
TopLevelClass implClass = new TopLevelClass(domainRepositoryPackage + "." + implClassName);
|
TopLevelClass implClass = new TopLevelClass(domainRepositoryPackage + "." + implClassName);
|
||||||
implClass.setVisibility(JavaVisibility.PUBLIC);
|
implClass.setVisibility(JavaVisibility.PUBLIC);
|
||||||
implClass.addAnnotation("@SuppressWarnings(\"DuplicatedCode\")");
|
implClass.addAnnotation("@SuppressWarnings(\"DuplicatedCode\")");
|
||||||
@@ -419,27 +421,27 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
implClass.addField(mapperField);
|
implClass.addField(mapperField);
|
||||||
|
|
||||||
// 原有方法生成逻辑(无修改)
|
// 原有方法生成逻辑(无修改)
|
||||||
generateFindAnyByIdMethod(implClass, modelClassName, mapperFieldName, exampleClassName, hasBLOBColumns);
|
generateFindAnyByIdMethod(implClass, tableName, modelClassName, mapperFieldName, exampleClassName, hasBLOBColumns);
|
||||||
generateFindValidByIdMethod(implClass, modelClassName, mapperFieldName, exampleClassName, hasBLOBColumns);
|
generateFindValidByIdMethod(implClass, tableName, modelClassName, mapperFieldName, exampleClassName, hasBLOBColumns);
|
||||||
generateFindTrashByIdMethod(implClass, modelClassName, mapperFieldName, exampleClassName, hasBLOBColumns);
|
generateFindTrashByIdMethod(implClass, tableName, modelClassName, mapperFieldName, exampleClassName, hasBLOBColumns);
|
||||||
generateInsertMethod(implClass, introspectedTable, modelClassName, mapperFieldName);
|
generateInsertMethod(implClass, tableName, introspectedTable, modelClassName, mapperFieldName);
|
||||||
generateBatchInsertMethod(implClass, introspectedTable, modelClassName, mapperFieldName);
|
generateBatchInsertMethod(implClass, tableName, introspectedTable, modelClassName, mapperFieldName);
|
||||||
generateUpdateMethod(implClass, introspectedTable, modelClassName, exampleClassName, mapperFieldName, hasBLOBColumns);
|
generateUpdateMethod(implClass, tableName, introspectedTable, modelClassName, exampleClassName, mapperFieldName, hasBLOBColumns);
|
||||||
generateUpdateByExampleSelectiveMethod(implClass, introspectedTable, modelClassName, exampleClassName, mapperFieldName, hasBLOBColumns);
|
generateUpdateByExampleSelectiveMethod(implClass, tableName, introspectedTable, modelClassName, exampleClassName, mapperFieldName, hasBLOBColumns);
|
||||||
generateDeleteByIdMethod(implClass, introspectedTable, modelClassName, exampleClassName, mapperFieldName);
|
generateDeleteByIdMethod(implClass, tableName, introspectedTable, modelClassName, exampleClassName, mapperFieldName);
|
||||||
generateDeleteAllMethod(implClass, introspectedTable, modelClassName, exampleClassName, mapperFieldName);
|
generateDeleteAllMethod(implClass, tableName, introspectedTable, modelClassName, exampleClassName, mapperFieldName);
|
||||||
generateTrashByIdMethod(implClass, introspectedTable, modelClassName, exampleClassName, mapperFieldName);
|
generateTrashByIdMethod(implClass, tableName, introspectedTable, modelClassName, exampleClassName, mapperFieldName);
|
||||||
generateTrashAllMethod(implClass, introspectedTable, modelClassName, exampleClassName, mapperFieldName);
|
generateTrashAllMethod(implClass, tableName, introspectedTable, modelClassName, exampleClassName, mapperFieldName);
|
||||||
generateRecoverByIdMethod(implClass, introspectedTable, modelClassName, exampleClassName, mapperFieldName);
|
generateRecoverByIdMethod(implClass, tableName, introspectedTable, modelClassName, exampleClassName, mapperFieldName);
|
||||||
generateRecoverAllMethod(implClass, introspectedTable, modelClassName, exampleClassName, mapperFieldName);
|
generateRecoverAllMethod(implClass, tableName, introspectedTable, modelClassName, exampleClassName, mapperFieldName);
|
||||||
generateFindValidOneMethod(implClass, modelClassName, exampleClassName);
|
generateFindValidOneMethod(implClass, tableName, modelClassName, exampleClassName);
|
||||||
generateFindTrashOneMethod(implClass, modelClassName, exampleClassName);
|
generateFindTrashOneMethod(implClass, tableName, modelClassName, exampleClassName);
|
||||||
generateGetValidListMethod(implClass, introspectedTable, modelClassName, exampleClassName, mapperFieldName, hasBLOBColumns);
|
generateGetValidListMethod(implClass, tableName, introspectedTable, modelClassName, exampleClassName, mapperFieldName, hasBLOBColumns);
|
||||||
generateGetTrashListMethod(implClass, introspectedTable, modelClassName, exampleClassName, mapperFieldName, hasBLOBColumns);
|
generateGetTrashListMethod(implClass, tableName, introspectedTable, modelClassName, exampleClassName, mapperFieldName, hasBLOBColumns);
|
||||||
generateCountByValidMethod(implClass, introspectedTable, modelClassName, exampleClassName, mapperFieldName);
|
generateCountByValidMethod(implClass, tableName, introspectedTable, modelClassName, exampleClassName, mapperFieldName);
|
||||||
generateCountByValidWithPageMethod(implClass, modelClassName, exampleClassName, mapperFieldName);
|
generateCountByValidWithPageMethod(implClass, tableName, modelClassName, exampleClassName, mapperFieldName);
|
||||||
generateCountByTrashMethod(implClass, introspectedTable, modelClassName, exampleClassName, mapperFieldName);
|
generateCountByTrashMethod(implClass, tableName, introspectedTable, modelClassName, exampleClassName, mapperFieldName);
|
||||||
generateCountByTrashWithPageMethod(implClass, modelClassName, exampleClassName, mapperFieldName);
|
generateCountByTrashWithPageMethod(implClass, tableName, modelClassName, exampleClassName, mapperFieldName);
|
||||||
|
|
||||||
return implClass;
|
return implClass;
|
||||||
}
|
}
|
||||||
@@ -503,7 +505,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
implClass.addImportedType(new FullyQualifiedJavaType("java.util.*"));
|
implClass.addImportedType(new FullyQualifiedJavaType("java.util.*"));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateFindAnyByIdMethod(TopLevelClass implClass, String modelClassName, String mapperFieldName, String exampleClassName, boolean hasBLOBColumns) {
|
private void generateFindAnyByIdMethod(TopLevelClass implClass, String tableName, String modelClassName, String mapperFieldName, String exampleClassName, boolean hasBLOBColumns) {
|
||||||
Method method = new Method("findAnyById");
|
Method method = new Method("findAnyById");
|
||||||
method.addAnnotation("@Override");
|
method.addAnnotation("@Override");
|
||||||
method.setVisibility(JavaVisibility.PUBLIC);
|
method.setVisibility(JavaVisibility.PUBLIC);
|
||||||
@@ -528,7 +530,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
implClass.addMethod(method);
|
implClass.addMethod(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateFindValidByIdMethod(TopLevelClass implClass, String modelClassName, String mapperFieldName, String exampleClassName, boolean hasBLOBColumns) {
|
private void generateFindValidByIdMethod(TopLevelClass implClass, String tableName, String modelClassName, String mapperFieldName, String exampleClassName, boolean hasBLOBColumns) {
|
||||||
Method method = new Method("findValidById");
|
Method method = new Method("findValidById");
|
||||||
method.addAnnotation("@Override");
|
method.addAnnotation("@Override");
|
||||||
method.setVisibility(JavaVisibility.PUBLIC);
|
method.setVisibility(JavaVisibility.PUBLIC);
|
||||||
@@ -554,7 +556,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
implClass.addMethod(method);
|
implClass.addMethod(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateFindTrashByIdMethod(TopLevelClass implClass, String modelClassName, String mapperFieldName, String exampleClassName, boolean hasBLOBColumns) {
|
private void generateFindTrashByIdMethod(TopLevelClass implClass, String tableName, String modelClassName, String mapperFieldName, String exampleClassName, boolean hasBLOBColumns) {
|
||||||
Method method = new Method("findTrashById");
|
Method method = new Method("findTrashById");
|
||||||
method.addAnnotation("@Override");
|
method.addAnnotation("@Override");
|
||||||
method.setVisibility(JavaVisibility.PUBLIC);
|
method.setVisibility(JavaVisibility.PUBLIC);
|
||||||
@@ -580,7 +582,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
implClass.addMethod(method);
|
implClass.addMethod(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateInsertMethod(TopLevelClass implClass, IntrospectedTable introspectedTable, String modelClassName, String mapperFieldName) {
|
private void generateInsertMethod(TopLevelClass implClass, String tableName, IntrospectedTable introspectedTable, String modelClassName, String mapperFieldName) {
|
||||||
Method method = new Method("insert");
|
Method method = new Method("insert");
|
||||||
method.addAnnotation("@Override");
|
method.addAnnotation("@Override");
|
||||||
method.setVisibility(JavaVisibility.PUBLIC);
|
method.setVisibility(JavaVisibility.PUBLIC);
|
||||||
@@ -621,18 +623,14 @@ 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|-> table name: " + tableName + "\" +");
|
||||||
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("}");
|
||||||
method.addBodyLine("if (count > 0) {");
|
method.addBodyLine("if (count > 0) {");
|
||||||
method.addBodyLine("// optimistic locking with data version and guid");
|
|
||||||
method.addBodyLine("record.setGuid(aDo.getGuid());");
|
|
||||||
method.addBodyLine("record.setDataVersion(aDo.getDataVersion());");
|
|
||||||
method.addBodyLine("record.setCreateTime(aDo.getCreateTime());");
|
|
||||||
method.addBodyLine("record.setUpdateTime(aDo.getUpdateTime());");
|
|
||||||
if (isChangeLogEnable(introspectedTable)) {
|
if (isChangeLogEnable(introspectedTable)) {
|
||||||
method.addBodyLine(changeLogContextClassName + ".addLog(\"" + modelClassName + "\",");
|
method.addBodyLine(changeLogContextClassName + ".addLog(\"" + tableName + "\",");
|
||||||
method.addBodyLine(" \"insert\", aDo.getGuid(), new HashMap<>());");
|
method.addBodyLine(" \"insert\", aDo.getGuid(), new HashMap<>());");
|
||||||
}
|
}
|
||||||
method.addBodyLine("return aDo;");
|
method.addBodyLine("return aDo;");
|
||||||
@@ -641,7 +639,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
implClass.addMethod(method);
|
implClass.addMethod(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateBatchInsertMethod(TopLevelClass implClass, IntrospectedTable introspectedTable, String modelClassName, String mapperFieldName) {
|
private void generateBatchInsertMethod(TopLevelClass implClass, String tableName, IntrospectedTable introspectedTable, String modelClassName, String mapperFieldName) {
|
||||||
Method method = new Method("batchInsert");
|
Method method = new Method("batchInsert");
|
||||||
method.addAnnotation("@Override");
|
method.addAnnotation("@Override");
|
||||||
method.setVisibility(JavaVisibility.PUBLIC);
|
method.setVisibility(JavaVisibility.PUBLIC);
|
||||||
@@ -688,6 +686,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|-> table name: " + tableName + "\" +");
|
||||||
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(");");
|
||||||
@@ -695,7 +694,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
method.addBodyLine("if (count == batch.size()) {");
|
method.addBodyLine("if (count == batch.size()) {");
|
||||||
if (isChangeLogEnable(introspectedTable)) {
|
if (isChangeLogEnable(introspectedTable)) {
|
||||||
method.addBodyLine("for (" + modelClassName + " aDo : batch) {");
|
method.addBodyLine("for (" + modelClassName + " aDo : batch) {");
|
||||||
method.addBodyLine(changeLogContextClassName + ".addLog(\"" + modelClassName + "\",");
|
method.addBodyLine(changeLogContextClassName + ".addLog(\"" + tableName + "\",");
|
||||||
method.addBodyLine(" \"batchInsert\", aDo.getGuid(), new HashMap<>());");
|
method.addBodyLine(" \"batchInsert\", aDo.getGuid(), new HashMap<>());");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
}
|
}
|
||||||
@@ -706,7 +705,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
implClass.addMethod(method);
|
implClass.addMethod(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateUpdateMethod(TopLevelClass implClass, IntrospectedTable introspectedTable, String modelClassName, String exampleClassName,
|
private void generateUpdateMethod(TopLevelClass implClass, String tableName, IntrospectedTable introspectedTable, String modelClassName, String exampleClassName,
|
||||||
String mapperFieldName, boolean hasBLOBColumns) {
|
String mapperFieldName, boolean hasBLOBColumns) {
|
||||||
Method method = new Method("update");
|
Method method = new Method("update");
|
||||||
method.addAnnotation("@Override");
|
method.addAnnotation("@Override");
|
||||||
@@ -766,13 +765,14 @@ 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|-> table name: " + tableName + "\" +");
|
||||||
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("}");
|
||||||
if (isChangeLogEnable(introspectedTable)) {
|
if (isChangeLogEnable(introspectedTable)) {
|
||||||
method.addBodyLine("if (update > 0 && !changeDiff.isEmpty()) {");
|
method.addBodyLine("if (update > 0 && !changeDiff.isEmpty()) {");
|
||||||
method.addBodyLine(changeLogContextClassName + ".addLog(\"" + modelClassName + "\",");
|
method.addBodyLine(changeLogContextClassName + ".addLog(\"" + tableName + "\",");
|
||||||
method.addBodyLine(" \"update\", aDo.getGuid(), changeDiff);");
|
method.addBodyLine(" \"update\", aDo.getGuid(), changeDiff);");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
}
|
}
|
||||||
@@ -780,7 +780,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
implClass.addMethod(method);
|
implClass.addMethod(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateUpdateByExampleSelectiveMethod(TopLevelClass implClass, IntrospectedTable introspectedTable, String modelClassName, String exampleClassName,
|
private void generateUpdateByExampleSelectiveMethod(TopLevelClass implClass, String tableName, IntrospectedTable introspectedTable, String modelClassName, String exampleClassName,
|
||||||
String mapperFieldName, boolean hasBLOBColumns) {
|
String mapperFieldName, boolean hasBLOBColumns) {
|
||||||
Method method = new Method("updateByExampleSelective");
|
Method method = new Method("updateByExampleSelective");
|
||||||
method.addAnnotation("@Override");
|
method.addAnnotation("@Override");
|
||||||
@@ -847,6 +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|-> table name: " + tableName + "\" +");
|
||||||
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|-----------------------------------\"");
|
||||||
@@ -856,7 +857,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
method.addBodyLine("if (update > 0) {");
|
method.addBodyLine("if (update > 0) {");
|
||||||
method.addBodyLine("for (Map.Entry<Long, Map<String, Object[]>> diffEntry : diffGroup.entrySet()) {");
|
method.addBodyLine("for (Map.Entry<Long, Map<String, Object[]>> diffEntry : diffGroup.entrySet()) {");
|
||||||
method.addBodyLine("if (diffEntry.getValue() != null && !diffEntry.getValue().isEmpty()) {");
|
method.addBodyLine("if (diffEntry.getValue() != null && !diffEntry.getValue().isEmpty()) {");
|
||||||
method.addBodyLine(changeLogContextClassName + ".addLog(\"" + modelClassName + "\",");
|
method.addBodyLine(changeLogContextClassName + ".addLog(\"" + tableName + "\",");
|
||||||
method.addBodyLine(" \"updateByExampleSelective\", diffEntry.getKey(), diffEntry.getValue());");
|
method.addBodyLine(" \"updateByExampleSelective\", diffEntry.getKey(), diffEntry.getValue());");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
@@ -866,7 +867,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
implClass.addMethod(method);
|
implClass.addMethod(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateDeleteByIdMethod(TopLevelClass implClass, IntrospectedTable introspectedTable, String modelClassName, String exampleClassName, String mapperFieldName) {
|
private void generateDeleteByIdMethod(TopLevelClass implClass, String tableName, IntrospectedTable introspectedTable, String modelClassName, String exampleClassName, String mapperFieldName) {
|
||||||
Method method = new Method("deleteById");
|
Method method = new Method("deleteById");
|
||||||
method.addAnnotation("@Override");
|
method.addAnnotation("@Override");
|
||||||
method.setVisibility(JavaVisibility.PUBLIC);
|
method.setVisibility(JavaVisibility.PUBLIC);
|
||||||
@@ -901,13 +902,14 @@ 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|-> table name: " + tableName + "\" +");
|
||||||
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("}");
|
||||||
if (isChangeLogEnable(introspectedTable)) {
|
if (isChangeLogEnable(introspectedTable)) {
|
||||||
method.addBodyLine("if (update > 0) {");
|
method.addBodyLine("if (update > 0) {");
|
||||||
method.addBodyLine(changeLogContextClassName + ".addLog(\"" + modelClassName + "\",");
|
method.addBodyLine(changeLogContextClassName + ".addLog(\"" + tableName + "\",");
|
||||||
method.addBodyLine(" \"deleteById\", aDo.getGuid(), new HashMap<>());");
|
method.addBodyLine(" \"deleteById\", aDo.getGuid(), new HashMap<>());");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
}
|
}
|
||||||
@@ -915,7 +917,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
implClass.addMethod(method);
|
implClass.addMethod(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateTrashByIdMethod(TopLevelClass implClass, IntrospectedTable introspectedTable, String modelClassName, String exampleClassName, String mapperFieldName) {
|
private void generateTrashByIdMethod(TopLevelClass implClass, String tableName, IntrospectedTable introspectedTable, String modelClassName, String exampleClassName, String mapperFieldName) {
|
||||||
Method method = new Method("trashById");
|
Method method = new Method("trashById");
|
||||||
method.addAnnotation("@Override");
|
method.addAnnotation("@Override");
|
||||||
method.setVisibility(JavaVisibility.PUBLIC);
|
method.setVisibility(JavaVisibility.PUBLIC);
|
||||||
@@ -949,13 +951,14 @@ 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|-> table name: " + tableName + "\" +");
|
||||||
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("}");
|
||||||
if (isChangeLogEnable(introspectedTable)) {
|
if (isChangeLogEnable(introspectedTable)) {
|
||||||
method.addBodyLine("if (update > 0) {");
|
method.addBodyLine("if (update > 0) {");
|
||||||
method.addBodyLine(changeLogContextClassName + ".addLog(\"" + modelClassName + "\",");
|
method.addBodyLine(changeLogContextClassName + ".addLog(\"" + tableName + "\",");
|
||||||
method.addBodyLine(" \"trashById\", aDo.getGuid(), new HashMap<>());");
|
method.addBodyLine(" \"trashById\", aDo.getGuid(), new HashMap<>());");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
}
|
}
|
||||||
@@ -963,7 +966,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
implClass.addMethod(method);
|
implClass.addMethod(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateRecoverByIdMethod(TopLevelClass implClass, IntrospectedTable introspectedTable, String modelClassName, String exampleClassName, String mapperFieldName) {
|
private void generateRecoverByIdMethod(TopLevelClass implClass, String tableName, IntrospectedTable introspectedTable, String modelClassName, String exampleClassName, String mapperFieldName) {
|
||||||
Method method = new Method("recoverById");
|
Method method = new Method("recoverById");
|
||||||
method.addAnnotation("@Override");
|
method.addAnnotation("@Override");
|
||||||
method.setVisibility(JavaVisibility.PUBLIC);
|
method.setVisibility(JavaVisibility.PUBLIC);
|
||||||
@@ -999,13 +1002,14 @@ 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|-> table name: " + tableName + "\" +");
|
||||||
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("}");
|
||||||
if (isChangeLogEnable(introspectedTable)) {
|
if (isChangeLogEnable(introspectedTable)) {
|
||||||
method.addBodyLine("if (update > 0) {");
|
method.addBodyLine("if (update > 0) {");
|
||||||
method.addBodyLine(changeLogContextClassName + ".addLog(\"" + modelClassName + "\",");
|
method.addBodyLine(changeLogContextClassName + ".addLog(\"" + tableName + "\",");
|
||||||
method.addBodyLine(" \"recoverById\", aDo.getGuid(), new HashMap<>());");
|
method.addBodyLine(" \"recoverById\", aDo.getGuid(), new HashMap<>());");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
}
|
}
|
||||||
@@ -1013,7 +1017,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
implClass.addMethod(method);
|
implClass.addMethod(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateDeleteAllMethod(TopLevelClass implClass, IntrospectedTable introspectedTable, String modelClassName, String exampleClassName, String mapperFieldName) {
|
private void generateDeleteAllMethod(TopLevelClass implClass, String tableName, IntrospectedTable introspectedTable, String modelClassName, String exampleClassName, String mapperFieldName) {
|
||||||
Method method = new Method("deleteAll");
|
Method method = new Method("deleteAll");
|
||||||
method.addAnnotation("@Override");
|
method.addAnnotation("@Override");
|
||||||
method.setVisibility(JavaVisibility.PUBLIC);
|
method.setVisibility(JavaVisibility.PUBLIC);
|
||||||
@@ -1050,6 +1054,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|-> table name: " + tableName + "\" +");
|
||||||
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(");");
|
||||||
@@ -1057,7 +1062,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
if (isChangeLogEnable(introspectedTable)) {
|
if (isChangeLogEnable(introspectedTable)) {
|
||||||
method.addBodyLine("if (update > 0) {");
|
method.addBodyLine("if (update > 0) {");
|
||||||
method.addBodyLine("for (Long guid : guidList) {");
|
method.addBodyLine("for (Long guid : guidList) {");
|
||||||
method.addBodyLine(changeLogContextClassName + ".addLog(\"" + modelClassName + "\",");
|
method.addBodyLine(changeLogContextClassName + ".addLog(\"" + tableName + "\",");
|
||||||
method.addBodyLine(" \"deleteAll\", guid, new HashMap<>());");
|
method.addBodyLine(" \"deleteAll\", guid, new HashMap<>());");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
@@ -1066,7 +1071,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
implClass.addMethod(method);
|
implClass.addMethod(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateTrashAllMethod(TopLevelClass implClass, IntrospectedTable introspectedTable, String modelClassName, String exampleClassName, String mapperFieldName) {
|
private void generateTrashAllMethod(TopLevelClass implClass, String tableName, IntrospectedTable introspectedTable, String modelClassName, String exampleClassName, String mapperFieldName) {
|
||||||
Method method = new Method("trashAll");
|
Method method = new Method("trashAll");
|
||||||
method.addAnnotation("@Override");
|
method.addAnnotation("@Override");
|
||||||
method.setVisibility(JavaVisibility.PUBLIC);
|
method.setVisibility(JavaVisibility.PUBLIC);
|
||||||
@@ -1100,6 +1105,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|-> table name: " + tableName + "\" +");
|
||||||
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(");");
|
||||||
@@ -1107,7 +1113,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
if (isChangeLogEnable(introspectedTable)) {
|
if (isChangeLogEnable(introspectedTable)) {
|
||||||
method.addBodyLine("if (update > 0) {");
|
method.addBodyLine("if (update > 0) {");
|
||||||
method.addBodyLine("for (Long guid : guidList) {");
|
method.addBodyLine("for (Long guid : guidList) {");
|
||||||
method.addBodyLine(changeLogContextClassName + ".addLog(\"" + modelClassName + "\",");
|
method.addBodyLine(changeLogContextClassName + ".addLog(\"" + tableName + "\",");
|
||||||
method.addBodyLine(" \"trashAll\", guid, new HashMap<>());");
|
method.addBodyLine(" \"trashAll\", guid, new HashMap<>());");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
@@ -1116,7 +1122,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
implClass.addMethod(method);
|
implClass.addMethod(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateRecoverAllMethod(TopLevelClass implClass, IntrospectedTable introspectedTable, String modelClassName, String exampleClassName, String mapperFieldName) {
|
private void generateRecoverAllMethod(TopLevelClass implClass, String tableName, IntrospectedTable introspectedTable, String modelClassName, String exampleClassName, String mapperFieldName) {
|
||||||
Method method = new Method("recoverAll");
|
Method method = new Method("recoverAll");
|
||||||
method.addAnnotation("@Override");
|
method.addAnnotation("@Override");
|
||||||
method.setVisibility(JavaVisibility.PUBLIC);
|
method.setVisibility(JavaVisibility.PUBLIC);
|
||||||
@@ -1150,6 +1156,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|-> table name: " + tableName + "\" +");
|
||||||
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(");");
|
||||||
@@ -1157,7 +1164,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
if (isChangeLogEnable(introspectedTable)) {
|
if (isChangeLogEnable(introspectedTable)) {
|
||||||
method.addBodyLine("if (update > 0) {");
|
method.addBodyLine("if (update > 0) {");
|
||||||
method.addBodyLine("for (Long guid : guidList) {");
|
method.addBodyLine("for (Long guid : guidList) {");
|
||||||
method.addBodyLine(changeLogContextClassName + ".addLog(\"" + modelClassName + "\",");
|
method.addBodyLine(changeLogContextClassName + ".addLog(\"" + tableName + "\",");
|
||||||
method.addBodyLine(" \"recoverAll\", guid, new HashMap<>());");
|
method.addBodyLine(" \"recoverAll\", guid, new HashMap<>());");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
method.addBodyLine("}");
|
method.addBodyLine("}");
|
||||||
@@ -1167,7 +1174,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
implClass.addMethod(method);
|
implClass.addMethod(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateFindValidOneMethod(TopLevelClass implClass, String modelClassName, String exampleClassName) {
|
private void generateFindValidOneMethod(TopLevelClass implClass, String tableName, String modelClassName, String exampleClassName) {
|
||||||
Method method = new Method("findValidOne");
|
Method method = new Method("findValidOne");
|
||||||
method.addAnnotation("@Override");
|
method.addAnnotation("@Override");
|
||||||
method.setVisibility(JavaVisibility.PUBLIC);
|
method.setVisibility(JavaVisibility.PUBLIC);
|
||||||
@@ -1187,7 +1194,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
implClass.addMethod(method);
|
implClass.addMethod(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateFindTrashOneMethod(TopLevelClass implClass, String modelClassName, String exampleClassName) {
|
private void generateFindTrashOneMethod(TopLevelClass implClass, String tableName, String modelClassName, String exampleClassName) {
|
||||||
Method method = new Method("findTrashOne");
|
Method method = new Method("findTrashOne");
|
||||||
method.addAnnotation("@Override");
|
method.addAnnotation("@Override");
|
||||||
method.setVisibility(JavaVisibility.PUBLIC);
|
method.setVisibility(JavaVisibility.PUBLIC);
|
||||||
@@ -1207,7 +1214,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
implClass.addMethod(method);
|
implClass.addMethod(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateGetValidListMethod(TopLevelClass implClass, IntrospectedTable introspectedTable, String modelClassName, String exampleClassName,
|
private void generateGetValidListMethod(TopLevelClass implClass, String tableName, IntrospectedTable introspectedTable, String modelClassName, String exampleClassName,
|
||||||
String mapperFieldName, boolean hasBLOBColumns) {
|
String mapperFieldName, boolean hasBLOBColumns) {
|
||||||
Method method = new Method("getValidList");
|
Method method = new Method("getValidList");
|
||||||
method.addAnnotation("@Override");
|
method.addAnnotation("@Override");
|
||||||
@@ -1242,6 +1249,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|-> table name: " + tableName + "\" +");
|
||||||
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|-----------------------------------\"");
|
||||||
@@ -1277,6 +1285,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|-> table name: " + tableName + "\" +");
|
||||||
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|-----------------------------------\"");
|
||||||
@@ -1286,7 +1295,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
implClass.addMethod(method);
|
implClass.addMethod(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateGetTrashListMethod(TopLevelClass implClass, IntrospectedTable introspectedTable, String modelClassName, String exampleClassName,
|
private void generateGetTrashListMethod(TopLevelClass implClass, String tableName, IntrospectedTable introspectedTable, String modelClassName, String exampleClassName,
|
||||||
String mapperFieldName, boolean hasBLOBColumns) {
|
String mapperFieldName, boolean hasBLOBColumns) {
|
||||||
Method method = new Method("getTrashList");
|
Method method = new Method("getTrashList");
|
||||||
method.addAnnotation("@Override");
|
method.addAnnotation("@Override");
|
||||||
@@ -1321,6 +1330,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|-> table name: " + tableName + "\" +");
|
||||||
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|-----------------------------------\"");
|
||||||
@@ -1356,6 +1366,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|-> table name: " + tableName + "\" +");
|
||||||
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|-----------------------------------\"");
|
||||||
@@ -1365,7 +1376,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
implClass.addMethod(method);
|
implClass.addMethod(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateCountByValidMethod(TopLevelClass implClass, IntrospectedTable introspectedTable, String modelClassName, String exampleClassName, String mapperFieldName) {
|
private void generateCountByValidMethod(TopLevelClass implClass, String tableName, IntrospectedTable introspectedTable, String modelClassName, String exampleClassName, String mapperFieldName) {
|
||||||
Method method = new Method("countByValid");
|
Method method = new Method("countByValid");
|
||||||
method.addAnnotation("@Override");
|
method.addAnnotation("@Override");
|
||||||
method.setVisibility(JavaVisibility.PUBLIC);
|
method.setVisibility(JavaVisibility.PUBLIC);
|
||||||
@@ -1390,6 +1401,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|-> table name: " + tableName + "\" +");
|
||||||
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|-----------------------------------\"");
|
||||||
@@ -1400,7 +1412,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
implClass.addMethod(method);
|
implClass.addMethod(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateCountByValidWithPageMethod(TopLevelClass implClass, String modelClassName, String exampleClassName, String mapperFieldName) {
|
private void generateCountByValidWithPageMethod(TopLevelClass implClass, String tableName, String modelClassName, String exampleClassName, String mapperFieldName) {
|
||||||
Method method = new Method("countByValidWithPage");
|
Method method = new Method("countByValidWithPage");
|
||||||
method.addAnnotation("@Override");
|
method.addAnnotation("@Override");
|
||||||
method.setVisibility(JavaVisibility.PUBLIC);
|
method.setVisibility(JavaVisibility.PUBLIC);
|
||||||
@@ -1417,7 +1429,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
implClass.addMethod(method);
|
implClass.addMethod(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateCountByTrashMethod(TopLevelClass implClass, IntrospectedTable introspectedTable, String modelClassName, String exampleClassName, String mapperFieldName) {
|
private void generateCountByTrashMethod(TopLevelClass implClass, String tableName, IntrospectedTable introspectedTable, String modelClassName, String exampleClassName, String mapperFieldName) {
|
||||||
Method method = new Method("countByTrash");
|
Method method = new Method("countByTrash");
|
||||||
method.addAnnotation("@Override");
|
method.addAnnotation("@Override");
|
||||||
method.setVisibility(JavaVisibility.PUBLIC);
|
method.setVisibility(JavaVisibility.PUBLIC);
|
||||||
@@ -1442,6 +1454,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|-> table name: " + tableName + "\" +");
|
||||||
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|-----------------------------------\"");
|
||||||
@@ -1452,7 +1465,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
implClass.addMethod(method);
|
implClass.addMethod(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateCountByTrashWithPageMethod(TopLevelClass implClass, String modelClassName, String exampleClassName, String mapperFieldName) {
|
private void generateCountByTrashWithPageMethod(TopLevelClass implClass, String tableName, String modelClassName, String exampleClassName, String mapperFieldName) {
|
||||||
Method method = new Method("countByTrashWithPage");
|
Method method = new Method("countByTrashWithPage");
|
||||||
method.addAnnotation("@Override");
|
method.addAnnotation("@Override");
|
||||||
method.setVisibility(JavaVisibility.PUBLIC);
|
method.setVisibility(JavaVisibility.PUBLIC);
|
||||||
|
|||||||
@@ -212,6 +212,8 @@ public class TapeRepoviewGeneratorPlugin extends PluginAdapter {
|
|||||||
boolean hasBLOBColumns
|
boolean hasBLOBColumns
|
||||||
) {
|
) {
|
||||||
|
|
||||||
|
String tableName = introspectedTable.getFullyQualifiedTable().getIntrospectedTableName();
|
||||||
|
|
||||||
TopLevelClass implClass = new TopLevelClass(domainViewRepositoryPackage + "." + implClassName);
|
TopLevelClass implClass = new TopLevelClass(domainViewRepositoryPackage + "." + implClassName);
|
||||||
implClass.setVisibility(JavaVisibility.PUBLIC);
|
implClass.setVisibility(JavaVisibility.PUBLIC);
|
||||||
implClass.addAnnotation("@SuppressWarnings(\"DuplicatedCode\")");
|
implClass.addAnnotation("@SuppressWarnings(\"DuplicatedCode\")");
|
||||||
@@ -239,10 +241,10 @@ public class TapeRepoviewGeneratorPlugin extends PluginAdapter {
|
|||||||
mapperField.addAnnotation("@Resource");
|
mapperField.addAnnotation("@Resource");
|
||||||
implClass.addField(mapperField);
|
implClass.addField(mapperField);
|
||||||
|
|
||||||
generateFindOneMethod(implClass, modelClassName, exampleClassName);
|
generateFindOneMethod(implClass, tableName, modelClassName, exampleClassName);
|
||||||
generateGetListMethod(implClass, introspectedTable, modelClassName, exampleClassName, mapperFieldName, hasBLOBColumns);
|
generateGetListMethod(implClass, tableName, introspectedTable, modelClassName, exampleClassName, mapperFieldName, hasBLOBColumns);
|
||||||
generateCountMethod(implClass, introspectedTable, modelClassName, exampleClassName, mapperFieldName);
|
generateCountMethod(implClass, tableName, introspectedTable, modelClassName, exampleClassName, mapperFieldName);
|
||||||
generateCountWithPageMethod(implClass, exampleClassName);
|
generateCountWithPageMethod(implClass, tableName, exampleClassName);
|
||||||
|
|
||||||
return implClass;
|
return implClass;
|
||||||
}
|
}
|
||||||
@@ -270,7 +272,7 @@ public class TapeRepoviewGeneratorPlugin extends PluginAdapter {
|
|||||||
/**
|
/**
|
||||||
* 生成findOne方法
|
* 生成findOne方法
|
||||||
*/
|
*/
|
||||||
private void generateFindOneMethod(TopLevelClass implClass, String modelClassName, String exampleClassName) {
|
private void generateFindOneMethod(TopLevelClass implClass, String tableName, String modelClassName, String exampleClassName) {
|
||||||
Method method = new Method("findOne");
|
Method method = new Method("findOne");
|
||||||
method.addAnnotation("@Override");
|
method.addAnnotation("@Override");
|
||||||
method.setVisibility(JavaVisibility.PUBLIC);
|
method.setVisibility(JavaVisibility.PUBLIC);
|
||||||
@@ -295,7 +297,7 @@ public class TapeRepoviewGeneratorPlugin extends PluginAdapter {
|
|||||||
/**
|
/**
|
||||||
* 生成getList方法
|
* 生成getList方法
|
||||||
*/
|
*/
|
||||||
private void generateGetListMethod(TopLevelClass implClass, IntrospectedTable introspectedTable, String modelClassName, String exampleClassName, String mapperFieldName, boolean hasBLOBColumns) {
|
private void generateGetListMethod(TopLevelClass implClass, String tableName, IntrospectedTable introspectedTable, String modelClassName, String exampleClassName, String mapperFieldName, boolean hasBLOBColumns) {
|
||||||
Method method = new Method("getList");
|
Method method = new Method("getList");
|
||||||
method.addAnnotation("@Override");
|
method.addAnnotation("@Override");
|
||||||
method.setVisibility(JavaVisibility.PUBLIC);
|
method.setVisibility(JavaVisibility.PUBLIC);
|
||||||
@@ -330,6 +332,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|-> table name: " + tableName + "\" +");
|
||||||
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|-----------------------------------\"");
|
||||||
@@ -342,7 +345,7 @@ public class TapeRepoviewGeneratorPlugin extends PluginAdapter {
|
|||||||
/**
|
/**
|
||||||
* 生成count方法
|
* 生成count方法
|
||||||
*/
|
*/
|
||||||
private void generateCountMethod(TopLevelClass implClass, IntrospectedTable introspectedTable, String modelClassName, String exampleClassName, String mapperFieldName) {
|
private void generateCountMethod(TopLevelClass implClass, String tableName, IntrospectedTable introspectedTable, String modelClassName, String exampleClassName, String mapperFieldName) {
|
||||||
Method method = new Method("count");
|
Method method = new Method("count");
|
||||||
method.addAnnotation("@Override");
|
method.addAnnotation("@Override");
|
||||||
method.setVisibility(JavaVisibility.PUBLIC);
|
method.setVisibility(JavaVisibility.PUBLIC);
|
||||||
@@ -366,6 +369,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|-> table name: " + tableName + "\" +");
|
||||||
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|-----------------------------------\"");
|
||||||
@@ -379,7 +383,7 @@ public class TapeRepoviewGeneratorPlugin extends PluginAdapter {
|
|||||||
/**
|
/**
|
||||||
* 生成count方法
|
* 生成count方法
|
||||||
*/
|
*/
|
||||||
private void generateCountWithPageMethod(TopLevelClass implClass, String exampleClassName) {
|
private void generateCountWithPageMethod(TopLevelClass implClass, String tableName, String exampleClassName) {
|
||||||
Method method = new Method("countWithPage");
|
Method method = new Method("countWithPage");
|
||||||
method.addAnnotation("@Override");
|
method.addAnnotation("@Override");
|
||||||
method.setVisibility(JavaVisibility.PUBLIC);
|
method.setVisibility(JavaVisibility.PUBLIC);
|
||||||
|
|||||||
Reference in New Issue
Block a user