【system】更新antdv版本组织机构树获取

pull/3/head
fengshuonan 2021-01-11 21:10:01 +08:00
parent 37438358fa
commit d6924fc276
5 changed files with 62 additions and 42 deletions

View File

@ -1,6 +1,13 @@
package cn.stylefeng.roses.kernel.system.pojo.ztree;
import cn.stylefeng.roses.kernel.rule.abstracts.AbstractTreeNode;
import cn.stylefeng.roses.kernel.system.constants.SystemConstants;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.Setter;
import lombok.ToString;
import java.util.List;
/**
* jquery ztree
@ -8,11 +15,15 @@ import cn.stylefeng.roses.kernel.system.constants.SystemConstants;
* @author fengshuonan
* @date 2021/1/6 21:47
*/
public class ZTreeNode {
@ToString
@EqualsAndHashCode
public class ZTreeNode implements AbstractTreeNode {
/**
* id
*/
@Getter
@Setter
private Long id;
/**
@ -23,23 +34,38 @@ public class ZTreeNode {
/**
*
*/
@Getter
@Setter
private String name;
/**
*
*/
@Getter
@Setter
private Boolean open;
/**
*
*/
@Getter
@Setter
private Boolean checked;
/**
* single or group
*/
@Getter
@Setter
private String iconSkin;
/**
*
*/
@Getter
@Setter
private List children;
/**
* ztree
*
@ -56,51 +82,27 @@ public class ZTreeNode {
return zTreeNode;
}
public Long getId() {
return id;
@Override
public String getNodeId() {
return id.toString();
}
public void setId(Long id) {
this.id = id;
@Override
public String getNodeParentId() {
return pId.toString();
}
public Long getpId() {
return pId;
@Override
public void setChildrenNodes(List childrenNodes) {
this.children = childrenNodes;
}
public void setpId(Long pId) {
this.pId = pId;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Boolean getOpen() {
return open;
}
public void setOpen(Boolean open) {
this.open = open;
}
public Boolean getChecked() {
return checked;
}
public void setChecked(Boolean checked) {
this.checked = checked;
}
public String getIconSkin() {
return iconSkin;
}
public void setIconSkin(String iconSkin) {
this.iconSkin = iconSkin;
public Long getpId() {
return pId;
}
}

View File

@ -425,7 +425,7 @@ public class SysMenuServiceImpl extends ServiceImpl<SysMenuMapper, SysMenu> impl
// 记录菜单节点
menuTreeNodeList.add(menuTree);
}
// 返回结果
if (lateralFlag) {
return menuTreeNodeList;

View File

@ -139,7 +139,20 @@ public class HrOrganizationController {
*/
@GetResource(name = "获取zTree形式的组织机构树用于角色配置数据范围类型并且数据范围类型是指定组织机构时layui版本", path = "/hrOrganization/zTree")
public List<ZTreeNode> layuiSelectParentMenuTreeList(@Validated(HrOrganizationRequest.orgZTree.class) HrOrganizationRequest hrOrganizationRequest) {
return hrOrganizationService.orgZTree(hrOrganizationRequest);
return hrOrganizationService.orgZTree(hrOrganizationRequest, false);
}
/**
* zTreeantd vue
*
* @author fengshuonan
* @date 2021/1/9 18:37
*/
@GetResource(name = "获取zTree形式的组织机构树用于角色配置数据范围类型并且数据范围类型是指定组织机构时antd vue版本", path = "/hrOrganization/treeWithChildren")
public ResponseData treeWithChildren(@Validated(HrOrganizationRequest.orgZTree.class) HrOrganizationRequest hrOrganizationRequest) {
List<ZTreeNode> zTreeNodes = hrOrganizationService.orgZTree(hrOrganizationRequest, true);
return new SuccessResponseData(zTreeNodes);
}
}

View File

@ -119,10 +119,11 @@ public interface HrOrganizationService extends IService<HrOrganization> {
* ztreelayui
*
* @param hrOrganizationRequest
* @param buildTree true-false-
* @return ztree
* @author fengshuonan
* @date 2021/1/9 18:40
*/
List<ZTreeNode> orgZTree(HrOrganizationRequest hrOrganizationRequest);
List<ZTreeNode> orgZTree(HrOrganizationRequest hrOrganizationRequest, boolean buildTree);
}

View File

@ -308,7 +308,7 @@ public class HrOrganizationServiceImpl extends ServiceImpl<HrOrganizationMapper,
}
@Override
public List<ZTreeNode> orgZTree(HrOrganizationRequest hrOrganizationRequest) {
public List<ZTreeNode> orgZTree(HrOrganizationRequest hrOrganizationRequest, boolean buildTree) {
// 获取角色id
Long roleId = hrOrganizationRequest.getRoleId();
@ -328,7 +328,11 @@ public class HrOrganizationServiceImpl extends ServiceImpl<HrOrganizationMapper,
}
}
return zTreeNodes;
if (buildTree) {
return new DefaultTreeBuildFactory<ZTreeNode>().doTreeBuild(zTreeNodes);
} else {
return zTreeNodes;
}
}
/**