首先 找到 org.mybatis.generator.core_1.3.5.201609070108.jar (位于eclipse\plugins)
然后 反编译 org\mybatis\generator\internal\DefaultCommentGenerator.class
修改其中的代码
public void addFieldComment(Field field, IntrospectedTable introspectedTable, IntrospectedColumn introspectedColumn)
{
if (introspectedColumn.getRemarks()==null) {
return;
}
field.addJavaDocLine("/** "+introspectedColumn.getRemarks()+"*/");
}
修改后 替换 原来 org.mybatis.generator.core_1.3.5.201609070108.jar 中的 class 文件
然后在 generatorConfig.xml 添加 <property name="javaFileEncoding" value="UTF-8"/>, 一定要放在context的下面
<context id="context1" targetRuntime="MyBatis3">
<property name="javaFileEncoding" value="UTF-8" />
<commentGenerator>
<property name="suppressAllComments" value="true" />
</commentGenerator>
<jdbcConnection connectionURL="jdbc:mysql://127.0.0.1:3306/ttxd" driverClass="com.mysql.jdbc.Driver" password="" userId="root" />
<javaModelGenerator targetPackage="com.codingos.ttxd" targetProject="test1/src/main/java">
<property name="enableSubPackages" value="true" />
<property name="trimStrings" value="true" />
</javaModelGenerator>
<table schema="ttxd" tableName="base_user" />
</context>