package com.uas.finance.service.Impl;

import com.uas.finance.dao.BusinessConditionDao;
import com.uas.finance.model.BusinessCondition;
import com.uas.finance.service.BusinessConditionService;
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;
import java.util.prefs.BackingStoreException;

/**
 * 情况描述接口实现层
 * created by shicr on 2017/12/21
 **/
@Service
public class BusinessConditionServiceImpl implements BusinessConditionService {

    @Autowired
    private BusinessConditionDao businessConditionDao;

    /**
     * 情况描述保存
     *
     * @param businessCondition
     * @return
     */
    public BusinessCondition save(BusinessCondition businessCondition) {
        return businessConditionDao.save(businessCondition);
    }

    /**
     * 更新ERP传来的情况描述
     *
     * @param businessCondition
     * @return
     */
    @Override
    public List<Map<String, Long>> update(BusinessCondition businessCondition) {
        List<Map<String, Long>> list = new ArrayList<Map<String, Long>>();
        Map<String, Long> map = new HashMap<String, Long>();
        BusinessCondition businessCondition1 = businessConditionDao.save(businessCondition);
        map.put("id",businessCondition1.getId());
        map.put("bc_id",businessCondition1.getErpId());
        list.add(map);
        return list;
    }

}
