【新增】底座新增几个插件需要的API方法

pull/256/MERGE
俞宝山 2025-05-10 12:39:59 +08:00
parent 6539b501ee
commit c9deb49051
4 changed files with 55 additions and 0 deletions

View File

@ -57,4 +57,20 @@ public interface SysOrgApi {
* @date 2022/7/22 14:45
**/
Page<JSONObject> orgListSelector(String parentId);
/**
* id
*
* @author yubaoshan
* @date 2025/5/10 12:13
*/
List<String> getParentIdListByOrgId(String orgId);
/**
* id
*
* @author wangshuo
* @date 2025/01/10 14:45
**/
List<JSONObject> getOrgListByIdListWithoutException(List<String> orgIdList);
}

View File

@ -16,6 +16,7 @@ import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.lang.tree.Tree;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.json.JSONObject;
import cn.hutool.json.JSONUtil;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
@ -25,6 +26,7 @@ import vip.xiaonuo.sys.modular.org.param.SysOrgSelectorOrgListParam;
import vip.xiaonuo.sys.modular.org.service.SysOrgService;
import java.util.List;
import java.util.stream.Collectors;
/**
* API
@ -64,4 +66,14 @@ public class SysOrgApiProvider implements SysOrgApi {
sysOrgSelectorOrgListParam.setParentId(parentId);
return BeanUtil.toBean(sysOrgService.orgListSelector(sysOrgSelectorOrgListParam), Page.class);
}
@Override
public List<String> getParentIdListByOrgId(String orgId) {
return sysOrgService.getParentIdListByOrgId(orgId);
}
@Override
public List<JSONObject> getOrgListByIdListWithoutException(List<String> orgIdList) {
return sysOrgService.listByIds(orgIdList).stream().map(JSONUtil::parseObj).collect(Collectors.toList());
}
}

View File

@ -172,4 +172,12 @@ public interface SysOrgService extends IService<SysOrg> {
* @date 2022/4/24 20:08
*/
Page<SysUser> userSelector(SysOrgSelectorUserParam sysOrgSelectorUserParam);
/**
* id
*
* @author yubaoshan
* @date 2025/5/10 12:13
*/
List<String> getParentIdListByOrgId(String orgId);
}

View File

@ -331,6 +331,25 @@ public class SysOrgServiceImpl extends ServiceImpl<SysOrgMapper, SysOrg> impleme
}
}
@Override
public List<String> getParentIdListByOrgId(String orgId) {
List<SysOrg> sysOrgList = this.getAllOrgList();
List<String> resultList = CollectionUtil.newArrayList();
if(ObjectUtil.isNotEmpty(sysOrgList)) {
execRecursionFindParentByList(orgId, sysOrgList, resultList);
}
return resultList;
}
private List<String> execRecursionFindParentByList(String id, List<SysOrg> list,List<String> resultList) {
SysOrg parentById = list.stream().filter(sysOrg -> sysOrg.getId().equals(id)).findFirst().orElse(null);
if(ObjectUtil.isNotEmpty(parentById)) {
resultList.add(parentById.getParentId());
execRecursionFindParentByList(parentById.getParentId(), list, resultList);
}
return resultList;
}
/* ====以下为各种递归方法==== */
@Override