package com.dsk.system.service.impl;

import java.util.List;

import com.dsk.common.core.domain.entity.BusinessFollowRecord;
import com.dsk.common.utils.DateUtils;
import com.dsk.system.mapper.BusinessFollowRecordMapper;
import com.dsk.system.service.IBusinessFollowRecordService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 项目跟进记录Service业务层处理
 *
 * @author lxl
 * @date 2023-05-17
 */
@Service
public class BusinessFollowRecordServiceImpl implements IBusinessFollowRecordService
{
    @Autowired
    private BusinessFollowRecordMapper businessFollowRecordMapper;

    /**
     * 查询项目跟进记录
     *
     * @param id 项目跟进记录主键
     * @return 项目跟进记录
     */
    @Override
    public BusinessFollowRecord selectBusinessFollowRecordById(Long id)
    {
        return businessFollowRecordMapper.selectBusinessFollowRecordById(id);
    }

    @Override
    public List<BusinessFollowRecord> selectBusinessFollowRecordList(Integer businessId)
    {
        return businessFollowRecordMapper.selectBusinessFollowRecordList(businessId);
    }

    @Override
    public List<BusinessFollowRecord> businessFollowRecordPaging(BusinessFollowRecord businessFollowRecord) {
        return businessFollowRecordMapper.businessFollowRecordPaging(businessFollowRecord);
    }

    /**
     * 新增项目跟进记录
     *
     * @param businessFollowRecord 项目跟进记录
     * @return 结果
     */
    @Override
    @Transactional
    public int insertBusinessFollowRecord(BusinessFollowRecord businessFollowRecord)
    {
        return businessFollowRecordMapper.insertBusinessFollowRecord(businessFollowRecord);
    }

    /**
     * 修改项目跟进记录
     *
     * @param businessFollowRecord 项目跟进记录
     * @return 结果
     */
    @Override
    public int updateBusinessFollowRecord(BusinessFollowRecord businessFollowRecord)
    {
        businessFollowRecord.setUpdateTime(DateUtils.getNowDate());
        return businessFollowRecordMapper.updateBusinessFollowRecord(businessFollowRecord);
    }

    /**
     * 批量删除项目跟进记录
     *
     * @param ids 需要删除的项目跟进记录主键
     * @return 结果
     */
    @Override
    public int deleteBusinessFollowRecordByIds(Long[] ids)
    {
        return businessFollowRecordMapper.deleteBusinessFollowRecordByIds(ids);
    }

    /**
     * 删除项目跟进记录信息
     *
     * @param id 项目跟进记录主键
     * @return 结果
     */
    @Override
    public int deleteBusinessFollowRecordById(Long id)
    {
        return businessFollowRecordMapper.deleteBusinessFollowRecordByBusinessId(id);
    }
}
