原创不易,转载请注明出处:分享weibo4j中用到的mysql2bean的java工具
String sql = "show tables"; ResultSet rs = DBManager.query(conn, sql); try { List<String> tablenames = new ArrayList<String>(); while (rs.next()) { String tablename = rs.getString(1); // 生成module parseTableByShowCreateModule(conn, tablename, packname, outputdir); // 生成repository parseTableByShowCreateRepository(conn, tablename, packname, outputdir); // 生成service parseTableByShowCreateService(conn, tablename, packname, outputdir); // 生成serviceimpl parseTableByShowCreateServiceImpl(conn, tablename, packname, outputdir); // 生成controller parseTableByShowCreateController(conn, tablename, packname, outputdir); tablenames.add(tablename); } // 生成basecontroller parseTableByShowCreateBaseController(conn, tablenames, packname, outputdir); DBManager.close(conn, null, rs); } catch (SQLException e) { e.printStackTrace(); }代码下载:http://www.zuidaima.com/share/1550463394286592.htm