File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed
main/java/com/itfsw/mybatis/generator/plugins
test/java/com/itfsw/mybatis/generator/plugins/tools Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -176,6 +176,15 @@ public void initialized(IntrospectedTable introspectedTable) {
176176 this .logicalDeleteColumn = null ;
177177 warnings .add ("itfsw(逻辑删除插件):" + introspectedTable .getFullyQualifiedTable () + "没有找到您配置的逻辑删除值,请全局或者局部配置logicalDeleteValue和logicalUnDeleteValue值!" );
178178 } else {
179+ // 兼容处理以前一些老用户配置的Long 和 Float配置问题
180+ if (this .logicalDeleteColumn .getFullyQualifiedJavaType ().getFullyQualifiedName ().equals (Long .class .getName ())){
181+ this .logicalUnDeleteValue = this .logicalUnDeleteValue .replaceAll ("L|l" , "" );
182+ this .logicalDeleteValue = this .logicalDeleteValue .replaceAll ("L|l" , "" );
183+ } else if (this .logicalDeleteColumn .getFullyQualifiedJavaType ().getFullyQualifiedName ().equals (Float .class .getName ())){
184+ this .logicalUnDeleteValue = this .logicalUnDeleteValue .replaceAll ("F|f" , "" );
185+ this .logicalDeleteValue = this .logicalDeleteValue .replaceAll ("F|f" , "" );
186+ }
187+
179188 enumInfo .addItem (this .logicalUnDeleteConstName , "未删除" , this .logicalUnDeleteValue );
180189 enumInfo .addItem (this .logicalDeleteConstName , "已删除" , this .logicalDeleteValue );
181190 this .logicalDeleteEnum = enumInfo .generateEnum (commentGenerator , introspectedTable );
Original file line number Diff line number Diff line change @@ -52,16 +52,12 @@ public void setTool(MyBatisGeneratorTool tool) {
5252 */
5353 @ Override
5454 public void refreshProject (String project ) {
55- SqlSession sqlSession = null ;
56- try {
57- // 编译项目
58- sqlSession = tool .compile ();
55+ // 编译项目
56+ try (SqlSession sqlSession = tool .compile ()){
5957 reloadProject (sqlSession , tool .getTargetClassLoader (), tool .getTargetPackage ());
6058 } catch (Exception e ) {
6159 e .printStackTrace ();
6260 Assert .assertTrue (false );
63- } finally {
64- sqlSession .close ();
6561 }
6662 }
6763
You can’t perform that action at this time.
0 commit comments