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


/**
 * 锦旗及感谢信记录Service实现
 */
@Service
public class LedgerBannerLetterServiceImpl extends ServiceImpl<LedgerBannerLetterMapper, LedgerBannerLetter>
        implements ILedgerBannerLetterService {

    @Autowired
    private LedgerBannerLetterMapper mapper;

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

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

}
