|
@@ -0,0 +1,49 @@
|
|
|
+package com.gyee.knowledge;
|
|
|
+
|
|
|
+
|
|
|
+import com.gyee.knowledge.model.auto.Testmis;
|
|
|
+import com.gyee.knowledge.service.auto.ITestmisService;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+
|
|
|
+import org.junit.Test;
|
|
|
+import org.junit.runner.RunWith;
|
|
|
+import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
|
|
|
+import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
|
|
|
+import org.springframework.boot.test.context.SpringBootTest;
|
|
|
+import org.springframework.test.context.junit4.SpringRunner;
|
|
|
+
|
|
|
+
|
|
|
+import javax.annotation.Resource;
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @ClassName : Monitortest
|
|
|
+ * @Author : xieshengjie
|
|
|
+ * @Date: 2021/12/10 14:55
|
|
|
+ * @Description :
|
|
|
+ */
|
|
|
+@Slf4j
|
|
|
+@SpringBootTest
|
|
|
+@RunWith(SpringRunner.class)
|
|
|
+@EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
|
|
|
+public class Monitortest {
|
|
|
+ @Resource
|
|
|
+ private ITestmisService testmisService;
|
|
|
+ @Test
|
|
|
+ public void test(){
|
|
|
+ List<Testmis> list = testmisService.list();
|
|
|
+ List<String> ids = list.stream().map(i -> i.getId()).collect(Collectors.toList());
|
|
|
+ ids.stream().forEach(id->{
|
|
|
+ int count = id.length() / 2;
|
|
|
+ for (int j=0;j<count;j++){
|
|
|
+ Testmis testmis= new Testmis();
|
|
|
+ testmis.setId(id);
|
|
|
+ String substring = id.substring(0, (j + 1) * 2);
|
|
|
+ testmis.setName(substring);
|
|
|
+ System.out.println("'"+testmis.getId()+"!'"+testmis.getName());
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ }
|
|
|
+}
|