src/main/java/com/itfsw/mybatis/generator/plugins/SelectiveEnhancedPlugin.java
private XmlElement generateInsertValuesSelective(List<IntrospectedColumn> columns, boolean bracket) {
        XmlElement insertValuesChooseEle = new XmlElement("choose");

        XmlElement valuesWhenEle = new XmlElement("when");
        valuesWhenEle.addAttribute(new Attribute("test", "selective != null and selective.length > 0"));
        insertValuesChooseEle.addElement(valuesWhenEle);

        XmlElement valuesForeachEle = new XmlElement("foreach");
        valuesForeachEle.addAttribute(new Attribute("collection", "selective"));
        valuesForeachEle.addAttribute(new Attribute("item", "column"));
        valuesForeachEle.addAttribute(new Attribute("separator", ","));
        if (bracket) {
            valuesForeachEle.addAttribute(new Attribute("open", "("));
            valuesForeachEle.addAttribute(new Attribute("close", ")"));
        }
        valuesForeachEle.addElement(new TextElement("#{record.${column.javaProperty},jdbcType=${column.jdbcType}}"));
        valuesWhenEle.addElement(valuesForeachEle);

        XmlElement valuesOtherwiseEle = new XmlElement("otherwise");
        insertValuesChooseEle.addElement(valuesOtherwiseEle);
        valuesOtherwiseEle.addElement(XmlElementGeneratorTools.generateValuesSelective(columns, "record.", bracket));

        return insertValuesChooseEle;
    }
private XmlElement generateInsertValuesSelective(List<IntrospectedColumn> columns, boolean bracket) {
        XmlElement insertValuesChooseEle = new XmlElement("choose");

        XmlElement valuesWhenEle = new XmlElement("when");
        valuesWhenEle.addAttribute(new Attribute("test", "selective != null and selective.length > 0"));
        insertValuesChooseEle.addElement(valuesWhenEle);

        XmlElement valuesForeachEle = new XmlElement("foreach");
        valuesForeachEle.addAttribute(new Attribute("collection", "selective"));
        valuesForeachEle.addAttribute(new Attribute("item", "column"));
        valuesForeachEle.addAttribute(new Attribute("separator", ","));
        if (bracket) {
            valuesForeachEle.addAttribute(new Attribute("open", "("));
            valuesForeachEle.addAttribute(new Attribute("close", ")"));
        }
        valuesForeachEle.addElement(new TextElement("#{record.${column.javaProperty},jdbcType=${column.jdbcType}}"));
        valuesWhenEle.addElement(valuesForeachEle);

        XmlElement valuesOtherwiseEle = new XmlElement("otherwise");
        insertValuesChooseEle.addElement(valuesOtherwiseEle);
        valuesOtherwiseEle.addElement(XmlElementGeneratorTools.generateValuesSelective(columns, "record.", bracket));

        return insertValuesChooseEle;
    }
private XmlElement generateInsertValuesSelective ( List < IntrospectedColumn > columns , boolean bracket ) { XmlElement insertValuesChooseEle = new XmlElement ( "choose" ) ; XmlElement valuesWhenEle = new XmlElement ( "when" ) ; valuesWhenEle . addAttribute ( new Attribute ( "test" , "selective != null and selective.length > 0" ) ) ; insertValuesChooseEle . addElement ( valuesWhenEle ) ; XmlElement valuesForeachEle = new XmlElement ( "foreach" ) ; valuesForeachEle . addAttribute ( new Attribute ( "collection" , "selective" ) ) ; valuesForeachEle . addAttribute ( new Attribute ( "item" , "column" ) ) ; valuesForeachEle . addAttribute ( new Attribute ( "separator" , "," ) ) ; if ( bracket ) { valuesForeachEle . addAttribute ( new Attribute ( "open" , "(" ) ) ; valuesForeachEle . addAttribute ( new Attribute ( "close" , ")" ) ) ; } valuesForeachEle . addElement ( new TextElement ( "#{record.${column.javaProperty},jdbcType=${column.jdbcType}}" ) ) ; valuesWhenEle . addElement ( valuesForeachEle ) ; XmlElement valuesOtherwiseEle = new XmlElement ( "otherwise" ) ; insertValuesChooseEle . addElement ( valuesOtherwiseEle ) ; valuesOtherwiseEle . addElement ( XmlElementGeneratorTools . generateValuesSelective ( columns , "record." , bracket ) ) ; return insertValuesChooseEle ; }
insert column selective
@param columns
@param bracket
@return
insert column selective