首页专题资源列表优化;其他优化

This commit is contained in:
cjw 2024-06-21 10:00:34 +08:00
parent 177b5e8a69
commit c4a4fadfb4
5 changed files with 32 additions and 5 deletions

View File

@ -62,6 +62,7 @@ public class SysCatalogResourceVo implements Serializable {
@Translation(type = TransConstant.OSS_ID_TO_URL) @Translation(type = TransConstant.OSS_ID_TO_URL)
@AutoMapping(target = "cover") @AutoMapping(target = "cover")
private Long coverUrl; private Long coverUrl;
/** /**
* 资源数量 * 资源数量
*/ */

View File

@ -2,6 +2,8 @@ package org.dromara.system.domain.vo;
import io.github.linpeilie.annotations.AutoMapper; import io.github.linpeilie.annotations.AutoMapper;
import lombok.Data; import lombok.Data;
import org.dromara.common.translation.annotation.Translation;
import org.dromara.common.translation.constant.TransConstant;
import org.dromara.system.domain.SysHomeTrend; import org.dromara.system.domain.SysHomeTrend;
import java.io.Serial; import java.io.Serial;
@ -58,6 +60,8 @@ public class SysHomeTrendVo implements Serializable {
*/ */
private Integer status; private Integer status;
private Date createTime; private Date createTime;
@Translation(type = TransConstant.USER_ID_TO_NAME)
private Long createBy;
} }

View File

@ -16,5 +16,6 @@ import org.dromara.system.domain.vo.SysCatalogResourceVo;
*/ */
@Mapper @Mapper
public interface SysCatalogResourceMapper extends BaseMapperPlus<SysCatalogResource, SysCatalogResourceVo> { 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);
} }

View File

@ -71,18 +71,20 @@ public class SysCatalogResourceServiceImpl implements ISysCatalogResourceService
/** /**
* 管理使用 * 管理使用
*
* @param bo 查询条件 * @param bo 查询条件
* @param pageQuery 分页参数 * @param pageQuery 分页参数
* @return * @return
*/ */
@Override @Override
public TableDataInfo<SysCatalogResourceVo> queryPageList(SysCatalogResourceBo bo, PageQuery pageQuery) { 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); return TableDataInfo.build(result);
} }
/** /**
* 门户使用 * 门户使用
*
* @param bo 查询条件 * @param bo 查询条件
* @param pageQuery 分页参数 * @param pageQuery 分页参数
* @return * @return
@ -97,7 +99,7 @@ public class SysCatalogResourceServiceImpl implements ISysCatalogResourceService
private LambdaQueryWrapper<SysCatalogResource> buildQueryWrapper(SysCatalogResourceBo bo) { private LambdaQueryWrapper<SysCatalogResource> buildQueryWrapper(SysCatalogResourceBo bo) {
Map<String, Object> params = bo.getParams(); Map<String, Object> params = bo.getParams();
LambdaQueryWrapper<SysCatalogResource> lqw = Wrappers.lambdaQuery(); 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()); lqw.eq(bo.getType() != null, SysCatalogResource::getType, bo.getType());
return lqw; return lqw;
} }

View File

@ -4,7 +4,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd"> "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="org.dromara.system.mapper.SysCatalogResourceMapper"> <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` select cr.catalog_id,cr.parent_id, cr.catalog_name, cr.order_num, count(sor.oss_id) as `resourceNum`
from sys_catalog_resource cr from sys_catalog_resource cr
left join sys_oss_resource sor on sor.catalog_id = cr.catalog_id 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} having cr.parent_id = #{catalogId}
order by cr.order_num order by cr.order_num
</select> </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> </mapper>