package com.yxproject.start.service.impl;

import com.yxproject.start.entity.FailedCardEntity;
import com.yxproject.start.mapper.FailedCardMapper;
import com.yxproject.start.service.FailedCardService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * Created by zhangyusheng on 2018/10/30 10:02
 */
@Service
public class FailedCardServiceImpl implements FailedCardService {
    @Autowired
    private FailedCardMapper failedCardMapper;

    @Override
    public int saveFailedinfo(List<FailedCardEntity> failedinfoEntityList) {
        for (FailedCardEntity failedinfoEntity:failedinfoEntityList){
            failedCardMapper.saveFailedCardEntity(failedinfoEntity);
        }
        return 1;
    }

    @Override
    public int updateFailedinfo(List<FailedCardEntity> failedinfoEntityList) {
        for (FailedCardEntity failedinfoEntity:failedinfoEntityList){
            failedCardMapper.updateFailedCardEntity(failedinfoEntity);
        }
        return 1;
    }

    @Override
    public List<Map<String,Object>> selectFailedinfo(int state) {
        List<Map<String, Object>> maps = failedCardMapper.selectFailedCardEntityByState(state);
        return maps;
    }
}
