fix 86912 功能安全中心--成员维护-勾选后导出却导出了所有数据

This commit is contained in:
lijiarao
2024-07-08 13:41:36 +08:00
parent a02dcd8d94
commit 939446f9a7
@@ -35,6 +35,7 @@ import javax.servlet.http.HttpServletResponse;
import java.util.Arrays;
import java.util.List;
import java.util.Objects;
import java.util.stream.Collectors;
/**
* 功能安全中心成员(pay_functional_safety_center_subitem)表控制层
@@ -200,8 +201,20 @@ public class SafetyCenterSubitemController extends JeroController<SafetyCenterSu
public ModelAndView exportXls(HttpServletRequest request, SafetyCenterSubitem safetyCenterSubitem) {
Page<SafetyCenterSubitem> page = new Page<>(-1, -1);
IPage<SafetyCenterSubitem> pageList = safetyCenterSubitemService.pageList(page, safetyCenterSubitem);
List<SafetyCenterSubitem> list = pageList.getRecords();
return super.exportListXls(list, SafetyCenterSubitem.class, "功能安全中心成员");
List<SafetyCenterSubitem> records = pageList.getRecords();
List<SafetyCenterSubitem> exportList;
// 过滤选中数据
String selections = request.getParameter("selections");
if (oConvertUtils.isNotEmpty(selections)) {
List<String> selectionList = Arrays.asList(selections.split(","));
exportList = records.stream().filter(item -> selectionList.contains(item.getId())).collect(Collectors.toList());
}else {
exportList = records;
}
if (exportList.isEmpty()) {
throw new JeroBootException("没有数据");
}
return super.exportListXls(exportList, SafetyCenterSubitem.class, "功能安全中心成员");
}
/**