@Override public boolean modelExampleClassGenerated(TopLevelClass topLevelClass, IntrospectedTable introspectedTable) { MyBatisClasses cls = MyBatisClasses.calculate(topLevelClass, introspectedTable); topLevelClass.addImportedType(sqlSession); if (cls.imports.mapper != null) topLevelClass.addImportedType(cls.imports.mapper); int newMethodsStart = topLevelClass.getMethods().size(); addListMethods(topLevelClass, introspectedTable, cls); addGetRecordMethods(topLevelClass, introspectedTable, cls, firstMethod, firstWithBLOBsMethod, "list == null || list.isEmpty() ? null : list.get(0)"); addGetRecordMethods(topLevelClass, introspectedTable, cls, singleMethod, singleWithBLOBsMethod, "list == null || list.size() != 1 ? null : list.get(0)"); addGetRecordMethods(topLevelClass, introspectedTable, cls, optionalMethod, optionalWithBLOBsMethod, "list == null || list.isEmpty() ? new @result() : list.get(0)"); addUpdateMethods(topLevelClass, introspectedTable, cls, updateMethod, updateWithBLOBsMethod, false); addUpdateMethods(topLevelClass, introspectedTable, cls, updateSelectiveMethod, updateSelectiveWithBLOBsMethod, true); addDeleteMethods(topLevelClass, introspectedTable, cls); addCountMethods(topLevelClass, introspectedTable, cls); if (mapperClass != null) { addUserDefinedMethods(topLevelClass, mapperClass, introspectedTable, cls); mapperClass = null; exampleClass = null; } else { exampleClass = topLevelClass; } addCriteriaMethods(topLevelClass, newMethodsStart); return true; }
@Override public boolean clientGenerated(Interface interfaze, TopLevelClass topLevelClass, IntrospectedTable introspectedTable) { if (topLevelClass != null) return false; if (exampleClass != null) { MyBatisClasses cls = MyBatisClasses.calculate(exampleClass, introspectedTable); int newMethodsStart = exampleClass.getMethods().size(); addUserDefinedMethods(exampleClass, interfaze, introspectedTable, cls); addCriteriaMethods(exampleClass, newMethodsStart); exampleClass = null; mapperClass = null; } else { mapperClass = interfaze; } return true; }