下面仅仅介绍MyBatis3模式的代码生成。

    科技2024-11-16  8

    public class MBGTool { public static void main(String[] args) throws Exception { List warnings = new ArrayList<>(); boolean overwrite = true; InputStream configFile = MBGTool.class.getResourceAsStream("/generator/generatorConfig.xml"); ConfigurationParser cp = new ConfigurationParser(warnings); Configuration config = cp.parseConfiguration(configFile); DefaultShellCallback callback = new DefaultShellCallback(overwrite); MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings); myBatisGenerator.generate(null); } } public class MBGTool { public static void main(String[] args) throws Exception { List warnings = new ArrayList<>(); boolean overwrite = true; InputStream configFile = MBGTool.class.getResourceAsStream("/generator/generatorConfig.xml"); ConfigurationParser cp = new ConfigurationParser(warnings); Configuration config = cp.parseConfiguration(configFile); DefaultShellCallback callback = new DefaultShellCallback(overwrite); MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings); myBatisGenerator.generate(null); } } public class MBGTool { public static void main(String[] args) throws Exception { List warnings = new ArrayList<>(); boolean overwrite = true; InputStream configFile = MBGTool.class.getResourceAsStream("/generator/generatorConfig.xml"); ConfigurationParser cp = new ConfigurationParser(warnings); Configuration config = cp.parseConfiguration(configFile); DefaultShellCallback callback = new DefaultShellCallback(overwrite); MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings); myBatisGenerator.generate(null); } } public class MBGTool { public static void main(String[] args) throws Exception { List warnings = new ArrayList<>(); boolean overwrite = true; InputStream configFile = MBGTool.class.getResourceAsStream("/generator/generatorConfig.xml"); ConfigurationParser cp = new ConfigurationParser(warnings); Configuration config = cp.parseConfiguration(configFile); DefaultShellCallback callback = new DefaultShellCallback(overwrite); MyBatisGenerator myBatisGenerator = new MyBatisGenerator(config, callback, warnings); myBatisGenerator.generate(null); } }

    Processed: 0.014, SQL: 8