package com.sundot.airport.ledger.service.impl;

import java.util.List;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sundot.airport.common.utils.DateUtils;
import com.sundot.airport.ledger.domain.LedgerChannelPassRate;
import com.sundot.airport.ledger.mapper.LedgerChannelPassRateMapper;
import com.sundot.airport.ledger.service.ILedgerChannelPassRateService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 通道过检率记录Service实现
 */
@Service
public class LedgerChannelPassRateServiceImpl extends ServiceImpl<LedgerChannelPassRateMapper, LedgerChannelPassRate>
        implements ILedgerChannelPassRateService {

    @Autowired
    private LedgerChannelPassRateMapper mapper;

    @Override
    public List<LedgerChannelPassRate> selectList(LedgerChannelPassRate query) {
        return mapper.selectList(query);
    }

    @Override
    @Transactional(rollbackFor = Exception.class)
    public int batchInsert(List<LedgerChannelPassRate> list) {
        list.forEach(item -> item.setCreateTime(DateUtils.getNowDate()));
        saveBatch(list);
        return list.size();
    }
}
