package cn.com.countrygarden.bi.main.service.marketing.impl;

import cn.com.countrygarden.bi.main.dao.marketing.MarketingOrganMapper;
import cn.com.countrygarden.bi.main.model.marketing.MarketingOrgan;
import cn.com.countrygarden.bi.main.service.marketing.MarketingOrganService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

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

/**
 * Created by chenweijiang on 2017/11/7.
 */
@Service
@Transactional(readOnly = true)
public class MarketingOrganServiceImpl implements MarketingOrganService{

    @Autowired
    private MarketingOrganMapper mapper;

    @Override
    public Map<String, Object> organMap() {
        MarketingOrgan query = new MarketingOrgan();
        query.setIsDelete((byte)0);
        List<MarketingOrgan> marketingOrgans = mapper.select(query);
        Map<String,Object> result = new HashMap<String,Object>();
        for(MarketingOrgan marketingOrgan: marketingOrgans){
            result.put(marketingOrgan.getName(),marketingOrgan.getId());
        }
        return result;
    }
}
