收资清单模板导出接口优化

This commit is contained in:
2025-09-02 18:58:56 +08:00
parent 8c131cb9a5
commit e916829032

View File

@ -283,7 +283,6 @@ public class DesCollectServiceImpl extends ServiceImpl<DesCollectMapper, DesColl
@Override
public void exportExcelByDeptId(Long deptId, HttpServletResponse response) {
// 1. 从数据库查询下拉选项
List<String> userNameList = sysUserService.getUserNamesByDept(deptId);
Map<Long, String> userIdToNameMapByDept = sysUserService.getUserIdToNameMapByDept(deptId);
@ -320,7 +319,7 @@ public class DesCollectServiceImpl extends ServiceImpl<DesCollectMapper, DesColl
// 绑定下拉列表(关联隐藏 Sheet
DataValidationHelper helper = mainSheet.getDataValidationHelper(); //为主Sheet第二列设置下拉列表关联隐藏Sheet的B列
String range = "DropdownData!$B$1:$B$" + userNameList.size(); //引用隐藏Sheet的B列数据范围DropdownData!$B$1:$B$
String range = "DropdownData!$B$1:$B$" + userIdToNameMapByDept.size(); //引用隐藏Sheet的B列数据范围DropdownData!$B$1:$B$
DataValidationConstraint constraint = helper.createFormulaListConstraint(range); //创建下拉约束
CellRangeAddressList addressList = new CellRangeAddressList(1, 300, 1, 1); // 支持100行数据
//添加验证规则