@Insert("insert into table(name, phone) value(#{name},#{phone})")
@Options(useGeneratedKeys = true,keyProperty = "id",keyColumn = "id")//加入该注解可以保持对象后,查看对象插入id
public int insert(Object object);
}
@Service
public class ObjectService {
@Resource
private ObjectDao objectDao;
public int insert(Object o){
objectDao.insert(o);
return o.getId();
}
}
网友评论