package com.yunzhupaas.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.yunzhupaas.base.service.SuperServiceImpl;
import com.yunzhupaas.entity.DocumentShareEntity;
import com.yunzhupaas.mapper.DocumentShareMapper;
import com.yunzhupaas.service.DocumentShareService;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * 邮件配置
 *
 * @author 云筑产品开发平台组
 * @copyright 深圳市乐程软件有限公司
 * @date 2024-09-26 上午9:18
 */
@Service
public class DocumentShareServiceImpl extends SuperServiceImpl<DocumentShareMapper, DocumentShareEntity> implements DocumentShareService {

    @Override
    public DocumentShareEntity getByDocIdAndShareUserId(String docId, String shareUserId) {
        QueryWrapper<DocumentShareEntity> queryWrapper = new QueryWrapper<>();
        queryWrapper.lambda().eq(DocumentShareEntity::getDocumentId, docId);
        queryWrapper.lambda().eq(DocumentShareEntity::getShareUserId, shareUserId);
        List<DocumentShareEntity> list = list(queryWrapper);
        if (list != null && list.size() > 0) {
            return list.get(0);
        }
        return null;
    }
}

