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

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sunxung.factoring.entity.salescontractmanagement.SalesContractSettleInfo;
import com.sunxung.factoring.mapper.salescontractmanagement.SalesContractSettleInfoMapper;
import com.sunxung.factoring.service.salescontractmanagement.SalesContractSettleInfoService;
import com.sunxung.factoring.service.sys.DictionaryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

/**
 * @Description : 销售合同结算信息service实现类
 * @Author : L.Jia
 * @Date: 2021-09-14 11:10
 */
@Service
public class SalesContractSettleInfoServiceImpl extends ServiceImpl<SalesContractSettleInfoMapper, SalesContractSettleInfo>
        implements SalesContractSettleInfoService {
    @Autowired
    private DictionaryService dictionaryService;

    @Override
    public SalesContractSettleInfo findByBasicInfoId(Long basicInfoId) {
        SalesContractSettleInfo settleInfo = baseMapper.findByBasicInfoId(basicInfoId);
        if (settleInfo != null && settleInfo.getReceivableType() != null) {
            settleInfo.setReceivableTypeDic(dictionaryService.get(settleInfo.getReceivableType()));
        }
        return settleInfo;
    }
}
