【通用】biz模块跟api增加其他模块调用的api接口,权限鉴权可设置数据范围

pull/240/head
俞宝山 2024-11-01 20:02:09 +08:00
parent f8ff3686a2
commit 563bdda3fa
4 changed files with 172 additions and 0 deletions

View File

@ -0,0 +1,44 @@
/*
* Copyright [2022] [https://www.xiaonuo.vip]
*
* SnowyAPACHE LICENSE 2.0使
*
* 1.LICENSE
* 2.Snowy
* 3.使使
* 4. https://www.xiaonuo.vip
* 5.xiaonuobase@qq.com
* 6.Snowy https://www.xiaonuo.vip
*/
package vip.xiaonuo.biz.api;
import cn.hutool.core.lang.tree.Tree;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.util.List;
/**
* API
*
* @author yubaoshan
* @date 2024/11/1 18:27:51
**/
public interface BizOrgApi {
/**
*
*
* @author yubaoshan
* @date 2024/11/1 18:27:51
**/
List<Tree<String>> orgTreeSelector();
/**
*
*
* @author yubaoshan
* @date 2024/11/1 18:27:51
**/
Page<JSONObject> orgListSelector(String parentId);
}

View File

@ -0,0 +1,33 @@
/*
* Copyright [2022] [https://www.xiaonuo.vip]
*
* SnowyAPACHE LICENSE 2.0使
*
* 1.LICENSE
* 2.Snowy
* 3.使使
* 4. https://www.xiaonuo.vip
* 5.xiaonuobase@qq.com
* 6.Snowy https://www.xiaonuo.vip
*/
package vip.xiaonuo.biz.api;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
/**
* Api
*
* @author yubaoshan
* @date 2024/11/1 18:27:51
**/
public interface BizUserApi {
/**
*
*
* @author yubaoshan
* @date 2024/11/1 18:27:51
*/
Page<JSONObject> userSelector(String orgId, String searchKey);
}

View File

@ -0,0 +1,50 @@
/*
* Copyright [2022] [https://www.xiaonuo.vip]
*
* SnowyAPACHE LICENSE 2.0使
*
* 1.LICENSE
* 2.Snowy
* 3.使使
* 4. https://www.xiaonuo.vip
* 5.xiaonuobase@qq.com
* 6.Snowy https://www.xiaonuo.vip
*/
package vip.xiaonuo.biz.modular.org.provider;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.lang.tree.Tree;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import vip.xiaonuo.biz.api.BizOrgApi;
import vip.xiaonuo.biz.modular.org.param.BizOrgSelectorOrgListParam;
import vip.xiaonuo.biz.modular.org.service.BizOrgService;
import java.util.List;
/**
* API
*
* @author yubaoshan
* @date 2024/11/1 18:27:51
**/
@Service
public class BizOrgApiProvider implements BizOrgApi {
@Resource
private BizOrgService bizOrgService;
@Override
public List<Tree<String>> orgTreeSelector() {
return bizOrgService.orgTreeSelector();
}
@SuppressWarnings("ALL")
@Override
public Page<JSONObject> orgListSelector(String parentId) {
BizOrgSelectorOrgListParam bizOrgSelectorOrgListParam = new BizOrgSelectorOrgListParam();
bizOrgSelectorOrgListParam.setParentId(parentId);
return BeanUtil.toBean(bizOrgService.orgListSelector(bizOrgSelectorOrgListParam), Page.class);
}
}

View File

@ -0,0 +1,45 @@
/*
* Copyright [2022] [https://www.xiaonuo.vip]
*
* SnowyAPACHE LICENSE 2.0使
*
* 1.LICENSE
* 2.Snowy
* 3.使使
* 4. https://www.xiaonuo.vip
* 5.xiaonuobase@qq.com
* 6.Snowy https://www.xiaonuo.vip
*/
package vip.xiaonuo.biz.modular.user.provider;
import cn.hutool.core.bean.BeanUtil;
import cn.hutool.json.JSONObject;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import vip.xiaonuo.biz.api.BizUserApi;
import vip.xiaonuo.biz.modular.user.param.BizUserSelectorUserParam;
import vip.xiaonuo.biz.modular.user.service.BizUserService;
/**
* API
*
* @author xuyuxiang
* @date 2022/6/20 18:24
**/
@Service
public class BizUserApiProvider implements BizUserApi {
@Resource
private BizUserService bizUserService;
@SuppressWarnings("ALL")
@Override
public Page<JSONObject> userSelector(String orgId, String searchKey) {
BizUserSelectorUserParam bizUserSelectorUserParam = new BizUserSelectorUserParam();
bizUserSelectorUserParam.setOrgId(orgId);
bizUserSelectorUserParam.setSearchKey(searchKey);
return BeanUtil.toBean(bizUserService.userSelector(bizUserSelectorUserParam), Page.class);
}
}