1:jdbcTemplate查询自增最大id long userId =jdbcTemplate.queryForObject("select max(id) from sys_user", Long.class); 2:删除user表中数据(注意没有*号) delete from sys_user_role where userId=?