调用接口时输入数据为List<>集合,可利用Joiner.on(",").join(ids);转化为字符串(以“,”分割)
/* 依赖 <!-- https://mvnrepository.com/artifact/com.google.guava/guava --> <dependency> <groupId>com.google.guava</groupId> <artifactId>guava</artifactId> <version>28.0-jre</version> </dependency>*/ @Test public void testJoiner(){ List ids=new ArrayList<String>(); ids.add("1"); ids.add("2"); String idStr = Joiner.on(",").join(ids); System.out.println(idStr); }
更多详解:https://blog.csdn.net/wwwdc1012/article/details/82228458