ZoaAnnouncementDao.java 2.0 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455
  1. /*
  2. * 版权所有 (C) 2015 知启蒙(ZHIQIM) 保留所有权利。[遇见知启蒙,邂逅框架梦]
  3. *
  4. * 知启蒙WEB容器(zhiqim_httpd)在LGPL3.0协议下开源:https://www.zhiqim.com/gitcan/zhiqim/zhiqim_httpd.htm
  5. *
  6. * This file is part of [zhiqim_httpd].
  7. *
  8. * [zhiqim_httpd] is free software: you can redistribute
  9. * it and/or modify it under the terms of the GNU Lesser General Public License
  10. * as published by the Free Software Foundation, either version 3 of the
  11. * License, or (at your option) any later version.
  12. *
  13. * [zhiqim_httpd] is distributed in the hope that it will
  14. * be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  16. * GNU Lesser General Public License for more details.
  17. *
  18. * You should have received a copy of the GNU Lesser General Public License
  19. * along with [zhiqim_httpd].
  20. * If not, see <http://www.gnu.org/licenses/>.
  21. */
  22. package org.zhiqim.announcement;
  23. import org.zhiqim.announcement.dbo.ZoaAnnouncementEx;
  24. import org.zhiqim.announcement.dbo.ZoaAnnouncementReader;
  25. import org.zhiqim.httpd.HttpRequest;
  26. import org.zhiqim.kernel.annotation.AnAlias;
  27. import org.zhiqim.orm.ORM;
  28. import org.zhiqim.orm.dbo.Selector;
  29. /**
  30. * 公告数据访问对象
  31. *
  32. * @version v1.0.0 @author zouzhigang 2017-11-17 新建与整理
  33. */
  34. @AnAlias("ZoaAnnouncementDao")
  35. public class ZoaAnnouncementDao
  36. {
  37. /**
  38. * 获取是否有未读公告
  39. *
  40. * @param request 请求
  41. * @return =true表示有,=false表示没有
  42. * @throws Exception 异常
  43. */
  44. public static boolean hasUnReadAnnouncement(HttpRequest request) throws Exception
  45. {
  46. Selector selector = new Selector();
  47. selector.addJoin(ZoaAnnouncementReader.class, new Selector("operatorCode", request.getSessionName()));
  48. selector.addMust("announcementStatus", 0);
  49. selector.addMustIsNull("operatorCode");
  50. return ORM.view().count(ZoaAnnouncementEx.class, selector) > 0;
  51. }
  52. }