package com.ruoyi.excel.wecom.service.impl;

import com.ruoyi.excel.wecom.domain.CustomerExportData;
import com.ruoyi.excel.wecom.mapper.CustomerExportDataMapper;
import com.ruoyi.excel.wecom.service.ICustomerExportDataService;
import com.ruoyi.excel.wecom.vo.CustomerExportDataVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.Date;
import java.util.List;

/**
 * 客户导出数据Service业务层处理
 */
@Service
public class CustomerExportDataServiceImpl implements ICustomerExportDataService {

    @Autowired
    private CustomerExportDataMapper customerExportDataMapper;

    /**
     * 查询客户导出数据列表
     * @param startDate 开始日期
     * @param endDate 结束日期
     * @param customerName 客户名称
     * @return 客户导出数据列表
     */
    @Override
    public List<CustomerExportData> selectCustomerExportDataList(String corpId,Date startDate, Date endDate, String customerName) {
        return customerExportDataMapper.selectCustomerExportDataList(corpId,startDate, endDate, customerName);
    }

    /**
     * 查询客户导出数据VO列表(用于导出)
     * @param startDate 开始日期
     * @param endDate 结束日期
     * @param customerName 客户名称
     * @return 客户导出数据VO列表
     */
    @Override
    public List<CustomerExportDataVO> selectCustomerExportDataVOList(String corpId,Date startDate, Date endDate, String customerName) {
        return customerExportDataMapper.selectCustomerExportDataVOList(corpId,startDate, endDate, customerName);
    }

    /**
     * 根据ID查询客户导出数据
     * @param id 主键ID
     * @return 客户导出数据
     */
    @Override
    public CustomerExportData selectCustomerExportDataById(Long id) {
        return customerExportDataMapper.selectById(id);
    }

    /**
     * 新增客户导出数据
     * @param customerExportData 客户导出数据
     * @return 结果
     */
    @Override
    public int insertCustomerExportData(CustomerExportData customerExportData) {
        return customerExportDataMapper.insert(customerExportData);
    }

    /**
     * 修改客户导出数据
     * @param customerExportData 客户导出数据
     * @return 结果
     */
    @Override
    public int updateCustomerExportData(CustomerExportData customerExportData) {
        return customerExportDataMapper.updateById(customerExportData);
    }

    /**
     * 批量删除客户导出数据
     * @param ids 需要删除的数据ID
     * @return 结果
     */
    @Override
    public int deleteCustomerExportDataByIds(Long[] ids) {
        int count = 0;
        for (Long id : ids) {
            count += customerExportDataMapper.deleteById(id);
        }
        return count;
    }
}
