JSP代码片段
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>Insert title here
action处理如下
public void getNodeData() { List
Service处理如下
public List> getNodes(String id) { return dao.getNodes(id); }
Dao处理如下
public List> getNodes(String id) { List params = new ArrayList (); StringBuffer querySQL = new StringBuffer(); querySQL.append("SELECT tt.wsystemcode id,tt.wsystemname name"); querySQL.append(",(SELECT COUNT (1) cnt FROM datacenter_v3.tcode.t_cod_wsystem t WHERE t.parentcode = tt.wsystemcode) cnt"); querySQL.append(" FROM datacenter_v3.tcode.t_cod_wsystem tt"); querySQL.append(" WHERE 1=1"); if(Tool.isNull(id)){ querySQL.append(" and tt.parentcode is null"); }else{ querySQL.append(" and tt.parentcode = ?"); params.add(id); } querySQL.append(" GROUP BY tt.wsystemcode,tt.wsystemname"); querySQL.append(" ORDER BY tt.wsystemcode"); return search(querySQL.toString(), params.toArray()); }