package com.brilliance.isc.common.limmod.service.impl;

import com.brilliance.isc.common.limmod.service.LimOptionService;
import com.brilliance.isc.mda.dao.LimMapper;
import com.brilliance.isc.mda.dao.LimtrnMapper;
import com.brilliance.isc.mda.dao.LmeMapper;
import com.brilliance.isc.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class LimRepireServiceImpl  {
    @Autowired
    private LimMapper limMapper;
    @Autowired
    private LimtrnMapper limtrnMapper;
    @Autowired
    private LmeMapper lmeMapper;

    /**
     lmeMapper.deleteByLiminr(inr);
     * 回滚额度信息表
     *
     * @param trninr
     */
    public void limRePair(String trninr) {

        String inr = limMapper.selectInrByTrnInr(trninr);

        if (!StringUtils.isEmpty(inr)) {
            lmeMapper.deleteByLiminr(inr);
        }

        limMapper.updateByinr(inr);
        limtrnMapper.deleteByTrninr(trninr);

    }


}
