|
@@ -177,9 +177,13 @@ public class SysDeptController extends BaseController {
|
|
@ApiOperation("部门导出")
|
|
@ApiOperation("部门导出")
|
|
public void export(HttpServletResponse response, @RequestBody SysDept dept) {
|
|
public void export(HttpServletResponse response, @RequestBody SysDept dept) {
|
|
List<SysDept> depts = deptService.selectDeptListAll(dept);
|
|
List<SysDept> depts = deptService.selectDeptListAll(dept);
|
|
- for (SysDept sysDept : depts) {
|
|
|
|
- SysDept current= deptService.selectDeptById(sysDept.getParentId());
|
|
|
|
- sysDept.setParentName(current.getDeptName());
|
|
|
|
|
|
+ if (!ObjectUtils.isEmpty(depts)) {
|
|
|
|
+ for (SysDept sysDept : depts) {
|
|
|
|
+ SysDept current = deptService.selectDeptById(sysDept.getParentId());
|
|
|
|
+ if (!ObjectUtils.isEmpty(current)) {
|
|
|
|
+ sysDept.setParentName(current.getDeptName());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
}
|
|
}
|
|
ExcelUtil<SysDept> util = new ExcelUtil<SysDept>(SysDept.class);
|
|
ExcelUtil<SysDept> util = new ExcelUtil<SysDept>(SysDept.class);
|
|
util.exportExcel(response, depts, "部门数据");
|
|
util.exportExcel(response, depts, "部门数据");
|