src/main/java/com/itfsw/mybatis/generator/plugins/utils/XmlElementGeneratorTools.java
public static void useGeneratedKeys(XmlElement element, IntrospectedTable introspectedTable, String prefix) {
        GeneratedKey gk = introspectedTable.getGeneratedKey();
        if (gk != null) {
            IntrospectedColumn introspectedColumn = IntrospectedTableTools.safeGetColumn(introspectedTable, gk.getColumn());
            // if the column is null, then it's a configuration error. The
            // warning has already been reported
            if (introspectedColumn != null) {
                // 使用JDBC的getGenereatedKeys方法获取主键并赋值到keyProperty设置的领域模型属性中。所以只支持MYSQL和SQLServer
                element.addAttribute(new Attribute("useGeneratedKeys", "true"));
                element.addAttribute(new Attribute("keyProperty", (prefix == null ? "" : prefix) + introspectedColumn.getJavaProperty()));
                element.addAttribute(new Attribute("keyColumn", introspectedColumn.getActualColumnName()));
            }
        }
    }
public static void useGeneratedKeys(XmlElement element, IntrospectedTable introspectedTable, String prefix) {
        GeneratedKey gk = introspectedTable.getGeneratedKey();
        if (gk != null) {
            IntrospectedColumn introspectedColumn = IntrospectedTableTools.safeGetColumn(introspectedTable, gk.getColumn());
            // if the column is null, then it's a configuration error. The
            // warning has already been reported
            if (introspectedColumn != null) {
                // 使用JDBC的getGenereatedKeys方法获取主键并赋值到keyProperty设置的领域模型属性中。所以只支持MYSQL和SQLServer
                element.addAttribute(new Attribute("useGeneratedKeys", "true"));
                element.addAttribute(new Attribute("keyProperty", (prefix == null ? "" : prefix) + introspectedColumn.getJavaProperty()));
                element.addAttribute(new Attribute("keyColumn", introspectedColumn.getActualColumnName()));
            }
        }
    }
public static void useGeneratedKeys ( XmlElement element , IntrospectedTable introspectedTable , String prefix ) { GeneratedKey gk = introspectedTable . getGeneratedKey ( ) ; if ( gk != null ) { IntrospectedColumn introspectedColumn = IntrospectedTableTools . safeGetColumn ( introspectedTable , gk . getColumn ( ) ) ; // if the column is null, then it's a configuration error. The // warning has already been reported if ( introspectedColumn != null ) { // 使用JDBC的getGenereatedKeys方法获取主键并赋值到keyProperty设置的领域模型属性中。所以只支持MYSQL和SQLServer element . addAttribute ( new Attribute ( "useGeneratedKeys" , "true" ) ) ; element . addAttribute ( new Attribute ( "keyProperty" , ( prefix == null ? "" : prefix ) + introspectedColumn . getJavaProperty ( ) ) ) ; element . addAttribute ( new Attribute ( "keyColumn" , introspectedColumn . getActualColumnName ( ) ) ) ; } } }
使用JDBC的getGenereatedKeys方法获取主键并赋值到keyProperty设置的领域模型属性中。所以只支持MYSQL和SQLServer
@param element
@param introspectedTable
@param prefix
使用JDBC的getGenereatedKeys方法获取主键并赋值到keyProperty设置的领域模型属性中。所以只支持MYSQL和SQLServer