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.LedgerSecurityTest;
import com.sundot.airport.common.dto.LedgerCommonQueryReqVO;
import com.sundot.airport.common.dto.LedgerCommonResVO;
import com.sundot.airport.ledger.mapper.LedgerSecurityTestMapper;
import com.sundot.airport.ledger.service.ILedgerSecurityTestService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

/**
 * 安保测试记录Service实现
 */
@Service
public class LedgerSecurityTestServiceImpl extends ServiceImpl<LedgerSecurityTestMapper, LedgerSecurityTest>
        implements ILedgerSecurityTestService {

    @Autowired
    private LedgerSecurityTestMapper mapper;

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

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

    @Override
    public List<LedgerCommonResVO> securityTestItemClassification(LedgerCommonQueryReqVO queryReq) {
        return mapper.securityTestItemClassification(queryReq);
    }

    @Override
    public List<LedgerCommonResVO> securityTestPassingStatus(LedgerCommonQueryReqVO queryReq) {
        return mapper.securityTestPassingStatus(queryReq);
    }

    @Override
    public List<LedgerCommonResVO> securityTestRegion(LedgerCommonQueryReqVO queryReq) {
        return mapper.securityTestRegion(queryReq);
    }
}
