#842·APIJSON

[咨询] 字段映射问题

作者: hany5725创建于 2025年9月14日更新于 2025年10月10日

static { // Set the logic deletion field KEY_DELETED_KEY = "del_flag"; KEY_DELETED_VALUE = "1"; KEY_NOT_DELETED_VALUE = "0"; // Set the default database type and mode DEFAULT_DATABASE = DATABASE_MYSQL; DEFAULT_SCHEMA = SystemProperties.Database.getDefaultSchema();

// Configure SQL configuration callback
SIMPLE_CALLBACK = new SimpleCallback<String>() {

    /**
     * Get the SQL configuration instance
     *
     * @param method     Request method
     * @param database   Database name
     * @param schema     Mode name
     * @param datasource Data source name
     * @param table      Table name
     * @return SQL configuration instance
     */
    @Override
    public AbstractSQLConfig<String> getSQLConfig(RequestMethod method, String database, String schema, String datasource, String table) {
        return new TunnelSqlConfig(method, table);
    }

    /**
     * Get the user ID field name
     *
     * @param database   Database name
     * @param schema     Mode name
     * @param datasource Data source name
     * @param table      Table name
     * @return User ID field name
     */
    @Override
    public String getUserIdKey(String database, String schema, String datasource, String table) {
        return USER_.equals(table) || PRIVACY_.equals(table) ? ID : USER_ID;
    }
};

Map<String, Map<String, String>> tableKeyColumnMap = new HashMap<>();
Map<String, String> ballastlessLedgerColumnMap = new HashMap<>();
ballastlessLedgerColumnMap.put("id", "id");
ballastlessLedgerColumnMap.put("lineName", "line_name");
ballastlessLedgerColumnMap.put("lineLevel", "line_level");
ballastlessLedgerColumnMap.put("bureauName", "bureau_name");
ballastlessLedgerColumnMap.put("divisionName", "division_name");
ballastlessLedgerColumnMap.put("sectionName", "section_name");
ballastlessLedgerColumnMap.put("direction", "direction");
ballastlessLedgerColumnMap.put("locationType", "location_type");
ballastlessLedgerColumnMap.put("locationName", "location_name");
ballastlessLedgerColumnMap.put("sectionNumber", "section_number");
ballastlessLedgerColumnMap.put("equipmentCode", "equipment_code");
ballastlessLedgerColumnMap.put("startMileage", "start_mileage");
ballastlessLedgerColumnMap.put("endMileage", "end_mileage");
ballastlessLedgerColumnMap.put("centerMileage", "center_mileage");

内容来源: Tencent/APIJSON