package com.loan.system.service.Impl;

import com.loan.system.domain.entity.ContractSeq;
import com.loan.system.repository.ContractSeqRepository;
import com.loan.system.service.ContractSeqService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class ContractSeqServiceImpl implements ContractSeqService {
    private final ContractSeqRepository contractSeqRepository;

    @Autowired
    public ContractSeqServiceImpl(ContractSeqRepository contractSeqRepository) {
        this.contractSeqRepository = contractSeqRepository;
    }
    @Override
    public ContractSeq findSeqBySeqDataAndBusinessAttr(String tody,String businessAttr) {
        return contractSeqRepository.findSeqBySeqDataAndBusinessAttr(tody, businessAttr);
    }

    @Override
    public ContractSeq addSeq(String tody,String businessAttr) {
        return contractSeqRepository.save(new ContractSeq(businessAttr,tody, 1L));
    }

    @Override
    public void updateSeqById(Long id, long l) {
        contractSeqRepository.updateSeqById(id, l);
    }
}
