/**
 * Copyright
 * All right reserved.
 * 项目名称:
 * 创建日期:2022/3/9
 */
package org.springblade.modules.business.desk.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springblade.core.mp.base.BaseServiceImpl;
import org.springblade.core.secure.utils.AuthUtil;
import org.springblade.modules.business.desk.entity.NoticeEntity;
import org.springblade.modules.business.desk.mapper.NoticeMapper;
import org.springblade.modules.business.desk.service.INoticeService;
import org.springblade.modules.business.desk.vo.NoticeVO;
import org.springframework.stereotype.Service;

import java.util.Date;

/***
 * Date:2022-03-08
 * Title:通知公告 服务实现类
 * Description：对本文件的详细描述，原则上不能少于30字
 * @author liu-nan
 * @mender：（文件的修改者，文件创建者之外的人）
 * @version 1.0
 * Remark：认为有必要的其他信息
 */
@Service
public class NoticeServiceImpl extends BaseServiceImpl<NoticeMapper, NoticeEntity> implements INoticeService {

	@Override
	public IPage<NoticeVO> selectNoticePage(IPage<NoticeVO> page, NoticeVO notice) {
		// 若不使用mybatis-plus自带的分页方法，则不会自动带入tenantId，所以我们需要自行注入
		notice.setTenantId(AuthUtil.getTenantId());
		return page.setRecords(baseMapper.selectNoticePage(page, notice));
	}

	@Override
	public Long unviewNoticeCount(Date viewDate) {
		return baseMapper.unviewNoticeCount(viewDate);
	}

}
