Browse Source

超管可看到所有部门tree节点

test
smallchill 5 years ago
parent
commit
8bc40a3a4b
  1. 2
      blade-service/blade-system/src/main/java/org/springblade/system/mapper/DeptMapper.xml
  2. 4
      blade-service/blade-system/src/main/java/org/springblade/system/service/impl/DeptServiceImpl.java

2
blade-service/blade-system/src/main/java/org/springblade/system/mapper/DeptMapper.xml

@ -35,7 +35,7 @@
<select id="tree" resultMap="treeNodeResultMap"> <select id="tree" resultMap="treeNodeResultMap">
select id, parent_id, dept_name as title, id as "value", id as "key" from blade_dept where is_deleted = 0 select id, parent_id, dept_name as title, id as "value", id as "key" from blade_dept where is_deleted = 0
<if test="_parameter!=null"> <if test="_parameter!=null and _parameter!=''">
and tenant_id = #{_parameter} and tenant_id = #{_parameter}
</if> </if>
</select> </select>

4
blade-service/blade-system/src/main/java/org/springblade/system/service/impl/DeptServiceImpl.java

@ -20,6 +20,7 @@ import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers; import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.exceptions.ApiException; import com.baomidou.mybatisplus.extension.exceptions.ApiException;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.core.tool.constant.BladeConstant; import org.springblade.core.tool.constant.BladeConstant;
import org.springblade.core.tool.node.ForestNodeMerger; import org.springblade.core.tool.node.ForestNodeMerger;
import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.Func;
@ -47,6 +48,9 @@ public class DeptServiceImpl extends ServiceImpl<DeptMapper, Dept> implements ID
@Override @Override
public List<DeptVO> tree(String tenantId) { public List<DeptVO> tree(String tenantId) {
if (AuthUtil.isAdministrator()) {
tenantId = StringPool.EMPTY;
}
return ForestNodeMerger.merge(baseMapper.tree(tenantId)); return ForestNodeMerger.merge(baseMapper.tree(tenantId));
} }

Loading…
Cancel
Save