src/main/java/com/itfsw/mybatis/generator/plugins/UpsertPlugin.java
private void generateExistsClause(IntrospectedTable introspectedTable, XmlElement element, List<Element> values) {
        element.addElement(new TextElement("select"));

        for (Element value : values) {
            element.addElement(value);
        }

        element.addElement(new TextElement("from dual where not exists"));
        element.addElement(new TextElement("("));
        element.addElement(new TextElement("select 1 from " + introspectedTable.getFullyQualifiedTableNameAtRuntime()));

        // if example
        element.addElement(XmlElementGeneratorTools.getUpdateByExampleIncludeElement(introspectedTable));

        element.addElement(new TextElement(")"));
    }
private void generateExistsClause(IntrospectedTable introspectedTable, XmlElement element, List<Element> values) {
        element.addElement(new TextElement("select"));

        for (Element value : values) {
            element.addElement(value);
        }

        element.addElement(new TextElement("from dual where not exists"));
        element.addElement(new TextElement("("));
        element.addElement(new TextElement("select 1 from " + introspectedTable.getFullyQualifiedTableNameAtRuntime()));

        // if example
        element.addElement(XmlElementGeneratorTools.getUpdateByExampleIncludeElement(introspectedTable));

        element.addElement(new TextElement(")"));
    }
exists 语句
+635
@param introspectedTable
@param element
@param values