We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
1,建议把分页里面的page方法修改为 this.offset = ( page - 1 ) * pageSize; 比较符合使用习惯 page就是页码
2,建议把BatchInsert方法和BatchInsertSelective切分成两个插件 我当前就只想使用BatchInsert方法,就只能修改你的源码了,不太方便
3, 使用作者项目是发现我的一些需求无法解决,就自己写了几个插件 贡献出来希望可以添加到作者的项目里 1>自动生成 mysql generatorKey 的插件 解决每个table设置generatorKey的问题 `
@Override public boolean validate(List<String> list) { return true; } @Override public void initialized(IntrospectedTable introspectedTable) { GeneratedKey gk = introspectedTable.getGeneratedKey(); //如果需要生成参数 if (gk == null) { List<IntrospectedColumn> keyColumns = introspectedTable.getPrimaryKeyColumns(); IntrospectedColumn keyColumn = null; //只能有一个主键列; if (keyColumns.size() == 1) { //得到这个唯一的主键列 keyColumn = keyColumns.get(0); //得到这个列映射成Java模型之后的属性对应的Java类型; FullyQualifiedJavaType javaType = keyColumn.getFullyQualifiedJavaType(); //要求主键只能是递增的,所以我们把这个主键属性的类型分别和Integer,Long,Short做对比; if (javaType.equals(PrimitiveTypeWrapper.getIntegerInstance()) || javaType.equals(PrimitiveTypeWrapper.getLongInstance()) || javaType.equals(PrimitiveTypeWrapper.getShortInstance())) { //设置自增 insert 和 insertSelective 去除字段赋值 keyColumn.setIdentity(true); //设置 Mysql generatedKey 用于生成 selectKey GeneratedKey generatedKey = new GeneratedKey(keyColumn.getActualColumnName(), "Mysql", true, "post"); introspectedTable.getTableConfiguration().setGeneratedKey(generatedKey); } } } super.initialized(introspectedTable); }
`
2> 需要修改mapper后缀为dao 所以写了下面这个插件 ` private String mapperSuffix; private String sqlSuffix;
public boolean validate(List<String> warnings) { //获取配置 mapperSuffix = properties.getProperty("mapperSuffix"); sqlSuffix = properties.getProperty("sqlSuffix"); //至少一个配置 return stringHasValue(mapperSuffix) || stringHasValue(sqlSuffix); } @Override public void initialized(IntrospectedTable introspectedTable) { String modelName = introspectedTable.getFullyQualifiedTable().getDomainObjectName(); if (stringHasValue(mapperSuffix)) { String mapperType = introspectedTable.getMyBatis3JavaMapperType(); mapperType = mapperType.replaceAll(modelName + "Mapper", modelName + mapperSuffix); introspectedTable.setMyBatis3JavaMapperType(mapperType); } if (stringHasValue(sqlSuffix)) { introspectedTable.setMyBatis3XmlMapperFileName(modelName + sqlSuffix); } }`
最后感谢作者的无私奉献,希望项目越做越好
The text was updated successfully, but these errors were encountered:
首先感谢你的建议。
再次感谢你的建议,后继续努力完善该插件库,方便大家减少一些代码开发量。
Sorry, something went wrong.
等待您的下一步完善,谢谢!
No branches or pull requests
1,建议把分页里面的page方法修改为
this.offset = ( page - 1 ) * pageSize;
比较符合使用习惯 page就是页码
2,建议把BatchInsert方法和BatchInsertSelective切分成两个插件
我当前就只想使用BatchInsert方法,就只能修改你的源码了,不太方便
3, 使用作者项目是发现我的一些需求无法解决,就自己写了几个插件
贡献出来希望可以添加到作者的项目里
1>自动生成 mysql generatorKey 的插件 解决每个table设置generatorKey的问题
`
`
2> 需要修改mapper后缀为dao 所以写了下面这个插件
`
private String mapperSuffix;
private String sqlSuffix;
最后感谢作者的无私奉献,希望项目越做越好
The text was updated successfully, but these errors were encountered: