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

@Service
public class LedgerDormFireSafetyServiceImpl extends ServiceImpl<LedgerDormFireSafetyMapper, LedgerDormFireSafety>
        implements ILedgerDormFireSafetyService {

    @Autowired
    private LedgerDormFireSafetyMapper mapper;

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

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