package com.sw.mes.fb.aio.service.impl;

import com.sw.mes.core.base.BaseServiceImpl;
import com.sw.mes.fb.aio.dao.SpellDao;
import com.sw.mes.fb.aio.entity.SpellInfo;
import com.sw.mes.fb.aio.service.SpellService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional
public class SpellServiceImpl extends BaseServiceImpl<SpellInfo> implements SpellService {
    SpellDao dao;

    @Autowired
    public void setDao(SpellDao dao) {
        super.setBaseDao(dao);
        this.dao = dao;
    }

    @Override
    public SpellInfo findBySectionNo(String sectionNo) {
        List<SpellInfo> list = dao.findBySectionNo(sectionNo);
        if (list != null && list.size() > 0) {
            return list.get(0);
        }
        return null;
    }

    @Override
    public List<SpellInfo> spellInfoFb(List<String> sectionNoFbList) {
        return dao.findBySectionNoIn(sectionNoFbList);
    }
}
