Parcourir la source

2023-3-29 添加一个部门和实验室区别的字段。

chaiyunlong il y a 2 ans
Parent
commit
20b511a64e

+ 13 - 0
zd-model/src/main/java/com/zd/model/entity/SysDept.java

@@ -94,6 +94,11 @@ public class SysDept extends BaseEntity {
     private Integer isLower;
 
     /**
+     * 1是部门,2是实验室
+     */
+    private Integer subOrDept;
+
+    /**
      * 子部门
      */
     private List<SysDept> children = new ArrayList<SysDept>();
@@ -232,6 +237,14 @@ public class SysDept extends BaseEntity {
         this.isLower = isLower;
     }
 
+    public Integer getSubOrDept() {
+        return subOrDept;
+    }
+
+    public void setSubOrDept(Integer subOrDept) {
+        this.subOrDept = subOrDept;
+    }
+
     @Override
     public String toString() {
         return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)

+ 3 - 0
zd-modules/zd-modules-system/src/main/java/com/zd/system/controller/SysDeptController.java

@@ -15,6 +15,7 @@ import com.zd.model.domain.per.PerPrefix;
 import com.zd.model.entity.SysDept;
 import com.zd.system.api.vo.SysDeptListVO;
 import com.zd.system.api.vo.SysDeptVO;
+import com.zd.system.domain.vo.TreeSelect;
 import com.zd.system.service.ISysDeptService;
 import com.zd.system.service.impl.SysDeptManager;
 import io.swagger.annotations.ApiOperation;
@@ -25,6 +26,8 @@ import org.springframework.validation.annotation.Validated;
 import org.springframework.web.bind.annotation.*;
 
 import java.util.*;
+import java.util.function.Predicate;
+import java.util.stream.Collectors;
 
 /**
  * 部门信息

+ 11 - 0
zd-modules/zd-modules-system/src/main/java/com/zd/system/domain/vo/TreeSelect.java

@@ -40,6 +40,8 @@ public class TreeSelect implements Serializable {
      */
     private String deptNum;
 
+    private Integer subOrDept;
+
     /**
      * 子节点
      */
@@ -56,6 +58,7 @@ public class TreeSelect implements Serializable {
         this.parentId = dept.getParentId();
         this.ancestors = dept.getAncestors();
         this.deptNum = dept.getDeptNum();
+        this.subOrDept = dept.getSubOrDept();
         this.children = dept.getChildren().stream().map(TreeSelect::new).collect(Collectors.toList());
     }
 
@@ -112,4 +115,12 @@ public class TreeSelect implements Serializable {
     public void setDeptNum(String deptNum) {
         this.deptNum = deptNum;
     }
+
+    public Integer getSubOrDept() {
+        return subOrDept;
+    }
+
+    public void setSubOrDept(Integer subOrDept) {
+        this.subOrDept = subOrDept;
+    }
 }

+ 3 - 2
zd-modules/zd-modules-system/src/main/resources/mapper/system/SysDeptMapper.xml

@@ -215,13 +215,14 @@
     </select>
     <select id="treeDeptSubSel" resultType="com.zd.model.entity.SysDept">
         select d.* from (
-            select d.dept_id,d.parent_id,d.ancestors,d.dept_name,d.del_flag
+            select d.dept_id,d.parent_id,d.ancestors,d.dept_name,d.del_flag,1 subOrDept
             from sys_dept d
 
             union all
 
             select s.build_id dept_id,s.dept_id parent_id,(select dt.ancestors
-            from sys_dept dt where dt.dept_id = s.build_id) ancestors,s.name dept_name,s.is_del del_flag  from lab_subject s
+            from sys_dept dt where dt.dept_id = s.build_id) ancestors,s.name dept_name,s.is_del del_flag,2 subOrDept
+            from lab_subject s
         )d
         where d.del_flag = '0'
         <if test="parentId != null and parentId != 0">