package com.cloudcross.ssp.service.impl;

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

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.cloudcross.ssp.model.Industry;
import com.cloudcross.ssp.service.IIndustryService;
import com.cloudcross.ssp.base.dao.GenericIBatisDao;
import com.cloudcross.ssp.common.utils.MapBuilder;
import com.cloudcross.ssp.common.utils.Pager;
import com.cloudcross.ssp.web.widget.SelectorController.ISelector;
import com.cloudcross.ssp.web.widget.SelectorController.ISelectorProvider;
@Service
public class IndustryService implements IIndustryService,ISelectorProvider{
	
	@Autowired
	private GenericIBatisDao myBatisDao;
	
	@Override
	public Industry findById(Long id) {
		// TODO Auto-generated method stub
		return null;
	}
	@Override
	public Industry findByIndustryId(Long id) {
		return myBatisDao.get("industrySqlMapper.findByIndustryId", id);
	}
	@Override
	public int countByParams(Map<String, Object> paramMap) {
		// TODO Auto-generated method stub
		return 0;
	}
	
	@Override
	public List<Industry> findAll() 
	{
		return myBatisDao.getList("industrySqlMapper.findAllIndustry");
	}
	
	@Override
	public List<Industry> findByParams(Map<String, Object> paramMap,
			Pager pager) {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public boolean add(Industry t) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean edit(Industry t) {
		// TODO Auto-generated method stub
		return false;
	}

	@Override
	public boolean updateStatus(List<Long> idList, int status) {
		// TODO Auto-generated method stub
		return false;
	}
	
	public List<Industry> findAllIndustry(){
	List<Industry> industryList = myBatisDao.getList("industrySqlMapper.findAllIndustry");
		return industryList;
	}
	//___________________________________________________________________________________________________________________
	@Override
	public Map<String, List<? extends ISelector>> provideData(String[] parentId) {
		// TODO Auto-generated method stub//目前只有这一个是有用的！
		List<Industry> industryList = findAllIndustry();
		return MapBuilder.create(HashMap.class).add("allIndustry",industryList).map();
	}
//---------------------------------------------------------------------------------------------------------------------------
	
	@Override
	public List<Industry> findAllByZoneIdOperator(Long zoneId) {
		// TODO Auto-generated method stub
		return myBatisDao.getList("industrySqlMapper.findAllIndustryByZoneIdOperator",zoneId);
	}
	
}
