mirror of https://gitee.com/y_project/RuoYi.git
优化部门列表树排除条件
parent
08fc4740d5
commit
f68f4824cd
|
@ -189,7 +189,7 @@ public class SysDeptController extends BaseController
|
|||
public List<Ztree> treeDataExcludeChild(@PathVariable(value = "excludeId", required = false) Long excludeId)
|
||||
{
|
||||
SysDept dept = new SysDept();
|
||||
dept.setDeptId(excludeId);
|
||||
dept.setExcludeId(excludeId);
|
||||
List<Ztree> ztrees = deptService.selectDeptTreeExcludeChild(dept);
|
||||
return ztrees;
|
||||
}
|
||||
|
|
|
@ -1,8 +1,11 @@
|
|||
package com.ruoyi.common.core.domain.entity;
|
||||
|
||||
import javax.validation.constraints.*;
|
||||
import javax.validation.constraints.Email;
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import javax.validation.constraints.Size;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.ruoyi.common.core.domain.BaseEntity;
|
||||
|
||||
/**
|
||||
|
@ -47,6 +50,9 @@ public class SysDept extends BaseEntity
|
|||
/** 父部门名称 */
|
||||
private String parentName;
|
||||
|
||||
/** 排除编号 */
|
||||
private Long excludeId;
|
||||
|
||||
public Long getDeptId()
|
||||
{
|
||||
return deptId;
|
||||
|
@ -163,6 +169,17 @@ public class SysDept extends BaseEntity
|
|||
this.parentName = parentName;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
public Long getExcludeId()
|
||||
{
|
||||
return excludeId;
|
||||
}
|
||||
|
||||
public void setExcludeId(Long excludeId)
|
||||
{
|
||||
this.excludeId = excludeId;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||
|
|
|
@ -70,14 +70,14 @@ public class SysDeptServiceImpl implements ISysDeptService
|
|||
@DataScope(deptAlias = "d")
|
||||
public List<Ztree> selectDeptTreeExcludeChild(SysDept dept)
|
||||
{
|
||||
Long deptId = dept.getDeptId();
|
||||
Long excludeId = dept.getExcludeId();
|
||||
List<SysDept> deptList = deptMapper.selectDeptList(dept);
|
||||
Iterator<SysDept> it = deptList.iterator();
|
||||
while (it.hasNext())
|
||||
{
|
||||
SysDept d = (SysDept) it.next();
|
||||
if (d.getDeptId().intValue() == deptId
|
||||
|| ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), deptId + ""))
|
||||
if (d.getDeptId().intValue() == excludeId
|
||||
|| ArrayUtils.contains(StringUtils.split(d.getAncestors(), ","), excludeId + ""))
|
||||
{
|
||||
it.remove();
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue