Jeecg 用户包含租户字段的快速过滤客户端方法和服务端方法
客户端
1 //获取用户的租户列表 2 let relTenantIds = this.userInfo.relTenantIds; 3 let tenantIds=[]; 4 relTenantIds.split(',').forEach(item=>{ 5 tenantIds.push(+item); 6 }); 7 console.log('======relTenantIds=======', tenantIds) 8 9 10 if(relTenantIds!=undefined) { 11 //过滤组织等于当前组织 12 this.orgList = allList.filter((item, index, arr) => tenantIds.includes(item.id)==true ) 13 }
服务端
1 SysUser sysUserTenant = sysUserService.getUserByName(username); 2 String[] tenantIds = sysUserTenant.getRelTenantIds().split(","); 3 List<String> tenantList = Arrays.asList(tenantIds); 4 if(tenantList.stream().filter(str-> str == tenantId).count()==0) 5 {...}