src/main/java/com/itfsw/mybatis/generator/plugins/OptimisticLockerPlugin.java
@Override
    public void initialized(IntrospectedTable introspectedTable) {
        super.initialized(introspectedTable);
        sqlMaps.put(introspectedTable, new ArrayList<>());

        // 读取并验证版本列
        String versionColumn = introspectedTable.getTableConfigurationProperty(PRO_VERSION_COLUMN);
        if (versionColumn != null) {
            this.versionColumn = introspectedTable.getColumn(versionColumn);
            if (this.versionColumn == null) {
                warnings.add("itfsw(乐观锁插件):表" + introspectedTable.getFullyQualifiedTable() + "配置的版本列(" + introspectedTable.getTableConfigurationProperty(PRO_VERSION_COLUMN) + ")没有找到！");
            }
        } else {
            this.versionColumn = null;
        }

        // 自定义nextVersion
        // 首先获取全局配置
        Properties properties = getProperties();
        String customizedNextVersion = properties.getProperty(PRO_CUSTOMIZED_NEXT_VERSION);
        // 获取表单独配置，如果有则覆盖全局配置
        if (introspectedTable.getTableConfigurationProperty(PRO_CUSTOMIZED_NEXT_VERSION) != null) {
            customizedNextVersion = introspectedTable.getTableConfigurationProperty(PRO_CUSTOMIZED_NEXT_VERSION);
        }
        if (StringUtility.stringHasValue(customizedNextVersion) && StringUtility.isTrue(customizedNextVersion)) {
            this.customizedNextVersion = true;
        } else {
            this.customizedNextVersion = false;
        }

        super.initialized(introspectedTable);
    }
@Override
    public void initialized(IntrospectedTable introspectedTable) {
        super.initialized(introspectedTable);
        sqlMaps.put(introspectedTable, new ArrayList<>());

        // 读取并验证版本列
        String versionColumn = introspectedTable.getTableConfigurationProperty(PRO_VERSION_COLUMN);
        if (versionColumn != null) {
            this.versionColumn = introspectedTable.getColumn(versionColumn);
            if (this.versionColumn == null) {
                warnings.add("itfsw(乐观锁插件):表" + introspectedTable.getFullyQualifiedTable() + "配置的版本列(" + introspectedTable.getTableConfigurationProperty(PRO_VERSION_COLUMN) + ")没有找到！");
            }
        } else {
            this.versionColumn = null;
        }

        // 自定义nextVersion
        // 首先获取全局配置
        Properties properties = getProperties();
        String customizedNextVersion = properties.getProperty(PRO_CUSTOMIZED_NEXT_VERSION);
        // 获取表单独配置，如果有则覆盖全局配置
        if (introspectedTable.getTableConfigurationProperty(PRO_CUSTOMIZED_NEXT_VERSION) != null) {
            customizedNextVersion = introspectedTable.getTableConfigurationProperty(PRO_CUSTOMIZED_NEXT_VERSION);
        }
        if (StringUtility.stringHasValue(customizedNextVersion) && StringUtility.isTrue(customizedNextVersion)) {
            this.customizedNextVersion = true;
        } else {
            this.customizedNextVersion = false;
        }

        super.initialized(introspectedTable);
    }
@ Override public void initialized ( IntrospectedTable introspectedTable ) { super . initialized ( introspectedTable ) ; sqlMaps . put ( introspectedTable , new ArrayList <> ( ) ) ; // 读取并验证版本列 String versionColumn = introspectedTable . getTableConfigurationProperty ( PRO_VERSION_COLUMN ) ; if ( versionColumn != null ) { this . versionColumn = introspectedTable . getColumn ( versionColumn ) ; if ( this . versionColumn == null ) { warnings . add ( "itfsw(乐观锁插件):表" + introspec e Table.getFullyQua l ifiedTable() + "配置的版本列 ( " + introspectedTable.get a leConfigurationPr o perty(PRO_VERSION_COLUMN) + " ) 没有找到！"); } } else { this . versionColumn = null ; } // 自定义nextVersion // 首先获取全局配置 Properties properties = getProperties ( ) ; String customizedNextVersion = properties . getProperty ( PRO_CUSTOMIZED_NEXT_VERSION ) ; // 获取表单独配置，如果有则覆盖全局配置 if ( introspectedTable . getTableConfigurationProperty ( PRO_CUSTOMIZED_NEXT_VERSION ) != null ) { customizedNextVersion = introspectedTable . getTableConfigurationProperty ( PRO_CUSTOMIZED_NEXT_VERSION ) ; } if ( StringUtility . stringHasValue ( customizedNextVersion ) && StringUtility . isTrue ( customizedNextVersion ) ) { this . customizedNextVersion = true ; } else { this . customizedNextVersion = false ; } super . initialized ( introspectedTable ) ; }
使用用户自定义nextVersion
使用用户自定义nextVersion