乱码问题:
插件pom中增加
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
开发插件扩展
1 新建maven项目,创建类继承PluginAdapter
2 自定义父类方法实现
3 打包,防止乱码pom中配置下project.build.sourceEncoding
插件应用
扩展项目打成jar包,在 mybatis-generator-maven-plugin 依赖中添加打好的jar包,然后在generatorconfig.xml中context节点下配置plugin
专业名词
参数
topLevelClass 对应生成的类
Interface 对应生成的接口
Field 对应生成的属性
Method 对应生成的方法
参数对象的常用方法
addAnnotation 增加注解
addImportedTypes 增加导入的包
addJavaDocLine 增加注释
setType 修改属性类型
introspectedTable 数据库表映射信息
introspectedColumn 数据库字段映射信息
PluginAdapter 提供的接口
modelBaseRecordClassGenerated 修改实体类在此方法
clientGenerated 修改生成的mapper接口
modelFieldGenerated 修改生成的属性
modelSetterMethodGenerated 修改set方法 false不生成
modelGetterMethodGenerated 修改get方法 false不生成
clientDeleteByPrimaryKeyMethodGenerated 对应mapper接口方法 DeleteByPrimaryKey方法
client*****MethodGenerated 对应mapper接口内的各个方法
contextGenerateAdditionalJavaFiles 增加额外的java文件