获取mybatis主键
1.mybatis自动生成的sql语句
<selectKey resultType ="java.lang.Long" keyProperty= "kid" order= "AFTER">
SELECT LAST_INSERT_ID()
</selectKey >
2.在insert标签加属性
<insert id="insertSelective" parameterType="User" useGeneratedKeys="true" keyProperty="id">
</insert>
注:
1.生成的主键会返回到传递的对象中
2.跨服务器访问时无法返回id到远程调用的接口对象