bug
This commit is contained in:
@ -2217,12 +2217,27 @@ public class EquipmentCardController {
|
||||
HttpServletResponse response, Model model) throws IOException {
|
||||
String wherestr = " where 1=1 ";
|
||||
String unitId = request.getParameter("unitId");
|
||||
if (unitId == null || unitId.isEmpty()) {
|
||||
unitId = request.getParameter("companyId");
|
||||
}
|
||||
String search_name = request.getParameter("search_name");
|
||||
if (search_name == null || search_name.trim().isEmpty()) {
|
||||
search_name = request.getParameter("equipmentName");
|
||||
}
|
||||
String processSectionId = request.getParameter("processSectionId");
|
||||
if (processSectionId == null || processSectionId.trim().isEmpty() || "undefined".equals(processSectionId)) {
|
||||
processSectionId = request.getParameter("processSection");
|
||||
}
|
||||
String equipmentClassId = request.getParameter("equipmentClassId");
|
||||
if (equipmentClassId == null || equipmentClassId.trim().isEmpty() || "undefined".equals(equipmentClassId)) {
|
||||
equipmentClassId = request.getParameter("search_pid1");
|
||||
}
|
||||
String equipmentLevel = request.getParameter("equipmentLevel");
|
||||
String equipmentClassCode = request.getParameter("equipmentClassCode");//类似竹一的计量表 该页面仅显示一种设备类型的
|
||||
String ids = request.getParameter("ids");//页面勾选的设备id
|
||||
if (ids == null || ids.trim().isEmpty()) {
|
||||
ids = request.getParameter("equipmentIds");
|
||||
}
|
||||
|
||||
if (unitId != null && !unitId.isEmpty()) {
|
||||
//获取公司下所有子节点
|
||||
@ -2272,6 +2287,26 @@ public class EquipmentCardController {
|
||||
|
||||
// System.out.println(wherestr);
|
||||
|
||||
if (ids != null && !ids.trim().isEmpty()) {
|
||||
// 兼容前端可能携带的首尾逗号与空白,确保仅导出选中设备。
|
||||
String[] idArr = ids.split(",");
|
||||
StringBuilder selectedIds = new StringBuilder();
|
||||
for (String id : idArr) {
|
||||
if (id != null) {
|
||||
String trimmedId = id.trim();
|
||||
if (!trimmedId.isEmpty()) {
|
||||
if (selectedIds.length() > 0) {
|
||||
selectedIds.append("','");
|
||||
}
|
||||
selectedIds.append(trimmedId);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (selectedIds.length() > 0) {
|
||||
wherestr += " and id in ('" + selectedIds + "') ";
|
||||
}
|
||||
}
|
||||
|
||||
List<EquipmentCard> equipmentCards = this.equipmentCardService.selectListByWhere(wherestr);
|
||||
//导出文件到指定目录,兼容Linux
|
||||
this.equipmentCardService.downloadEquipmentExcel(response, equipmentCards);
|
||||
|
||||
Reference in New Issue
Block a user