use of com.zyd.blog.business.entity.Notice in project OneBlog by zhangyd-c.
the class SysNoticeServiceImpl method getByPrimaryKey.
@Override
public Notice getByPrimaryKey(Long primaryKey) {
Assert.notNull(primaryKey, "PrimaryKey不可为空!");
SysNotice entity = sysNoticeMapper.selectByPrimaryKey(primaryKey);
return null == entity ? null : new Notice(entity);
}
use of com.zyd.blog.business.entity.Notice in project OneBlog by zhangyd-c.
the class SysNoticeServiceImpl method findPageBreakByCondition.
/**
* 分页查询
*
* @param vo
* @return
*/
@Override
public PageInfo<Notice> findPageBreakByCondition(NoticeConditionVO vo) {
PageHelper.startPage(vo.getPageNumber(), vo.getPageSize());
List<SysNotice> list = sysNoticeMapper.findPageBreakByCondition(vo);
if (CollectionUtils.isEmpty(list)) {
return null;
}
List<Notice> boList = new ArrayList<>();
for (SysNotice sysNotice : list) {
boList.add(new Notice(sysNotice));
}
PageInfo bean = new PageInfo<SysNotice>(list);
bean.setList(boList);
return bean;
}
use of com.zyd.blog.business.entity.Notice in project OneBlog by zhangyd-c.
the class RestNoticeController method release.
@RequiresPermissions("notice:release")
@PostMapping("/release/{id}")
@BussinessLog("发布公告通知")
public ResponseVO release(@PathVariable Long id) {
try {
Notice notice = new Notice();
notice.setId(id);
notice.setStatus(NoticeStatusEnum.RELEASE.toString());
noticeService.updateSelective(notice);
} catch (Exception e) {
e.printStackTrace();
return ResultUtil.error("通知发布失败,状态不变!");
}
return ResultUtil.success("该通知已发布,可去前台页面查看效果!");
}
use of com.zyd.blog.business.entity.Notice in project OneBlog by zhangyd-c.
the class RestNoticeController method withdraw.
@RequiresPermissions("notice:withdraw")
@PostMapping("/withdraw/{id}")
@BussinessLog("撤回公告通知")
public ResponseVO withdraw(@PathVariable Long id) {
try {
Notice notice = new Notice();
notice.setId(id);
notice.setStatus(NoticeStatusEnum.NOT_RELEASE.toString());
noticeService.updateSelective(notice);
} catch (Exception e) {
e.printStackTrace();
return ResultUtil.error("通知撤回失败,状态不变!");
}
return ResultUtil.success("该通知已撤回,可修改后重新发布!");
}
Aggregations