Skip to content
New issue

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.1.0/1.2.1版本insert中使用selectKey时无法返回主键id #6

Closed
kevinjoy89 opened this issue Mar 10, 2023 · 2 comments
Closed
Labels
bug Something isn't working

Comments

@kevinjoy89
Copy link

kevinjoy89 commented Mar 10, 2023

 <insert id="insert" parameterType="com.xxxx.entity.MemberLog">
    <!-- 插入时不设置ID值,数据库自增主键 -->
    insert into .... values ....
    <selectKey keyProperty="id" order="AFTER" resultType="java.lang.Long">
      SELECT LAST_INSERT_ID()
    </selectKey>
</insert>

1.1.0版本:insert中使用selectKey的情况,主键id无法返回(insert标签再次设置keyProperty="id"时可以正常返回主键id);
1.2.1版本:不开启keep-parameter的情况下,insert中使用selectKey的情况,能够正常返回主键id; 设置keep-parameter=true的情况下,无法返回主键id;

备注:不使用mybatis-crypto时以上示例代码补全后可以正常返回主键id

WhiteDG added a commit that referenced this issue Mar 13, 2023
@WhiteDG
Copy link
Owner

WhiteDG commented Mar 13, 2023

感谢反馈,问题已修复,请帮忙使用 1.2.2 版本验证

@kevinjoy89
Copy link
Author

已验证可以正常返回主键id

@WhiteDG WhiteDG added the bug Something isn't working label Mar 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants