Merge pull request '聚才林岗位分权' (#36) from feature/dxf into develop
Reviewed-on: http://221.226.25.34:3000/liang.cheng/weaver-hrm-organization/pulls/36
This commit is contained in:
commit
d743cafac0
|
|
@ -19,12 +19,14 @@ import com.engine.organization.mapper.department.DepartmentMapper;
|
|||
import com.engine.organization.util.OrganizationFormItemUtil;
|
||||
import com.engine.organization.util.db.DBType;
|
||||
import com.engine.organization.util.db.MapperProxyFactory;
|
||||
import com.engine.organization.util.detach.DetachUtil;
|
||||
import com.engine.organization.util.tree.SearchTreeUtil;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import weaver.conn.RecordSet;
|
||||
import weaver.general.Util;
|
||||
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* @author:dxfeng
|
||||
|
|
@ -134,6 +136,9 @@ public class JobBrowserService extends BrowserService {
|
|||
* @return
|
||||
*/
|
||||
private List<TreeNode> getCurrentTreeNode(SearchTreeParams params) {
|
||||
// 分权
|
||||
DetachUtil detachUtil = new DetachUtil(user.getUID());
|
||||
List<Long> jclRoleLevelList = Arrays.asList(detachUtil.getJclRoleLevels().split(",")).stream().map(Long::parseLong).collect(Collectors.toList());
|
||||
List<TreeNode> treeNodes = new ArrayList<>();
|
||||
if (StringUtils.isBlank(params.getId())) {
|
||||
// 集团总部
|
||||
|
|
@ -142,18 +147,32 @@ public class JobBrowserService extends BrowserService {
|
|||
treeNodes.add(topGroup);
|
||||
} else {
|
||||
// 分部存在下级的ID
|
||||
List<String> compHasSubs = MapperProxyFactory.getProxy(CompMapper.class).hasSubs();
|
||||
List<String> compHasSubs;
|
||||
if (detachUtil.isDETACH()) {
|
||||
compHasSubs = MapperProxyFactory.getProxy(CompMapper.class).hasDetachSubs(jclRoleLevelList);
|
||||
} else {
|
||||
compHasSubs = MapperProxyFactory.getProxy(CompMapper.class).hasSubs();
|
||||
}
|
||||
// 部门存在下级的ID
|
||||
List<String> hasSubDepartment = MapperProxyFactory.getProxy(DepartmentMapper.class).hasSubs();
|
||||
|
||||
if ("0".equals(params.getId())) {
|
||||
List<CompPO> compList = MapperProxyFactory.getProxy(CompMapper.class).listParent();
|
||||
List<CompPO> compList;
|
||||
if (detachUtil.isDETACH()) {
|
||||
compList = MapperProxyFactory.getProxy(CompMapper.class).getCompsByIds(jclRoleLevelList);
|
||||
detachUtil.filterCompanyList(compList);
|
||||
}else{
|
||||
compList = MapperProxyFactory.getProxy(CompMapper.class).listParent();
|
||||
}
|
||||
// 获取顶层分部
|
||||
compList.stream().sorted(Comparator.comparing(CompPO::getShowOrder)).forEach(item -> buildCompNodes(treeNodes, compHasSubs, item));
|
||||
} else if ("1".equals(params.getType())) {
|
||||
// 当前节点下的元素
|
||||
CompPO compBuild = CompPO.builder().parentCompany(Long.parseLong(params.getId())).forbiddenTag(0).deleteType(0).build();
|
||||
List<CompPO> compList = MapperProxyFactory.getProxy(CompMapper.class).listByFilter(compBuild, "show_order");
|
||||
if (detachUtil.isDETACH()) {
|
||||
detachUtil.filterCompanyList(compList);
|
||||
}
|
||||
DepartmentPO departmentBuild = DepartmentPO.builder().parentComp(Long.parseLong(params.getId())).forbiddenTag(0).deleteType(0).build();
|
||||
List<DepartmentPO> departmentList = MapperProxyFactory.getProxy(DepartmentMapper.class).listByFilter(departmentBuild, "show_order");
|
||||
compList.forEach(item -> buildCompNodes(treeNodes, compHasSubs, item));
|
||||
|
|
|
|||
|
|
@ -32,6 +32,8 @@ public interface CompMapper {
|
|||
|
||||
List<String> hasSubs();
|
||||
|
||||
List<String> hasDetachSubs(@Param("companyIds") Collection<Long> companyIds);
|
||||
|
||||
/**
|
||||
* 根据搜索条件查询数据
|
||||
*
|
||||
|
|
|
|||
|
|
@ -442,6 +442,25 @@
|
|||
#{uuid}
|
||||
</foreach>
|
||||
</select>
|
||||
<select id="hasDetachSubs" resultType="java.lang.String">
|
||||
select parent_company
|
||||
from jcl_org_comp
|
||||
where forbidden_tag = 0
|
||||
and delete_type = 0
|
||||
and id in
|
||||
<foreach collection="companyIds" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
union
|
||||
select parent_comp
|
||||
from jcl_org_dept
|
||||
where forbidden_tag = 0
|
||||
and delete_type = 0
|
||||
and parent_comp in
|
||||
<foreach collection="companyIds" open="(" item="id" separator="," close=")">
|
||||
#{id}
|
||||
</foreach>
|
||||
</select>
|
||||
|
||||
<update id="updateForbiddenTagById" parameterType="com.engine.organization.entity.sequence.po.SequencePO">
|
||||
update jcl_org_comp
|
||||
|
|
|
|||
Loading…
Reference in New Issue