package com.sunxung.factoring.service.salescontractmanagement.impl;

import com.baomidou.mybatisplus.annotation.TableField;
import com.sunxung.factoring.dict.impl.FileModuleDict;
import com.sunxung.factoring.entity.salescontractmanagement.SalesContractManagementHis;
import com.sunxung.factoring.entity.salescontractmanagement.vo.SalesContractBasicVo;
import com.sunxung.factoring.entity.sys.FileStorageDO;
import com.sunxung.factoring.mapper.salescontractmanagement.SalesContractManagementHisMapper;
import com.sunxung.factoring.service.salescontractmanagement.ISalesContractManagementHisService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sunxung.factoring.service.salescontractmanagement.SalesContractService;
import com.sunxung.factoring.service.sys.FileService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * <p>
 * 销售合同管理历史表 服务实现类
 * </p>
 *
 * @author yafan
 * @since 2023-12-13
 */
@Service("sales_contract_createService")
public class SalesContractManagementHisServiceImpl extends ServiceImpl<SalesContractManagementHisMapper, SalesContractManagementHis> implements ISalesContractManagementHisService {

    @Autowired
    private SalesContractService salesContractService;
    @Autowired
    private FileService fileService;


    @Override
    public SalesContractBasicVo getView(Long id) {

        SalesContractBasicVo contractBasicVo = salesContractService.getBasicInfoByHisId(id);
        List<FileStorageDO> fileStorageDOList = fileService.findByBusinessId(id, FileModuleDict.ChildEnum.SALES_CONTRACT_MANAGEMENT_HIS_FILE.getCode());
        contractBasicVo.setFiles(fileStorageDOList);

        return contractBasicVo;
    }
}
