package com.uas.finance.service.Impl;

import com.uas.finance.dao.CustomerExcutiveDao;
import com.uas.finance.service.CustomerExcutiveService;
import com.uas.finance.dao.CustomerExcutiveDao;
import com.uas.finance.model.CustomerExcutive;
import com.uas.finance.service.CustomerExcutiveService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

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

/**
 * 高管信息接口实现类
 * created by shicr on 2017/12/21
 **/
@Service
public class CustomerExcutiveServiceImpl implements CustomerExcutiveService {

    @Autowired
    private CustomerExcutiveDao dao;

    /**
     * 高管信息保存
     *
     * @param excutive
     * @return
     */
    public CustomerExcutive save(CustomerExcutive excutive) {
        return dao.save(excutive);
    }

    /**
     * 高管信息
     *
     * @param customerExcutives
     */
    public List<Map<String, Long>> update(List<CustomerExcutive> customerExcutives) {
        List<Map<String, Long>> list = new ArrayList<Map<String, Long>>();
        for (CustomerExcutive customerExcutive : customerExcutives) {
            Map<String, Long> map = new HashMap<String, Long>();
            CustomerExcutive customerExcutive1 = dao.save(customerExcutive);
            map.put("id", customerExcutive1.getId());
            map.put("ce_id", customerExcutive1.getErpId());
            list.add(map);
        }
        return list;
    }
}
