Files
ziqim/zhiqim_httpd/test/org/zhiqim/announcement/ZoaAnnouncementDao.java
T
2025-02-20 14:59:35 +08:00

56 lines
2.0 KiB
Java

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