mybatis 获取自增id

474 阅读1分钟
在xml文件中的insertSelective添加 useGeneratedKeys="true" keyProperty="id"

authGroupMapper.insertSelective(authGroup);
Integer recordId=authGroup.getId();/获取主键id