jinlin
2023-11-16 86b6785e74bf268885e8663380b3e3c0cb0c4bad
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>
 * 版权所有,侵权必究!
 */
@@ -45,7 +45,7 @@
public class SysGeneratorController {
    @GetMapping("properties")
    @RequiresPermissions(Constant.Permissions.SUPER_ADMIN)
    //@RequiresPermissions(Constant.Permissions.SUPER_ADMIN)
    public Result<JSONObject> queryProperties() {
        JSONObject jsonObject = new JSONObject();
        try {
@@ -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);
    }
@@ -133,7 +162,7 @@
                JSONObject json = array.getJSONObject(i);
                String columnName = json.getString("columnName");
                if ("is_delete,dept_id,company_id,tenant_id,creator,create_date,updater,update_date"
                        .indexOf(columnName) >= 0) {
                        .indexOf(columnName.toLowerCase()) >= 0) {
                    json.put("isTableColumn", "false");
                }
            }