关于hibernate中的查询得到一个集合,集合里面又是数组

长平狐 发布于 2012/11/28 15:41
阅读 524
收藏 0
	public List getProcessByTaskName(String taskName) throws  Exception{
		String hql = "select t, p.qType,p.ruleCount from QueueTaskProcess t , QueueProcess p " +
				"where t.processName = p.processName and t.taskName=? order by t.processIndex";
		List list=this.getEntityManager().find(hql,new Object[]{taskName});
		return list;		
	}

在控制层:

	@RequestMapping(value = "searchTProcess", method = RequestMethod.POST)
	public ModelAndView searchTaskProcess(HttpServletRequest request) throws Exception {
		ModelAndView mav1 = new ModelAndView("queue/task/queueTaskProcessList");
		String taskName = Escape.unescape(request.getParameter("taskName").trim());		
		List taskProcessList = qTaskProcessService.getTaskProcess(taskName);			
		mav1.addObject("taskProcessList",taskProcessList );
		mav1.addObject("taskName", taskName);
		return mav1;
	}
	

页面:

			<c:forEach items="${taskProcessList}" var="queueTaskProcess" varStatus="">
				<tr class="tr_bg" id="<c:out value="${queueTaskProcess[0].id}"/>" >
					<td>
					<input type="checkbox" name="processItem"  value="<c:out value="${queueTaskProcess[0].id}"/>" /></td>
					<td>
					<div class="taskProcessTip" tip="${queueTaskProcess[0].taskName}">
					    <span>
							<c:out value="${fn:substring(queueTaskProcess[0].taskName, 0, 20)}" />
								<c:if test="${fn:length(queueTaskProcess[0].taskName) > 20}">
										...
								</c:if>
						</span>	
					</div>				
					</span></td>
					<td><span><c:out value="${queueTaskProcess[0].processIndex}"/></span></td>
					<td>
					<div class="processListTip" tip="${queueTaskProcess[0].processName}">
							<span>
							<c:out value="${fn:substring(queueTaskProcess[0].processName, 0, 20)}" />
									<c:if test="${fn:length(queueTaskProcess[0].processName) > 20}">
										...
									</c:if>
							</span>	
					</div>					
					</td>										
					<td><span><c:out value="${queueTaskProcess[1]}" /><span></td>
					<td><span><c:out value="${queueTaskProcess[0].office}"/></span></td>
					<td><span><c:out value="${queueTaskProcess[2]}" /></span></td>												
					<td style="cursor: pointer;" onclick="showRule('${queueTaskProcess[0].processName}','${queueTaskProcess[1]}')"><span ><font style="color:#1C86EE ;">点击查看</font></span></td>
					<td id="taskStatus_${queueTaskProcess[0].id}" style="cursor: pointer;" onclick="modifyProcessStatus('${queueTaskProcess[0].id}')">
					<c:if test="${queueTaskProcess[0].status == 0}"><font style="color: red ;"><c:out value="禁用"/></font></c:if>
				    <c:if test="${queueTaskProcess[0].status == 1}"><font style="color: #228B22;"><c:out value="启用"/></font></c:if>
					</td>
					<td>	
					<div class="q_up" onclick="modifyProcessIndex(${queueTaskProcess[0].processIndex},'up')"></div>
                    <div class="q_down" onclick="modifyProcessIndex(${queueTaskProcess[0].processIndex},'down')"></div>	
                    </td>															
				</tr>
			</c:forEach>





原文链接:http://blog.csdn.net/longeremmy/article/details/8098677
加载中
返回顶部
顶部