From c9891f11c430d12bdd14a6f4f29744367bf4de45 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=9C=80=E5=90=8E?= <244387066@qq.com> Date: Fri, 21 Jun 2024 01:29:31 +0000 Subject: [PATCH 1/2] =?UTF-8?q?update=20mybatis-flex-core/src/main/java/co?= =?UTF-8?q?m/mybatisflex/core/keygen/CustomKeyGenerator.java.=20fix:=20?= =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E5=AE=9E=E4=BD=93=E7=B1=BB=E7=9A=84=E7=88=B6?= =?UTF-8?q?=E7=B1=BB=E5=90=AB=E6=9C=89=E6=B3=9B=E5=9E=8B=E6=97=B6=EF=BC=8C?= =?UTF-8?q?=E8=BD=AC=E6=8D=A2=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit close: https://github.com/mybatis-flex/mybatis-flex/issues/354 Signed-off-by: 最后 <244387066@qq.com> --- .../com/mybatisflex/core/keygen/CustomKeyGenerator.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/mybatis-flex-core/src/main/java/com/mybatisflex/core/keygen/CustomKeyGenerator.java b/mybatis-flex-core/src/main/java/com/mybatisflex/core/keygen/CustomKeyGenerator.java index da46f386..669ae0d1 100644 --- a/mybatis-flex-core/src/main/java/com/mybatisflex/core/keygen/CustomKeyGenerator.java +++ b/mybatis-flex-core/src/main/java/com/mybatisflex/core/keygen/CustomKeyGenerator.java @@ -80,8 +80,10 @@ public class CustomKeyGenerator implements KeyGenerator { MetaObject metaParam = configuration.newMetaObject(parameter); Object generateId = keyGenerator.generate(entity, idInfo.getColumn()); MetaObject metaObjectForProperty = metaParam.metaObjectForProperty(FlexConsts.ENTITY); - Invoker setInvoker = tableInfo.getReflector().getSetInvoker(idInfo.getProperty()); - Object id = ConvertUtil.convert(generateId, setInvoker.getType()); + // Invoker setInvoker = tableInfo.getReflector().getSetInvoker(idInfo.getProperty()); + // Object id = ConvertUtil.convert(generateId, setInvoker.getType()); + Class setterType = tableInfo.getReflector().getSetterType(idInfo.getProperty()); + Object id = ConvertUtil.convert(generateId, setterType); this.setValue(metaObjectForProperty, this.idInfo.getProperty(), id); } } catch (Exception e) { From 29a14baac2b7a4d20b023a904f2746987f84ccf2 Mon Sep 17 00:00:00 2001 From: Frank <1989048+Frank_HL@user.noreply.gitee.com> Date: Thu, 27 Jun 2024 17:20:53 +0000 Subject: [PATCH 2/2] =?UTF-8?q?update=20docs/zh/others/codegen.md.=20?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3=20=E6=96=87=E6=A1=A3=20=E5=BF=AB=E9=80=9F?= =?UTF-8?q?=E5=BC=80=E5=A7=8B=20=E7=A4=BA=E4=BE=8B=E4=BB=A3=E7=A0=81?= =?UTF-8?q?=E4=BD=BF=E7=94=A8=E9=94=99=E8=AF=AF=E7=9A=84=E6=96=B9=E6=B3=95?= =?UTF-8?q?=E5=90=8D=E7=9A=84=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/zh/others/codegen.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/zh/others/codegen.md b/docs/zh/others/codegen.md index 707868fe..3d8cddf9 100644 --- a/docs/zh/others/codegen.md +++ b/docs/zh/others/codegen.md @@ -79,7 +79,7 @@ public class Codegen { globalConfig.setEntityGenerateEnable(true); globalConfig.setEntityWithLombok(true); //设置项目的JDK版本,项目的JDK为14及以上时建议设置该项,小于14则可以不设置 - globalConfig.setJdkVersion(17); + globalConfig.setEntityJdkVersion(17); //设置生成 mapper globalConfig.setMapperGenerateEnable(true);