统计优化区分租户;门户首页优化区分租户

This commit is contained in:
cjw 2024-06-25 16:02:52 +08:00
parent 9a67b94219
commit 288fc89bd6
5 changed files with 19 additions and 11 deletions

View File

@ -109,7 +109,8 @@ public class PortalController extends BaseController {
@GetMapping("/resource/catalog/pageList")
public TableDataInfo<SysCatalogResourceVo> pageList(HttpServletRequest request,SysCatalogResourceBo bo, PageQuery pageQuery) {
String tenantId = ServletUtils.getHeader(request, "Tenantid");
TenantHelper.setDynamic(tenantId);
//TenantHelper.setDynamic(tenantId);
bo.setAncestors(tenantId);
return resourceService.queryProtalPageList(bo, pageQuery);
}

View File

@ -17,5 +17,5 @@ import org.dromara.system.domain.vo.SysCatalogResourceVo;
@Mapper
public interface SysCatalogResourceMapper extends BaseMapperPlus<SysCatalogResource, SysCatalogResourceVo> {
Page<SysCatalogResourceVo> selectPageList(@Param("page") Page<SysCatalogResource> page, @Param("catalogId") Long catalogId);
Page<SysCatalogResourceVo> selectProtalPageList(@Param("page") Page<SysCatalogResource> page);
Page<SysCatalogResourceVo> selectProtalPageList(@Param("page") Page<SysCatalogResource> page,@Param("tenantId") String tenantId);
}

View File

@ -95,7 +95,9 @@ public class SysCatalogResourceServiceImpl implements ISysCatalogResourceService
public TableDataInfo<SysCatalogResourceVo> queryProtalPageList(SysCatalogResourceBo bo, PageQuery pageQuery) {
//LambdaQueryWrapper<SysCatalogResource> lqw = buildQueryWrapper(bo);
//为了兼容 vo中的 @Translation(type = TransConstant.OSS_ID_TO_URL)
IPage<SysCatalogResourceVo> result = baseMapper.selectProtalPageList(pageQuery.build());
//临时存放
String tenantId = bo.getAncestors();
IPage<SysCatalogResourceVo> result = baseMapper.selectProtalPageList(pageQuery.build(), tenantId);
return TableDataInfo.build(result);
}

View File

@ -4,19 +4,20 @@
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.dromara.system.mapper.StatisticMapper">
<select id="selectGradeNum" resultType="int">
select count(*)
from sys_dept
where parent_id = 100
select count(d.dept_id)
from sys_dept d left join sys_dept p on p.dept_id = d.parent_id
where p.parent_id = 0
<if test="tenantId != null and tenantId != ''">
and tenant_id = #{tenantId}
and d.tenant_id = #{tenantId}
</if>
</select>
<select id="selectCalssNum" resultType="int">
select count(*)
select count(d.dept_id)
from sys_dept d
left join sys_dept p on d.parent_id = p.dept_id
where p.parent_id = 100
left join sys_dept pp on pp.dept_id = p.parent_id
where pp.parent_id = 0
<if test="tenantId != null and tenantId != ''">
and d.tenant_id = #{tenantId}
</if>

View File

@ -18,14 +18,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
with recursive cte as (select *
from sys_catalog_resource
where type = 2
and del_flag = 0
and tenant_id = #{tenantId}
union all
select d.*
from sys_catalog_resource d
inner join cte on d.parent_id = cte.catalog_id)
inner join cte on d.parent_id = cte.catalog_id
where d.del_flag = 0
and d.tenant_id = #{tenantId})
select t.catalog_id as catalogId,
any_value(t.catalog_name) as catalogName,
any_value(t.create_time) as createTime,
any_value(t.cover) as coverUrl,
any_value(t.cover) as coverUrl,
count(r.id) as resourceNum
from cte t
left join sys_oss_resource r on r.catalog_id = t.catalog_id and r.status = 1