日期:2014-05-16  浏览次数:20407 次

hibernate的使用map返回数据

hibernate使用map返回查询数据

@SuppressWarnings("unchecked")
	public Page<?> getDisCheckunitinfoByPlanUuid(String planUuid,int pageNo,int pageSize){
		
		Page page = new Page();

		page.setPageNo(pageNo);
		page.setPageSize(pageSize);
		//0 未删除 1 已删除
		//0 未选 1已选
		StringBuffer sb = new StringBuffer();
		sb.append("select new map( ");
		sb.append("s.planUuid as planUuid, ");
		sb.append("s.checkunitName as checkunitName, ");
		sb.append("s.checkunitUuid as checkunitUuid, ");
		sb.append("s.address as address, ");
		sb.append("nzk.numFromCenter as numFromCenter )");
		sb.append("from NationCheckunitinfo s ,NationZonecheck nzk ");
		sb.append(" where s.isdel != 1 ");
		//判断选中状态为空
		sb.append(" and s.note = 1 ");
		sb.append(" and s.checkunitUuid = nzk.checkunitUuid ");
		
		if(StrUtil.isNotNull(planUuid)){
			sb.append(" and s.planUuid = '").append(planUuid+"'");
		}
		
		return this.findPage(page, sb.toString(), new HashMap<String,String>());
		
	}

?

?

?