调整排序

This commit is contained in:
xpecya 2024-12-15 16:32:06 +08:00
parent 44b8a3e7e8
commit 5be3ae55c7
1 changed files with 17 additions and 2 deletions

View File

@ -290,8 +290,7 @@ public class NewsService {
// newsId = newsMapper.getLastInsertId(); // newsId = newsMapper.getLastInsertId();
// List<News> newList = newsMapper.queryNews(null, null, null, null, "createTime", null, 1, 0); // List<News> newList = newsMapper.queryNews(null, null, null, null, "createTime", null, 1, 0);
// newsId = newList.get(0).getId(); // newsId = newList.get(0).getId();
newsId = newsId = newsMapper.getNewsLastInsertId(); newsId = newsMapper.getNewsLastInsertId();
} }
Long newIdRl; Long newIdRl;
@ -562,6 +561,22 @@ public class NewsService {
public PageObject<NewsVO> queryNews(String keyword, String columnParam, Integer status, int page, int size, public PageObject<NewsVO> queryNews(String keyword, String columnParam, Integer status, int page, int size,
Integer last, Integer current, String orderBy, String direction) { Integer last, Integer current, String orderBy, String direction) {
if (StringUtils.hasText(orderBy)) {
switch (orderBy) {
case "publishTime": {
orderBy = "publish_time";
break;
}
case "updateTime": {
orderBy = "update_time";
break;
}
case "createTime": {
orderBy = "create_time";
break;
}
}
}
int offset = 0; int offset = 0;
if (current != null) { if (current != null) {
// offset = (Math.max(0, page - current)) * size; // offset = (Math.max(0, page - current)) * size;