mibatis-关于返回自增ID 和 插入自增String 类型的UUid

1. 关于自增主键ID 返回

< selectKey keyProperty="id" order="AFTER" resultType="java.lang.Integer">

            select LAST_INSERT_ID()

</selectKey>

keyProperty:将返回的主键放入传入参数的Id中保存.

order:当前函数相对于insert语句的执行顺序,在insert前执行是before,在insert后执行是AFTER

resultType:id的类型,也就是keyproperties中属性的类型

 

2. 关于生成UUid

 

< selectKey keyProperty="id" order="before" resultType="java.lang.string">

            select uuid()

</selectKey>

posted @ 2017-02-25 19:01  TomCzr  阅读(2875)  评论(1编辑  收藏  举报