package com.ssm.manage.service.impl;

import com.ssm.core.service.impl.BaseServiceImpl;
import com.ssm.manage.dao.SsmPromotionMemberDao;
import com.ssm.manage.dao.SsmPromotionStoreDao;
import com.ssm.manage.entity.PromotionMember;
import com.ssm.manage.entity.PromotionStore;
import com.ssm.manage.service.SsmPromotionMemberService;
import com.ssm.manage.service.SsmPromotionStoreService;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
@Slf4j
public class SsmPromotionStoreServiceImpl  extends BaseServiceImpl<PromotionStore> implements SsmPromotionStoreService {

    @Autowired
    private SsmPromotionStoreDao dao;

    @Override
    public SsmPromotionStoreDao getDao() {
        return dao;
    }


    @Override
    public int saveBatchPromotionStore(List<PromotionStore> promotionStores) {
        int i=0;
        for (PromotionStore promotionStore : promotionStores) {
            int insert = dao.insert(promotionStore);
            if(i>0){
                i++;
            }else{
                i=0;
            }
        }
        return i;
    }

    @Override
    public List<PromotionStore> selectList(PromotionStore promotionStores) {
        return dao.select(promotionStores);
    }
}

