package com.kmall.api.service.mk;

import com.kmall.api.dao.mk.ApiMkStorePromOrderRealMapper;
import com.kmall.api.entity.mk.MkStorePromOrderRealVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

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

/**
 * 门店推广订单关联表Service实现类
 *
 * @author emato
 * @email admin@qhdswl.com
 * @date 2019-04-30 15:02:38
 */
@Service
public class ApiMkStorePromOrderRealService {
    @Autowired
    private ApiMkStorePromOrderRealMapper apiMkStorePromOrderRealMapper;

    public MkStorePromOrderRealVo queryObject(Integer promOrderRealId) {
        return apiMkStorePromOrderRealMapper.queryObject(promOrderRealId);
    }

    public Integer querySubmitNumByPromId(Integer promId) {
        return apiMkStorePromOrderRealMapper.querySubmitNumByPromId(promId).size();
    }
    public Integer querySubmitOrderNumByPromId(Integer promId) {
        return apiMkStorePromOrderRealMapper.querySubmitOrderNumByPromId(promId);
    }

    public MkStorePromOrderRealVo queryPromObjectByCartId(Integer cartId) {
        Map map = new HashMap();
        map.put("cartId", cartId);
        List<MkStorePromOrderRealVo> list = apiMkStorePromOrderRealMapper.queryPromRealListByMap(map);
        if(list.size()==0) {
            return null;
        }else{
            return list.get(0);
        }
    }

    public List<MkStorePromOrderRealVo> queryList(Map<String, Object> map) {
        return apiMkStorePromOrderRealMapper.queryList(map);
    }

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

    public int save(MkStorePromOrderRealVo mkStorePromOrderReal) {
        return apiMkStorePromOrderRealMapper.save(mkStorePromOrderReal);
    }

    public int update(MkStorePromOrderRealVo mkStorePromOrderReal) {
        return apiMkStorePromOrderRealMapper.update(mkStorePromOrderReal);
    }
}
