package com.kmall.admin.service.impl.mk.store;

import com.kmall.admin.dao.StoreDao;
import com.kmall.admin.dao.mk.store.MkStoreTopicStatDao;
import com.kmall.admin.dao.mk.store.StoreTopicDao;
import com.kmall.admin.entity.StoreEntity;
import com.kmall.admin.entity.mk.store.MkStoreTopicStatEntity;
import com.kmall.admin.entity.mk.store.StoreTopicEntity;
import com.kmall.admin.service.mk.store.MkStoreTopicStatService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;
import java.util.Map;

/**
 * 门店活动统计Service实现类
 *
 * @author emato
 * @email admin@qhdswl.com
 * @date 2019-05-24 17:58:24
 */
@Service("mkStoreTopicStatService")
public class MkStoreTopicStatServiceImpl implements MkStoreTopicStatService {
    @Autowired
    private MkStoreTopicStatDao mkStoreTopicStatDao;
    @Autowired
    private StoreTopicDao storeTopicDao;
    @Autowired
    private StoreDao storeDao;

    @Override
    public MkStoreTopicStatEntity queryObject(Integer storeTopicStatId) {
        MkStoreTopicStatEntity mkStoreTopicStatEntity = mkStoreTopicStatDao.queryObject(storeTopicStatId);
        if(mkStoreTopicStatEntity != null){
            StoreEntity storeEntity = storeDao.queryObject(mkStoreTopicStatEntity.getStoreId());
            mkStoreTopicStatEntity.setStoreName(storeEntity.getStoreName());
            StoreTopicEntity topicEntity = storeTopicDao.queryObject(mkStoreTopicStatEntity.getStoreTopicId());
            mkStoreTopicStatEntity.setStoreTopicName(topicEntity.getTitle());
        }
        return mkStoreTopicStatEntity;
    }

    @Override
    public List<MkStoreTopicStatEntity> queryList(Map<String, Object> map) {
        return mkStoreTopicStatDao.queryList(map);
    }

    @Override
    public int queryTotal(Map<String, Object> map) {
        return mkStoreTopicStatDao.queryTotal(map);
    }

    @Override
    public int save(MkStoreTopicStatEntity mkStoreTopicStat) {
        return mkStoreTopicStatDao.save(mkStoreTopicStat);
    }

    @Override
    public int update(MkStoreTopicStatEntity mkStoreTopicStat) {
        return mkStoreTopicStatDao.update(mkStoreTopicStat);
    }

    @Override
    public int delete(Integer storeTopicStatId) {
        return mkStoreTopicStatDao.delete(storeTopicStatId);
    }

    @Override
    public int deleteBatch(Integer[]storeTopicStatIds) {
        return mkStoreTopicStatDao.deleteBatch(storeTopicStatIds);
    }
}
