Search in sources :

Example 1 with Notice

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);
}
Also used : SysNotice(com.zyd.blog.persistence.beans.SysNotice) Notice(com.zyd.blog.business.entity.Notice) SysNotice(com.zyd.blog.persistence.beans.SysNotice)

Example 2 with Notice

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;
}
Also used : SysNotice(com.zyd.blog.persistence.beans.SysNotice) PageInfo(com.github.pagehelper.PageInfo) Notice(com.zyd.blog.business.entity.Notice) SysNotice(com.zyd.blog.persistence.beans.SysNotice) ArrayList(java.util.ArrayList)

Example 3 with Notice

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("该通知已发布,可去前台页面查看效果!");
}
Also used : Notice(com.zyd.blog.business.entity.Notice) RequiresPermissions(org.apache.shiro.authz.annotation.RequiresPermissions) PostMapping(org.springframework.web.bind.annotation.PostMapping) BussinessLog(com.zyd.blog.business.annotation.BussinessLog)

Example 4 with Notice

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("该通知已撤回,可修改后重新发布!");
}
Also used : Notice(com.zyd.blog.business.entity.Notice) RequiresPermissions(org.apache.shiro.authz.annotation.RequiresPermissions) PostMapping(org.springframework.web.bind.annotation.PostMapping) BussinessLog(com.zyd.blog.business.annotation.BussinessLog)

Aggregations

Notice (com.zyd.blog.business.entity.Notice)4 BussinessLog (com.zyd.blog.business.annotation.BussinessLog)2 SysNotice (com.zyd.blog.persistence.beans.SysNotice)2 RequiresPermissions (org.apache.shiro.authz.annotation.RequiresPermissions)2 PostMapping (org.springframework.web.bind.annotation.PostMapping)2 PageInfo (com.github.pagehelper.PageInfo)1 ArrayList (java.util.ArrayList)1