package com.fjhx.sale.service.contract.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fjhx.sale.entity.contract.dto.ContractProductFollowUpDto;
import com.fjhx.sale.entity.contract.dto.ContractProductFollowUpSelectDto;
import com.fjhx.sale.entity.contract.po.ContractProductFollowUp;
import com.fjhx.sale.entity.contract.vo.ContractProductFollowUpVo;
import com.fjhx.sale.mapper.contract.ContractProductFollowUpMapper;
import com.fjhx.sale.service.contract.ContractProductFollowUpService;
import com.ruoyi.common.utils.wrapper.IWrapper;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 外销合同-产品-跟进记录 服务实现类
 * </p>
 *
 * @author
 * @since 2023-06-14
 */
@Service
public class ContractProductFollowUpServiceImpl extends ServiceImpl<ContractProductFollowUpMapper, ContractProductFollowUp> implements ContractProductFollowUpService {

    @Override
    public List<ContractProductFollowUpVo> getList(ContractProductFollowUpSelectDto dto) {
        IWrapper<ContractProductFollowUp> wrapper = getWrapper();
        wrapper.orderByDesc("cpfu", ContractProductFollowUp::getId);
        List<ContractProductFollowUpVo> list = this.baseMapper.getList(wrapper);
        return list;
    }

    @Override
    public void add(ContractProductFollowUpDto contractProductFollowUpDto) {
        this.save(contractProductFollowUpDto);
    }

}
