mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-21 10:35:57 +08:00
数据迁移
This commit is contained in:
parent
292fda421d
commit
6e51aaf06f
@ -27,6 +27,7 @@
|
|||||||
preview_height
|
preview_height
|
||||||
FROM h5_project
|
FROM h5_project
|
||||||
<where>
|
<where>
|
||||||
|
type = 'web_page'
|
||||||
<if test="queryDTO.title != null and queryDTO.title != ''">
|
<if test="queryDTO.title != null and queryDTO.title != ''">
|
||||||
AND MATCH(title) AGAINST(#{queryDTO.title} IN NATURAL LANGUAGE MODE)
|
AND MATCH(title) AGAINST(#{queryDTO.title} IN NATURAL LANGUAGE MODE)
|
||||||
</if>
|
</if>
|
||||||
|
|||||||
@ -25,6 +25,8 @@ public class ImportH5Project {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private H5ProjectService h5ProjectService;
|
private H5ProjectService h5ProjectService;
|
||||||
|
|
||||||
|
private static Set<String> types = new HashSet<>();
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void batchImportH5Projects() {
|
public void batchImportH5Projects() {
|
||||||
// 创建测试项目列表
|
// 创建测试项目列表
|
||||||
@ -116,7 +118,7 @@ public class ImportH5Project {
|
|||||||
project.setType(obj1.getStr("type")); // 设置类型为知乎相关
|
project.setType(obj1.getStr("type")); // 设置类型为知乎相关
|
||||||
|
|
||||||
|
|
||||||
// typeToLowerCase(obj2.getBeanList("layouts", JSONObject.class));
|
getType(obj2.getJSONObject("content").getBeanList("layouts", JSONObject.class));
|
||||||
|
|
||||||
H5ProjectContentDTO ddd = null;
|
H5ProjectContentDTO ddd = null;
|
||||||
try {
|
try {
|
||||||
@ -141,6 +143,8 @@ public class ImportH5Project {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
log.info("打印所有" +
|
||||||
|
"types : {}", types);
|
||||||
|
|
||||||
// 保存项目
|
// 保存项目
|
||||||
boolean result = h5ProjectService.saveBatchH5ProjectsWithContent(projects);
|
boolean result = h5ProjectService.saveBatchH5ProjectsWithContent(projects);
|
||||||
@ -150,18 +154,26 @@ public class ImportH5Project {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 便利全部的元素:typeToLowerCase(content.getBeanList("layouts", JSONObject.class));
|
* 便利全部的元素:typeToLowerCase(content.getBeanList("layouts", JSONObject.class));
|
||||||
|
*
|
||||||
* @param layouts
|
* @param layouts
|
||||||
*/
|
*/
|
||||||
private void typeToLowerCase(List<JSONObject> layouts) {
|
private void getType(List<JSONObject> layouts) {
|
||||||
|
if (layouts == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
for (JSONObject layout : layouts) {
|
for (JSONObject layout : layouts) {
|
||||||
dg(layout.getBeanList("elements", JSONObject.class));
|
deep(layout.getBeanList("elements", JSONObject.class));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
private void dg(List<JSONObject> elements) {
|
|
||||||
|
private void deep(List<JSONObject> elements) {
|
||||||
elements.forEach(item -> {
|
elements.forEach(item -> {
|
||||||
item.set("type", item.getStr("type").toLowerCase(Locale.ROOT));
|
types.add(item.getStr("type"));
|
||||||
|
if (H5ProjectContentDTO.ElementType.fromValue(item.getStr("type")) == null) {
|
||||||
|
log.info("item : {}", item);
|
||||||
|
}
|
||||||
if (item.getStr("type").equals("group")) {
|
if (item.getStr("type").equals("group")) {
|
||||||
dg(item.getBeanList("elements", JSONObject.class));
|
deep(item.getBeanList("elements", JSONObject.class));
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -16,8 +16,8 @@ services:
|
|||||||
volumes:
|
volumes:
|
||||||
- rustfs_data_volume:/data
|
- rustfs_data_volume:/data
|
||||||
environment:
|
environment:
|
||||||
- RUSTFS_ROOT_USER=admin
|
- RUSTFS_ACCESS_KEY=admin
|
||||||
- RUSTFS_ROOT_PASSWORD=admin123
|
- RUSTFS_SECRET_KEY=admin123
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
|
|
||||||
volumes:
|
volumes:
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user