package com.palmnest.dao.airconditioner.impl;

import java.util.List;

import org.springframework.stereotype.Repository;
import org.springframework.util.CollectionUtils;

import com.palmnest.application.ElementConstant;
import com.palmnest.dao.airconditioner.ProjectConfigDao;
import com.palmnest.dao.hibernate.GenericDaoHibernate;
import com.palmnest.model.airconditioner.ProjectConfig;
import com.palmnest.model.estateserve.AppUser;


@Repository("projectConfigDao")
public class ProjectConfigDaoImpl extends GenericDaoHibernate<ProjectConfig, Long> implements ProjectConfigDao {


	public ProjectConfigDaoImpl() {
		super(ProjectConfig.class);
	}

	@Override
	public ProjectConfig getProjectConfigByOrganizationId(Long organizationId) {

		StringBuffer strHql = new StringBuffer("from ProjectConfig where organizationId=?");
		List<ProjectConfig> list = getSession().createQuery(strHql.toString()).setString(0, organizationId.toString()).list();
		if (!CollectionUtils.isEmpty(list)) {
			return list.get(0);
		}
		return null;
	}

}
