Commit 491d88ab authored by 赵啸非's avatar 赵啸非

修改导出业务

parent 81a13ff3
...@@ -2,6 +2,7 @@ package com.mortals.xhx.module.dept.model; ...@@ -2,6 +2,7 @@ package com.mortals.xhx.module.dept.model;
import java.util.List; import java.util.List;
import java.util.ArrayList; import java.util.ArrayList;
import com.mortals.xhx.module.dept.model.vo.DeptVo; import com.mortals.xhx.module.dept.model.vo.DeptVo;
import com.fasterxml.jackson.annotation.JsonInclude; import com.fasterxml.jackson.annotation.JsonInclude;
import com.mortals.xhx.module.staff.model.StaffEntity; import com.mortals.xhx.module.staff.model.StaffEntity;
...@@ -11,12 +12,13 @@ import org.springframework.util.ObjectUtils; ...@@ -11,12 +12,13 @@ import org.springframework.util.ObjectUtils;
import java.io.Serializable; import java.io.Serializable;
import java.util.Map; import java.util.Map;
import java.util.stream.Collectors; import java.util.stream.Collectors;
/** /**
* 部门信息前端映射树结构实体类 * 部门信息前端映射树结构实体类
* *
* @author zxfei * @author zxfei
* @date 2023-03-06 * @date 2023-03-06
*/ */
@Data @Data
public class DeptTreeSelect implements Serializable { public class DeptTreeSelect implements Serializable {
private static final long serialVersionUID = 1L; private static final long serialVersionUID = 1L;
...@@ -31,6 +33,8 @@ public class DeptTreeSelect implements Serializable { ...@@ -31,6 +33,8 @@ public class DeptTreeSelect implements Serializable {
*/ */
private String label; private String label;
private Integer personNum;
/** /**
* 子节点 * 子节点
*/ */
...@@ -41,15 +45,21 @@ public class DeptTreeSelect implements Serializable { ...@@ -41,15 +45,21 @@ public class DeptTreeSelect implements Serializable {
* 子节点 * 子节点
*/ */
@JsonInclude(JsonInclude.Include.NON_EMPTY) @JsonInclude(JsonInclude.Include.NON_EMPTY)
private List<Map<String,Object>> personList; private List<Map<String, Object>> personList;
public DeptTreeSelect(DeptEntity entity) { public DeptTreeSelect(DeptEntity entity) {
this.id = entity.getId(); this.id = entity.getId();
this.label = entity.getDeptName(); this.label = entity.getDeptName();
if(!ObjectUtils.isEmpty(entity.getChildren())){ this.personNum = entity.getPersonNum();
if (!ObjectUtils.isEmpty(entity.getChildren())) {
this.children = entity.getChildren().stream().map(DeptTreeSelect::new).collect(Collectors.toList()); this.children = entity.getChildren().stream().map(DeptTreeSelect::new).collect(Collectors.toList());
int sum = entity.getChildren().stream().mapToInt(i -> i.getPersonNum()).sum();
this.personNum = this.personNum + sum;
} }
this.personList = entity.getPersonList(); this.personList = entity.getPersonList();
} }
} }
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