当前使用版本(必填,否则不予处理)
3.4.1
该问题是如何引起的?(确定最新版也有问题再提!!!)
使用AutoGenerator生成实体类时使用驼峰命名,数据库没有使用下划线,在生成属性时比如字段是userId生成的是userid 都是小写,还有实体如何设置后缀,好像文档中只提到表前缀与字段前缀。
重现步骤(如果有就写完整)
报错信息
Comment From: xcmonline
已解决,后缀只要在全局配置中 gc.setEntity("%sEntity")即可, 字段没有下划线转小驼峰式userName strategy.setNameConvert( new INameConvert() {
@Override
public String entityNameConvert(TableInfo tableInfo) {
return CaseFormat.UPPER_UNDERSCORE.to(CaseFormat.UPPER_CAMEL, tableInfo.getName());
}
@Override
public String propertyNameConvert(TableField field) {
return CaseFormat.UPPER_CAMEL.to(CaseFormat.LOWER_CAMEL, field.getName());
}
}
);
// 自定义配置 InjectionConfig cfg = new InjectionConfig() { @Override public void initMap() { // to do nothing }
@Override
public void initTableMap(TableInfo tableInfo) {
super.initTableMap(tableInfo);
for (TableField tableField : tableInfo.getFields()) {
tableField.setConvert(true);
}
}
};