src/main/java/com/itfsw/mybatis/generator/plugins/OptimisticLockerPlugin.java
private Method replaceUpdatePrimaryKeyMethod(IntrospectedTable introspectedTable, Method method, Interface interfaze, String methodName) {
        Method withVersionMethod = new Method(method);

        // 替换方法名
        withVersionMethod.setName(methodName);
        FormatTools.replaceGeneralMethodComment(commentGenerator, withVersionMethod, introspectedTable);

        Parameter versionParam = new Parameter(this.versionColumn.getFullyQualifiedJavaType(), "version", "@Param(\"version\")");
        Parameter recordParam = new Parameter(method.getParameters().get(0).getType(), "record", "@Param(\"record\")");

        withVersionMethod.getParameters().clear();
        withVersionMethod.addParameter(versionParam);
        withVersionMethod.addParameter(recordParam);

        return withVersionMethod;
    }
private Method replaceUpdatePrimaryKeyMethod(IntrospectedTable introspectedTable, Method method, Interface interfaze, String methodName) {
        Method withVersionMethod = new Method(method);

        // 替换方法名
        withVersionMethod.setName(methodName);
        FormatTools.replaceGeneralMethodComment(commentGenerator, withVersionMethod, introspectedTable);

        Parameter versionParam = new Parameter(this.versionColumn.getFullyQualifiedJavaType(), "version", "@Param(\"version\")");
        Parameter recordParam = new Parameter(method.getParameters().get(0).getType(), "record", "@Param(\"record\")");

        withVersionMethod.getParameters().clear();
        withVersionMethod.addParameter(versionParam);
        withVersionMethod.addParameter(recordParam);

        return withVersionMethod;
    }
private Method replaceUpdatePrimaryKeyMethod ( IntrospectedTable introspectedTable , Method method , Interface interfaze , String methodName ) { Method withVersionMethod = new Method ( method ) ; // 替换方法名 withVersionMethod . setName ( methodName ) ; FormatTools . replaceGeneralMethodComment ( commentGenerator , withVersionMethod , introspectedTable ) ; Parameter versionParam = new Parameter ( this . versionColumn . getFullyQualifiedJavaType ( ) , "version" , "@Param(\"version\")" ) ; Parameter recordParam = new Parameter ( method . getParameters ( ) . get ( 0 ) . getType ( ) , "record" , "@Param(\"record\")" ) ; withVersionMethod . getParameters ( ) . clear ( ) ; withVersionMethod . addParameter ( versionParam ) ; withVersionMethod . addParameter ( recordParam ) ; return withVersionMethod ; }
替换主键 方法
@param introspectedTable
@param method
@param interfaze
@param methodName
@return
替换主键 方法