init commit
This commit is contained in:
Binary file not shown.
@@ -347,8 +347,8 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
|
|
||||||
// 原有方法生成逻辑(无修改)
|
// 原有方法生成逻辑(无修改)
|
||||||
generateFindAnyByIdMethod(implClass, modelClassName, mapperFieldName, exampleClassName);
|
generateFindAnyByIdMethod(implClass, modelClassName, mapperFieldName, exampleClassName);
|
||||||
generateFindValidByIdMethod(implClass, modelClassName, exampleClassName);
|
generateFindValidByIdMethod(implClass, modelClassName, mapperFieldName, exampleClassName);
|
||||||
generateFindTrashByIdMethod(implClass, modelClassName, exampleClassName);
|
generateFindTrashByIdMethod(implClass, modelClassName, mapperFieldName, exampleClassName);
|
||||||
generateInsertMethod(implClass, modelClassName, mapperFieldName, introspectedTable);
|
generateInsertMethod(implClass, modelClassName, mapperFieldName, introspectedTable);
|
||||||
generateUpdateMethod(implClass, modelClassName, exampleClassName, mapperFieldName, introspectedTable, hasBLOBColumns);
|
generateUpdateMethod(implClass, modelClassName, exampleClassName, mapperFieldName, introspectedTable, hasBLOBColumns);
|
||||||
generateDeleteByIdMethod(implClass, modelClassName, mapperFieldName);
|
generateDeleteByIdMethod(implClass, modelClassName, mapperFieldName);
|
||||||
@@ -509,6 +509,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
method.setReturnType(new FullyQualifiedJavaType(modelClassName));
|
method.setReturnType(new FullyQualifiedJavaType(modelClassName));
|
||||||
method.addParameter(new Parameter(new FullyQualifiedJavaType("long"), "id"));
|
method.addParameter(new Parameter(new FullyQualifiedJavaType("long"), "id"));
|
||||||
method.addException(new FullyQualifiedJavaType("Throwable"));
|
method.addException(new FullyQualifiedJavaType("Throwable"));
|
||||||
|
|
||||||
method.addBodyLine(modelClassName + " aDo = " + mapperFieldName + ".selectByPrimaryKey(id);");
|
method.addBodyLine(modelClassName + " aDo = " + mapperFieldName + ".selectByPrimaryKey(id);");
|
||||||
method.addBodyLine("if (aDo != null && aDo.getIsDelete() == 1) {");
|
method.addBodyLine("if (aDo != null && aDo.getIsDelete() == 1) {");
|
||||||
method.addBodyLine(" return null;");
|
method.addBodyLine(" return null;");
|
||||||
@@ -518,7 +519,7 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
implClass.addMethod(method);
|
implClass.addMethod(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateFindValidByIdMethod(TopLevelClass implClass, String modelClassName, String exampleClassName) {
|
private void generateFindValidByIdMethod(TopLevelClass implClass, String modelClassName, String mapperFieldName, String exampleClassName) {
|
||||||
Method method = new Method("findValidById");
|
Method method = new Method("findValidById");
|
||||||
method.addAnnotation("@Override");
|
method.addAnnotation("@Override");
|
||||||
method.setVisibility(JavaVisibility.PUBLIC);
|
method.setVisibility(JavaVisibility.PUBLIC);
|
||||||
@@ -526,14 +527,16 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
method.addParameter(new Parameter(new FullyQualifiedJavaType("long"), "id"));
|
method.addParameter(new Parameter(new FullyQualifiedJavaType("long"), "id"));
|
||||||
method.addException(new FullyQualifiedJavaType("Throwable"));
|
method.addException(new FullyQualifiedJavaType("Throwable"));
|
||||||
|
|
||||||
method.addBodyLine(exampleClassName + " doExample = new " + exampleClassName + "();");
|
method.addBodyLine(modelClassName + " aDo = " + mapperFieldName + ".selectByPrimaryKey(id);");
|
||||||
method.addBodyLine("doExample.createCriteria().andGuidEqualTo(id);");
|
method.addBodyLine("if (aDo != null && (aDo.getIsDelete() == 1 || aDo.getIsHidden() == 1)) {");
|
||||||
method.addBodyLine("return findValidOne(doExample);");
|
method.addBodyLine(" return null;");
|
||||||
|
method.addBodyLine("}");
|
||||||
|
method.addBodyLine("return aDo;");
|
||||||
|
|
||||||
implClass.addMethod(method);
|
implClass.addMethod(method);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void generateFindTrashByIdMethod(TopLevelClass implClass, String modelClassName, String exampleClassName) {
|
private void generateFindTrashByIdMethod(TopLevelClass implClass, String modelClassName, String mapperFieldName, String exampleClassName) {
|
||||||
Method method = new Method("findTrashById");
|
Method method = new Method("findTrashById");
|
||||||
method.addAnnotation("@Override");
|
method.addAnnotation("@Override");
|
||||||
method.setVisibility(JavaVisibility.PUBLIC);
|
method.setVisibility(JavaVisibility.PUBLIC);
|
||||||
@@ -541,9 +544,11 @@ public class TapeRepositoryGeneratorPlugin extends PluginAdapter {
|
|||||||
method.addParameter(new Parameter(new FullyQualifiedJavaType("long"), "id"));
|
method.addParameter(new Parameter(new FullyQualifiedJavaType("long"), "id"));
|
||||||
method.addException(new FullyQualifiedJavaType("Throwable"));
|
method.addException(new FullyQualifiedJavaType("Throwable"));
|
||||||
|
|
||||||
method.addBodyLine(exampleClassName + " doExample = new " + exampleClassName + "();");
|
method.addBodyLine(modelClassName + " aDo = " + mapperFieldName + ".selectByPrimaryKey(id);");
|
||||||
method.addBodyLine("doExample.createCriteria().andGuidEqualTo(id);");
|
method.addBodyLine("if (aDo != null && (aDo.getIsDelete() == 1 || aDo.getIsHidden() == 0)) {");
|
||||||
method.addBodyLine("return findTrashOne(doExample);");
|
method.addBodyLine(" return null;");
|
||||||
|
method.addBodyLine("}");
|
||||||
|
method.addBodyLine("return aDo;");
|
||||||
|
|
||||||
implClass.addMethod(method);
|
implClass.addMethod(method);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user