mirror of https://gitee.com/stylefeng/roses
【8.0】更新组织机构详情格式化
parent
83d3b04095
commit
3d8da5a30b
|
@ -0,0 +1,42 @@
|
|||
package cn.stylefeng.roses.kernel.sys.api.format;
|
||||
|
||||
import cn.hutool.core.convert.Convert;
|
||||
import cn.hutool.extra.spring.SpringUtil;
|
||||
import cn.stylefeng.roses.kernel.rule.format.BaseSimpleFieldFormatProcess;
|
||||
import cn.stylefeng.roses.kernel.sys.api.OrganizationServiceApi;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* 组织机构id格式化为获取机构的详情
|
||||
*
|
||||
* @author fengshuonan
|
||||
* @since 2023/7/17 15:36
|
||||
*/
|
||||
public class OrgDetailFormatProcess extends BaseSimpleFieldFormatProcess {
|
||||
|
||||
@Override
|
||||
public Class<?> getItemClass() {
|
||||
return Long.class;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object simpleItemFormat(Object businessId) {
|
||||
|
||||
if (businessId == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
Long orgId = Convert.toLong(businessId);
|
||||
|
||||
OrganizationServiceApi organizationServiceApi = SpringUtil.getBean(OrganizationServiceApi.class);
|
||||
String orgName = organizationServiceApi.getOrgNameById(orgId);
|
||||
|
||||
HashMap<String, Object> orgDetail = new HashMap<>();
|
||||
orgDetail.put("orgId", orgId);
|
||||
orgDetail.put("orgName", orgName);
|
||||
|
||||
return orgDetail;
|
||||
}
|
||||
|
||||
}
|
|
@ -26,7 +26,7 @@ package cn.stylefeng.roses.kernel.sys.modular.role.pojo.response;
|
|||
|
||||
import cn.stylefeng.roses.kernel.rule.annotation.ChineseDescription;
|
||||
import cn.stylefeng.roses.kernel.rule.annotation.SimpleFieldFormat;
|
||||
import cn.stylefeng.roses.kernel.sys.api.format.OrgNameFormatProcess;
|
||||
import cn.stylefeng.roses.kernel.sys.api.format.OrgDetailFormatProcess;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
@ -50,7 +50,7 @@ public class RoleBindDataScopeResponse {
|
|||
* 用户拥有的指定部门的组织机构信息id集合
|
||||
*/
|
||||
@ChineseDescription("用户拥有的指定部门的组织机构信息id集合")
|
||||
@SimpleFieldFormat(processClass = OrgNameFormatProcess.class)
|
||||
@SimpleFieldFormat(processClass = OrgDetailFormatProcess.class)
|
||||
private List<Long> orgIdList;
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue