fix(cms): 优化文章查询排序逻辑

- 在CmsArticleMapper.xml的分页和查询全部SQL语句中添加排序条件
- 按推荐度降序、排序号升序、创建时间降序排序文章列表
- 移除CmsArticleServiceImpl中重复的默认排序设置逻辑
This commit is contained in:
2026-07-19 12:13:16 +08:00
parent 69f0dce8a4
commit bff5083b02
2 changed files with 2 additions and 1 deletions

View File

@@ -152,11 +152,13 @@
<!-- 分页查询 -->
<select id="selectPageRel" resultType="com.gxwebsoft.cms.entity.CmsArticle">
<include refid="selectSql"></include>
ORDER BY a.recommend DESC, a.sort_number ASC, a.create_time DESC
</select>
<!-- 查询全部 -->
<select id="selectListRel" resultType="com.gxwebsoft.cms.entity.CmsArticle">
<include refid="selectSql"></include>
ORDER BY a.recommend DESC, a.sort_number ASC, a.create_time DESC
</select>
<select id="selectListAllRel" resultType="com.gxwebsoft.cms.entity.CmsArticle">

View File

@@ -65,7 +65,6 @@ public class CmsArticleServiceImpl extends ServiceImpl<CmsArticleMapper, CmsArti
}
}
PageParam<CmsArticle, CmsArticleParam> page = new PageParam<>(param);
page.setDefaultOrder("sort_number asc,create_time desc");
List<CmsArticle> list = baseMapper.selectPageRel(page, param);
return new PageResult<>(list, page.getTotal());