|
|
@@ -22,6 +22,7 @@ import lombok.RequiredArgsConstructor; |
|
|
|
import org.springframework.stereotype.Component; |
|
|
|
import org.springframework.transaction.annotation.Transactional; |
|
|
|
|
|
|
|
import java.time.LocalDateTime; |
|
|
|
import java.util.List; |
|
|
|
|
|
|
|
/** |
|
|
@@ -64,6 +65,13 @@ public class NoticeManage { |
|
|
|
return noticeService.updateById(notice); |
|
|
|
} |
|
|
|
|
|
|
|
public void topped(Long id) { |
|
|
|
Notice notice = new Notice(); |
|
|
|
notice.setId(id); |
|
|
|
notice.setToppedTime(LocalDateTime.now()); |
|
|
|
noticeService.updateById(notice); |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
public PageVo<NoticeListItemVO> dashboardList(Integer limit) { |
|
|
|
NoticeListReq req = new NoticeListReq(); |
|
|
@@ -77,7 +85,7 @@ public class NoticeManage { |
|
|
|
.eq(req.getEnabled() != null, Notice::getEnabled, req.getEnabled()) |
|
|
|
.like(StrUtil.isNotBlank(req.getTitle()), Notice::getTitle, req.getTitle()) |
|
|
|
.eq(req.getType() != null, Notice::getType, req.getType()) |
|
|
|
.orderByDesc(Notice::getSetTopTime, Notice::getUpdateOn); |
|
|
|
.orderByDesc(Notice::getToppedTime, Notice::getUpdateOn); |
|
|
|
Page<Notice> page = noticeService.page(req.page(), wrapper); |
|
|
|
if (page.getTotal() == 0) { |
|
|
|
return PageVo.empty(); |
|
|
@@ -89,7 +97,7 @@ public class NoticeManage { |
|
|
|
.title(w.getTitle()) |
|
|
|
.enabled(w.getEnabled()) |
|
|
|
.createOn(w.getCreateOn()) |
|
|
|
.topped(w.getSetTopTime() != null) |
|
|
|
.topped(w.getToppedTime() != null) |
|
|
|
.build()); |
|
|
|
return PageVo.of(tempDataList, page.getTotal()); |
|
|
|
} |
|
|
|