Mybatis 获取自增主键
1、设置<insert>, keyProperty的设置为插入表的自增主键名
useGeneratedKeys="true" keyProperty="id"

2、如果传入值为 JavaBean 类型,且有 id 属性,则数据插入成功后,JavaBean的id会自动取自增主键值;
如果不想传 Bean,则可传Map。
Map map = new HashMap();
map.put("id", 0);
map.put("xxx", "xxx");
1、设置<insert>, keyProperty的设置为插入表的自增主键名
useGeneratedKeys="true" keyProperty="id"

2、如果传入值为 JavaBean 类型,且有 id 属性,则数据插入成功后,JavaBean的id会自动取自增主键值;
如果不想传 Bean,则可传Map。
Map map = new HashMap();
map.put("id", 0);
map.put("xxx", "xxx");