src/main/java/com/itfsw/mybatis/generator/plugins/SelectiveEnhancedPlugin.java
@Override
    public boolean sqlMapUpdateByExampleSelectiveElementGenerated(XmlElement element, IntrospectedTable introspectedTable) {
        // 清空
        XmlElement answer = new XmlElement("update");
        answer.addAttribute(new Attribute("id", introspectedTable.getUpdateByExampleSelectiveStatementId()));
        answer.addAttribute(new Attribute("parameterType", "map"));

        commentGenerator.addComment(answer);

        StringBuilder sb = new StringBuilder();
        sb.append("update ");
        sb.append(introspectedTable.getAliasedFullyQualifiedTableNameAtRuntime());
        answer.addElement(new TextElement(sb.toString()));

        // selective
        answer.addElement(new TextElement("SET"));
        answer.addElement(this.generateSetsSelective(ListUtilities.removeGeneratedAlwaysColumns(introspectedTable.getAllColumns())));

        answer.addElement(XmlElementGeneratorTools.getUpdateByExampleIncludeElement(introspectedTable));

        XmlElementTools.replaceXmlElement(element, answer);

        return super.sqlMapUpdateByExampleSelectiveElementGenerated(element, introspectedTable);
    }
@Override
    public boolean sqlMapUpdateByExampleSelectiveElementGenerated(XmlElement element, IntrospectedTable introspectedTable) {
        // 清空
        XmlElement answer = new XmlElement("update");
        answer.addAttribute(new Attribute("id", introspectedTable.getUpdateByExampleSelectiveStatementId()));
        answer.addAttribute(new Attribute("parameterType", "map"));

        commentGenerator.addComment(answer);

        StringBuilder sb = new StringBuilder();
        sb.append("update ");
        sb.append(introspectedTable.getAliasedFullyQualifiedTableNameAtRuntime());
        answer.addElement(new TextElement(sb.toString()));

        // selective
        answer.addElement(new TextElement("SET"));
        answer.addElement(this.generateSetsSelective(ListUtilities.removeGeneratedAlwaysColumns(introspectedTable.getAllColumns())));

        answer.addElement(XmlElementGeneratorTools.getUpdateByExampleIncludeElement(introspectedTable));

        XmlElementTools.replaceXmlElement(element, answer);

        return super.sqlMapUpdateByExampleSelectiveElementGenerated(element, introspectedTable);
    }
@ Override public boolean sqlMapUpdateByExampleSelectiveElementGenerated ( XmlElement element , IntrospectedTable introspectedTable ) { // 清空 XmlElement answer = new XmlElement ( "update" ) ; answer . addAttribute ( new Attribute ( "id" , introspectedTable . getUpdateByExampleSelectiveStatementId ( ) ) ) ; answer . addAttribute ( new Attribute ( "parameterType" , "map" ) ) ; commentGenerator . addComment ( answer ) ; StringBuilder sb = new StringBuilder ( ) ; sb . append ( "update " ) ; sb . append ( introspectedTable . getAliasedFullyQualifiedTableNameAtRuntime ( ) ) ; answer . addElement ( new TextElement ( sb . toString ( ) ) ) ; // selective answer . addElement ( new TextElement ( "SET" ) ) ; answer . addElement ( this . generateSetsSelective ( ListUtilities . removeGeneratedAlwaysColumns ( introspectedTable . getAllColumns ( ) ) ) ) ; answer . addElement ( XmlElementGeneratorTools . getUpdateByExampleIncludeElement ( introspectedTable ) ) ; XmlElementTools . replaceXmlElement ( element , answer ) ; return super . sqlMapUpdateByExampleSelectiveElementGenerated ( element , introspectedTable ) ; }
updateByExampleSelective
具体执行顺序 http://www.mybatis.org/generator/reference/pluggingIn.html
@param element
@param introspectedTable
@return
updateByExampleSelective 具体执行顺序 http : // www . mybatis . org / generator / reference / pluggingIn . html