@SuppressWarnings("unchecked")
	public static Department queryDept(Department dept, boolean isCache)
	{
		Session session = null;
		Criteria criteria = null;
		List<Department> depts = null;
		
		try
		{
			session = sessionFactory.openSession();
			criteria = session.createCriteria(Department.class);
			
			// 设置了则会进行2级缓存
			if (isCache)
			{
				criteria.setCacheable(true);
			}
			
			if (dept.getDeptId() > 0)
			{
				criteria.add(Restrictions.eq(Department.DEPT_ID, dept.getDeptId()));
			}
			
			if (null != dept.getDeptName())
			{
				criteria.add(Restrictions.eq(Department.DEPT_NAME, dept.getDeptName()));
			}
			
			depts = criteria.list();
			
			if (null == depts || depts.size() == 0)
			{
				return null;
			}
			
			return depts.get(0);
		}
		catch (Exception e)
		{
			System.out.println(e.toString());
			e.printStackTrace();
			return null;
		}
		finally
		{
			session.close();
		}
		
	}