1
hao123yinlong 2016-02-23 12:32:37 +08:00
你说的功能自己写个 Mybatis Generator 插件集成下就 OK ,已经在用了 。
代码就不贴了 ,给你个文档 http://mbg.cndocs.tk/reference/pluggingIn.html |
2
li24361 2016-02-23 12:36:13 +08:00 1
写一个类继承 DefaultCommentGenerator
``` @Override public void addFieldComment(Field field, IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn) { // 添加字段注释 StringBuffer sb = new StringBuffer(); field.addJavaDocLine("/**"); field.addJavaDocLine(" * <pre>"); if (introspectedColumn.getRemarks() != null) field.addJavaDocLine(" * " + introspectedColumn.getRemarks()); sb.append(" * 表字段 : "); sb.append(introspectedTable.getFullyQualifiedTable()); sb.append('.'); sb.append(introspectedColumn.getActualColumnName()); field.addJavaDocLine(sb.toString()); field.addJavaDocLine(" * </pre>"); field.addJavaDocLine(" * "); // addJavadocTag(field, false); field.addJavaDocLine(" */"); } ``` |
3
li24361 2016-02-23 12:37:45 +08:00 1
引用的时候,指明使用自己的这个类就可以
<commentGenerator type="org.mybatis.generator.internal.HairyCommentGenerator"> <!-- This property is used to specify whether MBG will include any coments in the generated code --> <property name="suppressAllComments" value="false"/> <!-- This property is used to specify whether MBG will include the generation timestamp in the generated comments --> <property name="suppressDate" value="true"/> </commentGenerator> |
4
wysnylc OP @hao123yinlong 你说的我都懂,但是咋做 QAQ
@li24361 谢谢谢谢,可以看我补充的地址里面有的,现在我在 git 下载的这个项目导进去是失败的。。。而且我也不知道改哪里怎么改,代码改哪里我知道,就是不知道怎么打包因为现在用的是命令行。不知道我这样说的明白不。 |
9
li24361 2016-02-25 19:20:49 +08:00 1
|
10
wysnylc OP @li24361 Multiple annotations found at this line:- Plugin execution not covered by lifecycle configuration: org.apache.felix:maven-bundle-plugin:2.1.0:manifest (execution: bundle-manifest, phase: process-classes) 在 pom.xml 里面报这个错误,但是实际上并没有绑定错误啊。
|
11
li24361 2016-03-01 09:53:35 +08:00 1
@wysnylc pom.xml 里面加上
<!--mybatis Generator --> <plugin> <groupId>org.mybatis.generator</groupId> <artifactId>mybatis-generator-maven-plugin</artifactId> <version>1.3.0</version> <dependencies> <dependency> <groupId>com.haier.hairy</groupId> <artifactId>mybatis-generator-core</artifactId> <version>1.0.1</version> </dependency> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>5.1.34</version> </dependency> </dependencies> </plugin> |