2023年7月24日发(作者:)
mybatis根据数据库表结构⾃动⽣成实体类,dao,mapper⾸先, pom需要引⼊
(" * "); (lyQualifiedTable()); aDocLine(ng()); aDocLine(" */"); } public void addFieldComment(Field field, IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn) { if (suppressAllComments) { return; } StringBuilder sb = new StringBuilder(); aDocLine("/**"); (" * "); (arks()); aDocLine(ng()); // addJavadocTag(field, false); aDocLine(" */"); } public void addFieldComment(Field field, IntrospectedTable introspectedTable) { if (suppressAllComments) { return; } StringBuilder sb = new StringBuilder(); aDocLine("/**"); (" * "); (lyQualifiedTable()); aDocLine(ng()); aDocLine(" */"); } public void addModelClassComment(TopLevelClass topLevelClass, IntrospectedTable introspectedTable) { } public void addGeneralMethodComment(Method method, IntrospectedTable introspectedTable) { if (suppressAllComments) { return; }
} public void addGetterComment(Method method, IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn) { if (suppressAllComments) { return; } aDocLine("/**"); StringBuilder sb = new StringBuilder(); (" * "); (arks()); aDocLine(ng()); gth(0); (" * @return "); (ualColumnName()); (" "); (arks()); aDocLine(ng()); // addJavadocTag(method, false); aDocLine(" */"); } public void addSetterComment(Method method, IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn) { if (suppressAllComments) { return; } aDocLine("/**"); StringBuilder sb = new StringBuilder(); (" * "); (arks()); aDocLine(ng()); Parameter parm = ameters().get(0); gth(0); (" * @param "); (e()); (" "); (arks()); aDocLine(ng()); // addJavadocTag(method, false); aDocLine(" */"); } public void addClassComment(InnerClass innerClass, IntrospectedTable introspectedTable, boolean markAsDoNotDelete) { if (suppressAllComments) { return; } StringBuilder sb = new StringBuilder(); aDocLine("/**"); (" * "); (lyQualifiedTable()); aDocLine(ng()); gth(0); (" * @author "); (perty("")); (" "); (currentDateStr); // addJavadocTag(innerClass, markAsDoNotDelete); aDocLine(" */"); }}
然后是 ⽂件
最后是要执⾏的的类,执⾏这个类, 就能⽣成相应的⽂件了, 执⾏完可能需要更新下项⽬才能看出效果import sGenerator;import uration;import urationParser;import dConfigurationException;import serException;import tShellCallback;import ;import ption;import eption;import ist;import ;public class MyBatisGeneratorTest { public static void main(String[] args) { try { List
File configFile = new File("E:");
ConfigurationParser cp = new ConfigurationParser(warnings); Configuration config = onfiguration(configFile); DefaultShellCallback callback = new DefaultShellCallback(overwrite); MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings); te(null); } catch (SQLException e) { tackTrace(); } catch (IOException e) { tackTrace(); } catch (InterruptedException e) { tackTrace(); } catch (InvalidConfigurationException e) { tackTrace(); } catch (XMLParserException e) { tackTrace(); } }}
发布者:admin,转转请注明出处:http://www.yc00.com/news/1690192989a312378.html
评论列表(0条)