/**
 * Copyright &copy; 2021-2026 <a href="http://www.jeeplus.org/">JeePlus</a> All rights reserved.
 */
package com.jeeplus.business.notify.mapper;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;

import com.jeeplus.business.notify.domain.JyNotify;
import com.jeeplus.business.notify.service.dto.JyNotifyDTO;
import com.jeeplus.business.notify.service.dto.WorkAttachmentDto;
import com.jeeplus.sys.domain.WorkAttachmentInfo;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;

import java.util.List;

/**
 * 通知通告MAPPER接口
 *
 * @author jeeplus
 * @version 2021-05-16
 */
@Mapper
public interface JyNotifyMapper extends BaseMapper<JyNotify> {

    /**
     * 获取通知
     */
    JyNotifyDTO getById(String id);


    /**
     * 获取通知数目
     *
     * @return
     */
    Long findCount(@Param( "currentUserId" ) String currentUserId, @Param( "isSelf" ) boolean isSelf, @Param("readFlag") String readFlag);

    /**
     * 获取列表
     *
     * @param queryWrapper
     * @return
     */
    IPage <JyNotifyDTO> findList(Page <JyNotifyDTO> page,
                               @Param( "currentUserId" ) String currentUserId,
                               @Param( "isSelf" ) boolean isSelf,
                               @Param("readFlag") String readFlag,
                               @Param(Constants.WRAPPER) QueryWrapper queryWrapper);

    /**
     * 获取列表
     *
     * @param queryWrapper
     * @return
     */
    IPage <JyNotifyDTO> myNotifyDataFindList(Page <JyNotifyDTO> page,
                                           @Param( "currentUserId" ) String currentUserId,
                                           @Param( "isSelf" ) boolean isSelf,
                                           @Param("readFlag") String readFlag,
                                           @Param(Constants.WRAPPER) QueryWrapper queryWrapper);

    void updateStatusById(@Param( "id" ) String id, @Param( "status" ) String status);

    void updateContentById(@Param( "content" ) String content, @Param( "id" ) String id);

    /**
     * 关闭通知
     * @param id
     */
    void closeById(String id);

    /**
     * 将时间结束的通知关闭
     */
    void updateNotifyClose();

    void readAll(@Param("userId") String userId);

    List<WorkAttachmentDto> getFileList(@Param("id") String id);
}
