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.LedgerTerminalBonus;
import com.sundot.airport.ledger.mapper.LedgerTerminalBonusMapper;
import com.sundot.airport.ledger.service.ILedgerTerminalBonusService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 航站楼加分记录Service实现
 */
@Service
public class LedgerTerminalBonusServiceImpl extends ServiceImpl<LedgerTerminalBonusMapper, LedgerTerminalBonus>
        implements ILedgerTerminalBonusService {

    @Autowired
    private LedgerTerminalBonusMapper mapper;

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

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