jinlin
2023-11-07 11713839245ecb7483fd24b66d8462011b5c351e
zt/core/src/main/java/com/zt/generator/controller/SysGeneratorController.java
@@ -1,8 +1,8 @@
/**
 * Copyright (c) 2018 人人开源 All rights reserved.
 *
 * <p>
 * https://www.renren.io
 *
 * <p>
 * 版权所有,侵权必究!
 */
@@ -66,6 +66,35 @@
            eqList.add(json);
        }
        jsonObject.put("eqList", eqList);
        DbProperties jdbc = queryJdbcProperties();
        DataTable table = null;
        Connection conn = null;
        try {
            // 注册数据库驱动
            Class.forName(jdbc.getDriverClass());
            Properties props = new Properties();
            props.put("remarksReporting", "true");// 为了得到说明
            props.setProperty("user", jdbc.getUserName());
            props.setProperty("password", jdbc.getPassWord());
            // 获取连接
            conn = DriverManager.getConnection(jdbc.getUrl(), props);
            table = DBUtil.getTableList(conn, false);
        } catch (Exception e) {
            e.printStackTrace();
        } finally {
            if (conn != null) {
                try {
                    conn.close();
                } catch (SQLException e) {
                    e.printStackTrace();
                }
            }
        }
        jsonObject.put("tableList", table.toJSONArray());
        return Result.ok(jsonObject);
    }