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


import com.sw.mes.core.base.BaseServiceImpl;
import com.sw.mes.yb.turnstore.dao.TurnstoreOutItemDao;
import com.sw.mes.yb.turnstore.entity.TurnstoreOutItem;
import com.sw.mes.yb.turnstore.service.TurnstoreOutItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.util.ArrayList;
import java.util.List;


/**
* @Author
* @Description：
* @Date: Create in
* @Modified By:
*/
@Service
@Transactional
public class TurnstoreOutItemServiceImpl extends BaseServiceImpl<TurnstoreOutItem> implements TurnstoreOutItemService {
    TurnstoreOutItemDao dao;
	@Autowired
    public void setDao(TurnstoreOutItemDao dao) {
        super.setBaseDao(dao);
        this.dao=dao;
    }

    @Override
    public List<TurnstoreOutItem> getItemsByOrderNo(String orderNo){
	    return dao.getItemsByOrderNo(orderNo);
    }

    @Override
    public List<TurnstoreOutItem> getItemsByOutId(Integer outId){return dao.getItemsByOutId(outId);}

    @Override
    public List<TurnstoreOutItem> getItemsBySectionNoAndType(String sectionNo,String type){
	    return dao.getItemsBySectionNoAndType(sectionNo,type);
    }

    @Override
    public List<TurnstoreOutItem> findByTypeAndStateAndSectionNoOrderByIdDesc(String type, String state, String sectionNo) {
        List<TurnstoreOutItem> list=dao.findByTypeAndStateAndSectionNoOrderByIdDesc(type,state,sectionNo);
        if(list==null){
            return  new ArrayList<TurnstoreOutItem>();
        }
        else {
            return list;
        }
	}

    @Override
    public List<TurnstoreOutItem> findBySectionNoOrderByIdDesc(String sectionNo) {
        List<TurnstoreOutItem> list=dao.findBySectionNoOrderByIdDesc(sectionNo);
        if(list==null){
            return  new ArrayList<TurnstoreOutItem>();
        }
        else {
            return list;
        }
    }

}
