package com.steerinfo.ems.trmworkprocmaterial.service.impl;

import com.steerinfo.framework.mapper.IBaseMapper;
import com.steerinfo.framework.service.impl.BaseServiceImpl;
import com.steerinfo.ems.trmworkprocmaterial.model.TRmWorkprocMaterial;
import com.steerinfo.ems.trmworkprocmaterial.mapper.TRmWorkprocMaterialMapper;
import com.steerinfo.ems.trmworkprocmaterial.service.ITRmWorkprocMaterialService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.stereotype.Service;

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

/**
 * TRmWorkprocMaterial服务实现：
 * @author generator
 * @version 1.0-SNAPSHORT 2019-10-18 09:01
 * 类描述
 * 修订历史：
 * 日期：2019-10-18
 * 作者：generator
 * 参考：
 * 描述：TRmWorkprocMaterial服务实现
 * @see null
 * @Copyright 湖南视拓信息技术股份有限公司. All rights reserved.
 */
@Service(value = "tRmWorkprocMaterialService")
public class TRmWorkprocMaterialServiceImpl extends BaseServiceImpl<TRmWorkprocMaterial, String> implements ITRmWorkprocMaterialService {

	@Autowired
	private JdbcTemplate jdbcTemplate;
	
    @Autowired
    private TRmWorkprocMaterialMapper tRmWorkprocMaterialMapper;

    @Override
    protected IBaseMapper<TRmWorkprocMaterial, String> getMapper() {
        return tRmWorkprocMaterialMapper;
    }

    @Override
    public Set<String> getitemid() {
        return tRmWorkprocMaterialMapper.getitemid();
    }

    @Override
    public Set<String> getMes_prodline(String ems_materialcode) {
        return tRmWorkprocMaterialMapper.getMes_prodline(ems_materialcode);
    }

    @Override
    public List<TRmWorkprocMaterial> getMesItemid(HashMap<String, Object> m) {
        return tRmWorkprocMaterialMapper.getMesItemid(m);
    }

    @Override
    public String getName(String itemid) {
        return tRmWorkprocMaterialMapper.getName(itemid);
    }

    @Override
    public Set<TRmWorkprocMaterial> getIdAndDigits() {
        return tRmWorkprocMaterialMapper.getIdAndDigits();
    }
    
    @Override
    public List<Map<String, Object>> queryFinanceData(){
    	String sql = "select v.id,v.name from t_rm_material v where v.id in (select t.materialid from T_RM_WORKPROC_MATERIAL t where t.isfinancedata = '1')";
    	List<Map<String, Object>> list = jdbcTemplate.queryForList(sql);
    	return list;
    }

}
