|
|
@@ -0,0 +1,37 @@
|
|
|
+import cn.reghao.dfs.store.DfsStoreApplication;
|
|
|
+import cn.reghao.dfs.store.db.mapper.ImageFileMapper;
|
|
|
+import cn.reghao.dfs.store.model.po.ImageFile;
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.junit.Test;
|
|
|
+import org.junit.runner.RunWith;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.boot.test.context.SpringBootTest;
|
|
|
+import org.springframework.test.context.ActiveProfiles;
|
|
|
+import org.springframework.test.context.junit4.SpringRunner;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author reghao
|
|
|
+ * @date 2023-05-31 22:25:21
|
|
|
+ */
|
|
|
+@Slf4j
|
|
|
+@ActiveProfiles("dev")
|
|
|
+@SpringBootTest(classes = DfsStoreApplication.class)
|
|
|
+@RunWith(SpringRunner.class)
|
|
|
+public class ImageFileTest {
|
|
|
+ @Autowired
|
|
|
+ ImageFileMapper imageFileMapper;
|
|
|
+
|
|
|
+ @Test
|
|
|
+ public void imageTest() {
|
|
|
+ List<ImageFile> list = imageFileMapper.findAll();
|
|
|
+ list.forEach(imageFile -> {
|
|
|
+ String url = imageFile.getUrl();
|
|
|
+ String url1 = url.replace("file.reghao.cn", "oss.reghao.cn");
|
|
|
+ imageFile.setOriginalUrl(url1);
|
|
|
+
|
|
|
+ imageFileMapper.updateOriginalUrl(imageFile);
|
|
|
+ });
|
|
|
+ }
|
|
|
+}
|