Commit 0dcbba29 by guojuxing

复制装修页面

parent deab0485
......@@ -31,6 +31,8 @@ import org.springframework.transaction.annotation.Transactional;
import org.springframework.transaction.interceptor.TransactionAspectSupport;
import java.util.*;
import java.util.stream.Collectors;
/**
*
* @ClassName: AppletCustomPageApiServiceImpl
......@@ -367,6 +369,7 @@ public class AppletCustomPageApiServiceImpl implements AppletCustomPageApiServic
return ServiceResponse.success();
}
@Transactional(rollbackFor = Exception.class)
@Override
public ServiceResponse<Void> copyPage(Integer pageId) {
TabAppletCustomPage record = exist(pageId);
......@@ -379,7 +382,12 @@ public class AppletCustomPageApiServiceImpl implements AppletCustomPageApiServic
//复制组件数据
List<TabAppletPageComponent> componentList = appletPageComponentService.listByPageId(pageId);
if (CollectionUtils.isNotEmpty(componentList)) {
List<TabAppletPageComponent> copyComponent = componentList.stream().map(e -> {
e.setPageId(newPageId);
e.setComponentId(null);
return e;
}).collect(Collectors.toList());
appletPageComponentService.saveFetch(copyComponent);
}
return ServiceResponse.success();
}
......
......@@ -86,6 +86,12 @@ public class CustomPageController {
return OperationResultUtils.operationResult(result, "设置页面序号");
}
@RequestMapping("/copy-page")
public RestResponse copyPage(Integer pageId) {
ServiceResponse<Void> result = appletCustomPageApiService.copyPage(pageId);
return OperationResultUtils.operationResult(result, "复制页面");
}
@RequestMapping("/delete")
public RestResponse delete(Integer pageId) {
ServiceResponse<String> result = appletCustomPageApiService.delete(pageId);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment