mybatis自動生成後沒法獲取主鍵id問題

         使用mybatis的自動生成工具生成的主鍵id:java

 

 

<selectKey resultType="java.lang.Integer" keyProperty="id" order="AFTER" >
SELECT LAST_INSERT_ID()
</selectKey>

使用sharding-jdbc時候 一直提示 分片報錯, 可使用這種方式解決:
<insert id="insertSelective" parameterType="com.zhuanche.driver.entity.FeedBack" keyProperty="id" useGeneratedKeys="true">...</insert>
相關文章
相關標籤/搜索