mapper层
@Insert("insert into t_user (username,password,valid,create_time) values (#{username},#{password},#{valid},#{createTime})") @Options(useGeneratedKeys=true, keyProperty="id", keyColumn="id") int add(User user);
获取返回的id
User user = new User(); user.setUsername("测试"); userMapper.add(user); System.out.println("用户的自增id为"+user.getId());