package com.simuwang.manage.service.impl;

import com.simuwang.base.mapper.CompanyEmailConfigMapper;
import com.simuwang.base.mapper.CompanyEmailSendHistoryMapper;
import com.simuwang.base.pojo.vo.CompanyEmailSendHistoryVO;
import com.simuwang.manage.service.CompanyEmailSendHistoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * FileName: CompanyEmailSendHistoryServiceImpl
 * Author:   chenjianhua
 * Date:     2024/9/9 10:06
 * Description: ${DESCRIPTION}
 */
@Service
public class CompanyEmailSendHistoryServiceImpl implements CompanyEmailSendHistoryService {
    @Autowired
    private CompanyEmailSendHistoryMapper companyEmailSendHistoryMapper;

    @Autowired
    private CompanyEmailConfigMapper companyEmailConfigMapper;
    @Override
    public List<CompanyEmailSendHistoryVO> searchCompanyEmail(String companyName, String email, Integer sendStatus) {
        return companyEmailSendHistoryMapper.searchCompanyEmailList(companyName,email,sendStatus);
    }

    @Override
    public List<CompanyEmailSendHistoryVO> searchEmailHistory(String email) {
        return companyEmailSendHistoryMapper.searchEmailHistory(email);
    }

    @Override
    @Transactional
    public void deleteEmail(String email) {
        //删除配置
        companyEmailConfigMapper.deleteCompanyEmailConfig(email);
        //删除历史
        companyEmailSendHistoryMapper.deleteEmailHistory(email);
    }

    @Override
    public void deleteEmailHistory(String ids) {
        companyEmailSendHistoryMapper.deleteEmailHistoryByIds(ids.split(","));
    }
}
