公告修改
This commit is contained in:
@@ -91,4 +91,39 @@ public class AnnouncementService {
|
||||
public boolean announcementExists(Long id) {
|
||||
return getAnnouncementById(id) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据归属ID获取公告(分页)
|
||||
*/
|
||||
public List<Announcement> getAnnouncementsByBelongId(Integer belongId, int size, int offset) {
|
||||
return announcementMapper.findByBelongId(belongId, size, offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据归属ID获取公告数量
|
||||
*/
|
||||
public long getAnnouncementCountByBelongId(Integer belongId) {
|
||||
return announcementMapper.countByBelongId(belongId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据归属ID和启用状态获取公告(分页)
|
||||
*/
|
||||
public List<Announcement> getAnnouncementsByBelongIdAndEnabled(Integer belongId, Boolean enabled, int size, int offset) {
|
||||
return announcementMapper.findByBelongIdAndEnabled(belongId, enabled, size, offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据归属ID和启用状态获取公告数量
|
||||
*/
|
||||
public long getAnnouncementCountByBelongIdAndEnabled(Integer belongId, Boolean enabled) {
|
||||
return announcementMapper.countByBelongIdAndEnabled(belongId, enabled);
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取指定归属ID的启用公告(用于前端显示)
|
||||
*/
|
||||
public List<Announcement> getEnabledAnnouncementsByBelongId(Integer belongId) {
|
||||
return announcementMapper.findByBelongIdAndEnabled(belongId, true, 10, 0); // 最多返回10条启用的公告
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user