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

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sunxung.factoring.entity.ledger.LedgerFundPossessionCost;
import com.sunxung.factoring.mapper.ledger.LedgerFundPossessionCostMapper;
import com.sunxung.factoring.service.ledger.LedgerFundPossessionCostService;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @author liutao
 * @date 2021.11.11
 */
@Service
public class LedgerFundPossessionCostServiceImpl extends ServiceImpl<LedgerFundPossessionCostMapper, LedgerFundPossessionCost> implements LedgerFundPossessionCostService {

    @Override
    public List<LedgerFundPossessionCost> findByBasicId(Long basicId) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("ledger_account_basic_info_id", basicId);
        return baseMapper.selectList(queryWrapper);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public void deleteByBasicId(Long basicId) {
        QueryWrapper queryWrapper = new QueryWrapper();
        queryWrapper.eq("ledger_account_basic_info_id", basicId);
        baseMapper.delete(queryWrapper);
    }
}
