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

@Service
public class LedgerDailyTrainingServiceImpl extends ServiceImpl<LedgerDailyTrainingMapper, LedgerDailyTraining>
        implements ILedgerDailyTrainingService {

    @Autowired
    private LedgerDailyTrainingMapper mapper;

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

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