package com.sw.mes.yb.pc.service.impl;

import com.sw.mes.core.base.BaseServiceImpl;
import com.sw.mes.yb.pc.dao.SpellInfoDao;
import com.sw.mes.yb.pc.entity.SpellInfo;
import com.sw.mes.yb.pc.service.SpellInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

/**
 * @Author
 * @Description：
 * @Date: Create in
 * @Modified By:
 */
@Service
@Transactional
public class SpellInfoServiceImpl extends BaseServiceImpl<SpellInfo> implements SpellInfoService {
    SpellInfoDao dao;

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

    @Override
    public void deleteBySectionId(Long sectionId) {
        dao.deleteBySectionId(sectionId);
    }

    @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> findBySectionNos(List<String> sectionNos){
        return dao.findBySectionNoIn(sectionNos);
    }

    @Override
    public void deleteBySectionNos(List<String> sectionNos){
       dao.deleteBySectionNos(sectionNos);
    }

    @Override
    public List<SpellInfo> findBySectionId(Long sectionId) {
        return dao.findBySectionId(sectionId);
    }
}
