src/main/java/com/itfsw/mybatis/generator/plugins/TableRenameConfigurationPlugin.java
private void renameColumns(List<IntrospectedColumn> columns, ColumnRenamingRule rule, TableConfiguration tc) {
        Pattern pattern = Pattern.compile(rule.getSearchString());
        String replaceString = rule.getReplaceString();
        replaceString = replaceString == null ? "" : replaceString;

        for (IntrospectedColumn introspectedColumn : columns) {
            String calculatedColumnName;
            if (pattern == null) {
                calculatedColumnName = introspectedColumn.getActualColumnName();
            } else {
                Matcher matcher = pattern.matcher(introspectedColumn.getActualColumnName());
                calculatedColumnName = matcher.replaceAll(replaceString);
            }

            if (isTrue(tc.getProperty(PropertyRegistry.TABLE_USE_ACTUAL_COLUMN_NAMES))) {
                introspectedColumn.setJavaProperty(getValidPropertyName(calculatedColumnName));
            } else if (isTrue(tc.getProperty(PropertyRegistry.TABLE_USE_COMPOUND_PROPERTY_NAMES))) {
                StringBuilder sb = new StringBuilder();
                sb.append(calculatedColumnName);
                sb.append('_');
                sb.append(getCamelCaseString(introspectedColumn.getRemarks(), true));
                introspectedColumn.setJavaProperty(getValidPropertyName(sb.toString()));
            } else {
                introspectedColumn.setJavaProperty(getCamelCaseString(calculatedColumnName, false));
            }
        }
    }
private void renameColumns(List<IntrospectedColumn> columns, ColumnRenamingRule rule, TableConfiguration tc) {
        Pattern pattern = Pattern.compile(rule.getSearchString());
        String replaceString = rule.getReplaceString();
        replaceString = replaceString == null ? "" : replaceString;

        for (IntrospectedColumn introspectedColumn : columns) {
            String calculatedColumnName;
            if (pattern == null) {
                calculatedColumnName = introspectedColumn.getActualColumnName();
            } else {
                Matcher matcher = pattern.matcher(introspectedColumn.getActualColumnName());
                calculatedColumnName = matcher.replaceAll(replaceString);
            }

            if (isTrue(tc.getProperty(PropertyRegistry.TABLE_USE_ACTUAL_COLUMN_NAMES))) {
                introspectedColumn.setJavaProperty(getValidPropertyName(calculatedColumnName));
            } else if (isTrue(tc.getProperty(PropertyRegistry.TABLE_USE_COMPOUND_PROPERTY_NAMES))) {
                StringBuilder sb = new StringBuilder();
                sb.append(calculatedColumnName);
                sb.append('_');
                sb.append(getCamelCaseString(introspectedColumn.getRemarks(), true));
                introspectedColumn.setJavaProperty(getValidPropertyName(sb.toString()));
            } else {
                introspectedColumn.setJavaProperty(getCamelCaseString(calculatedColumnName, false));
            }
        }
    }
private void renameColumns ( List < IntrospectedColumn > columns , ColumnRenamingRule rule , TableConfiguration tc ) { Pattern pattern = Pattern . compile ( rule . getSearchString ( ) ) ; String replaceString = rule . getReplaceString ( ) ; replaceString = replaceString == null ? "" : replaceString ; for ( IntrospectedColumn introspectedColumn : columns ) { String calculatedColumnName ; if ( pattern == null ) { calculatedColumnName = introspectedColumn . getActualColumnName ( ) ; } else { Matcher matcher = pattern . matcher ( introspectedColumn . getActualColumnName ( ) ) ; calculatedColumnName = matcher . replaceAll ( replaceString ) ; } if ( isTrue ( tc . getProperty ( PropertyRegistry . TABLE_USE_ACTUAL_COLUMN_NAMES ) ) ) { introspectedColumn . setJavaProperty ( getValidPropertyName ( calculatedColumnName ) ) ; } else if ( isTrue ( tc . getProperty ( PropertyRegistry . TABLE_USE_COMPOUND_PROPERTY_NAMES ) ) ) { StringBuilder sb = new StringBuilder ( ) ; sb . append ( calculatedColumnName ) ; sb . append ( ' ' ) ; sb . append ( getCamelCaseString ( introspectedColumn . getRemarks ( ) , true ) ) ; introspectedColumn . setJavaProperty ( getValidPropertyName ( sb . toString ( ) ) ) ; } else { introspectedColumn . setJavaProperty ( getCamelCaseString ( calculatedColumnName , false ) ) ; } } }
column rename
@param columns
@param rule
@param tc
column rename