template.queryForObject(sql,Integer.class,cid);,其中使用Integer.class,而不是int.class,是因为要得到的是一个对象,(一个引用数据类型),而int.class和Integer.class是不同的,而在反射中,如method.invoke(object,int.class),使用int.class,因为它代表的是int类型参数的class对象