package com.jeeplus.pubmodules.oss.mapper;

import com.baomidou.mybatisplus.annotation.InterceptorIgnore;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.core.toolkit.Constants;
import com.jeeplus.pubmodules.oss.domain.WorkAttachment;
import com.jeeplus.pubmodules.oss.service.dto.AttachmentDTO;
import com.jeeplus.sys.domain.WorkAttachmentInfo;
import com.jeeplus.sys.service.dto.UserDTO;
import org.apache.ibatis.annotations.Param;

import java.util.List;

public interface OssServiceMapper extends BaseMapper<WorkAttachment> {

    @InterceptorIgnore(tenantLine = "true")
    Integer deleteById(String id);

    @InterceptorIgnore(tenantLine = "true")
    Integer selectSaveById(String id);

    @InterceptorIgnore(tenantLine = "true")
    void updateProjectRecord(String id);

    //@InterceptorIgnore(tenantLine = "true")
    List<AttachmentDTO> findList(@Param(Constants.WRAPPER) QueryWrapper queryWrapper);

    @InterceptorIgnore(tenantLine = "true")
    void insertWorkAttachment (@Param("workAttachment") WorkAttachment workAttachment, @Param("userDto") UserDTO userDto);

    /**
     * 根据关联id和url查询数据信息
     * @param workAttachment
     * @return
     */
    //@InterceptorIgnore(tenantLine = "true")
    List<WorkAttachmentInfo> getByAttachmentIdAndUrlAndAttachmentFlag(WorkAttachmentInfo workAttachment);

    /**
     * 查询电子章文件信息
     * @param id
     * @return
     */
    @InterceptorIgnore(tenantLine = "true")
    List<WorkAttachmentInfo> selectWorkAttachmentByAttachmentId(String id);

    /**
     * 根据attachmentId删除附件
     * @param attachmentId
     */
    @InterceptorIgnore(tenantLine = "true")
    void deleteByAttachmentId(@Param("attachmentId")String attachmentId);

    /**
     * 根据attachmentId查询附件信息
     * @param attachmentId
     * @return
     */
    @InterceptorIgnore(tenantLine = "true")
    List<WorkAttachmentInfo> selectListByAttachmentId(String attachmentId);

    @InterceptorIgnore(tenantLine = "true")
    void deleteByAttachmentIdNotInIds(@Param("attachmentId")String attachmentId, @Param("delIds")List<String> delIds);
}
