package cn.freemud.manager;

import cn.freemud.entities.db.StoreTableNumber;
import cn.freemud.manager.dao.StoreTableNumberDao;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class StoreTableNumberManager {
    @Autowired
    private StoreTableNumberDao storeTableNumberDao;

    public StoreTableNumber selectOne(String partnerId, String storeId, String tableNumber) {
        StoreTableNumber storeTableNumber = new StoreTableNumber();
        storeTableNumber.setPartnerId(partnerId);
        storeTableNumber.setStoreId(storeId);
        storeTableNumber.setTableNumber(tableNumber);
        List<StoreTableNumber> storeTableNumberList = storeTableNumberDao.select(storeTableNumber);
        if(CollectionUtils.isNotEmpty(storeTableNumberList)) {
            return storeTableNumberList.get(0);
        }
        return null;
    }
}
