Пример #1
0
 @Transactional(readOnly = false)
 public void save(Link link) {
   // 如果没有审核权限,则将当前内容改为待审核状态
   if (!SecurityUtils.getSubject().isPermitted("cms:link:audit")) {
     link.setDelFlag(Link.DEL_FLAG_AUDIT);
   }
   // 如果栏目不需要审核,则将该内容设为发布状态
   if (link.getCategory() != null && StringUtils.isNotBlank(link.getCategory().getId())) {
     Category category = categoryDao.get(link.getCategory().getId());
     if (!Article.YES.equals(category.getIsAudit())) {
       link.setDelFlag(Article.DEL_FLAG_NORMAL);
     }
   }
   linkDao.clear();
   linkDao.save(link);
 }
Пример #2
0
 /**
  * 获取链接列表
  *
  * @param siteId 站点编号
  * @param categoryId 分类编号
  * @param number 获取数目
  * @param param 预留参数,例: key1:'value1', key2:'value2' ...
  * @return
  */
 public static List<Link> getLinkList(long siteId, long categoryId, int number, String param) {
   Page<Link> page = new Page<Link>(1, number, -1);
   Link link = new Link(new Category(categoryId, new Site(siteId)));
   if (StringUtils.isNotBlank(param)) {
     @SuppressWarnings({"unused", "rawtypes"})
     Map map = JsonMapper.getInstance().fromJson("{" + param + "}", Map.class);
   }
   link.setDelFlag(Link.DEL_FLAG_NORMAL);
   page = linkService.find(page, link, false);
   return page.getList();
 }
Пример #3
0
 @Transactional(readOnly = false)
 public void delete(Link link, Boolean isRe) {
   // dao.updateDelFlag(id, isRe!=null&&isRe?Link.DEL_FLAG_NORMAL:Link.DEL_FLAG_DELETE);
   link.setDelFlag(isRe != null && isRe ? Link.DEL_FLAG_NORMAL : Link.DEL_FLAG_DELETE);
   dao.delete(link);
 }