package cn.com.countrygarden.bi.main.repository;

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

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Repository;

import com.sunshine.common.repository.DataRepositoryJDBC;

@Repository("resourceCommNumRepository")
public class ResourceCommNumRepository extends DataRepositoryJDBC {
	protected final Logger log = LoggerFactory.getLogger(ResourceRepository.class);

	public ResourceCommNumRepository() {
		this.masterTable = "Tb_DeskTop_Resource_CommNum";// 表名
		// this.masterTablePK = "";// 表的主键
	}

	/**
	 * 查询每个省的项目数和每个省的建筑面积
	 * 
	 * @param paramMap
	 * @return
	 */
	public List<Map<String, Object>> queryProNumAndBuildArea(Map<String, Object> paramMap) {
		List<Map<String, Object>> resultList = new ArrayList<Map<String, Object>>();
		String sql = "select  Province,isnull(commnum,0) CommNum,isnull(buildarea,0) as BuildArea from " + this.masterTable
				+ " where province is not null and province !='' ORDER BY BuildArea DESC";
		resultList = this.jdbcTemp.queryForList(sql);
		return resultList;
	}

}
