首页专题资源列表优化;其他优化
This commit is contained in:
parent
177b5e8a69
commit
c4a4fadfb4
|
@ -62,6 +62,7 @@ public class SysCatalogResourceVo implements Serializable {
|
|||
@Translation(type = TransConstant.OSS_ID_TO_URL)
|
||||
@AutoMapping(target = "cover")
|
||||
private Long coverUrl;
|
||||
|
||||
/**
|
||||
* 资源数量
|
||||
*/
|
||||
|
|
|
@ -2,6 +2,8 @@ package org.dromara.system.domain.vo;
|
|||
|
||||
import io.github.linpeilie.annotations.AutoMapper;
|
||||
import lombok.Data;
|
||||
import org.dromara.common.translation.annotation.Translation;
|
||||
import org.dromara.common.translation.constant.TransConstant;
|
||||
import org.dromara.system.domain.SysHomeTrend;
|
||||
|
||||
import java.io.Serial;
|
||||
|
@ -58,6 +60,8 @@ public class SysHomeTrendVo implements Serializable {
|
|||
*/
|
||||
private Integer status;
|
||||
|
||||
|
||||
private Date createTime;
|
||||
|
||||
@Translation(type = TransConstant.USER_ID_TO_NAME)
|
||||
private Long createBy;
|
||||
}
|
||||
|
|
|
@ -16,5 +16,6 @@ import org.dromara.system.domain.vo.SysCatalogResourceVo;
|
|||
*/
|
||||
@Mapper
|
||||
public interface SysCatalogResourceMapper extends BaseMapperPlus<SysCatalogResource, SysCatalogResourceVo> {
|
||||
Page<SysCatalogResourceVo> selectPageUserList(@Param("page") Page<SysCatalogResource> page, @Param("catalogId") Long catalogId);
|
||||
Page<SysCatalogResourceVo> selectPageList(@Param("page") Page<SysCatalogResource> page, @Param("catalogId") Long catalogId);
|
||||
Page<SysCatalogResourceVo> selectProtalPageList(@Param("page") Page<SysCatalogResource> page);
|
||||
}
|
||||
|
|
|
@ -71,18 +71,20 @@ public class SysCatalogResourceServiceImpl implements ISysCatalogResourceService
|
|||
|
||||
/**
|
||||
* 管理使用
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public TableDataInfo<SysCatalogResourceVo> queryPageList(SysCatalogResourceBo bo, PageQuery pageQuery) {
|
||||
Page<SysCatalogResourceVo> result = baseMapper.selectPageUserList(pageQuery.build(), bo.getCatalogId());
|
||||
Page<SysCatalogResourceVo> result = baseMapper.selectPageList(pageQuery.build(), bo.getCatalogId());
|
||||
return TableDataInfo.build(result);
|
||||
}
|
||||
|
||||
/**
|
||||
* 门户使用
|
||||
*
|
||||
* @param bo 查询条件
|
||||
* @param pageQuery 分页参数
|
||||
* @return
|
||||
|
@ -97,7 +99,7 @@ public class SysCatalogResourceServiceImpl implements ISysCatalogResourceService
|
|||
private LambdaQueryWrapper<SysCatalogResource> buildQueryWrapper(SysCatalogResourceBo bo) {
|
||||
Map<String, Object> params = bo.getParams();
|
||||
LambdaQueryWrapper<SysCatalogResource> lqw = Wrappers.lambdaQuery();
|
||||
lqw.eq(bo.getParentId() != null, SysCatalogResource::getParentId, bo.getParentId());
|
||||
lqw.like(bo.getParentId() != null, SysCatalogResource::getAncestors, bo.getParentId());
|
||||
lqw.eq(bo.getType() != null, SysCatalogResource::getType, bo.getType());
|
||||
return lqw;
|
||||
}
|
||||
|
|
|
@ -4,7 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.dromara.system.mapper.SysCatalogResourceMapper">
|
||||
|
||||
<select id="selectPageUserList" resultType="org.dromara.system.domain.vo.SysCatalogResourceVo">
|
||||
<select id="selectPageList" resultType="org.dromara.system.domain.vo.SysCatalogResourceVo">
|
||||
select cr.catalog_id,cr.parent_id, cr.catalog_name, cr.order_num, count(sor.oss_id) as `resourceNum`
|
||||
from sys_catalog_resource cr
|
||||
left join sys_oss_resource sor on sor.catalog_id = cr.catalog_id
|
||||
|
@ -13,4 +13,23 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||
having cr.parent_id = #{catalogId}
|
||||
order by cr.order_num
|
||||
</select>
|
||||
|
||||
<select id="selectProtalPageList" resultType="org.dromara.system.domain.vo.SysCatalogResourceVo">
|
||||
with recursive cte as (select *
|
||||
from sys_catalog_resource
|
||||
where parent_id = 100
|
||||
union all
|
||||
select d.*
|
||||
from sys_catalog_resource d
|
||||
inner join cte on d.parent_id = cte.catalog_id)
|
||||
select t.catalog_id as catalogId,
|
||||
any_value(t.catalog_name) as catalogName,
|
||||
any_value(t.create_time) as createTime,
|
||||
any_value(o.url) as coverUrl,
|
||||
count(r.id) as resourceNum
|
||||
from cte t
|
||||
left join sys_oss_resource r on r.catalog_id = t.catalog_id
|
||||
left join sys_oss o on o.oss_id = t.cover
|
||||
group by t.catalog_id
|
||||
</select>
|
||||
</mapper>
|
||||
|
|
Loading…
Reference in New Issue