jquery数据列表(需要json.jar)

public Map getDsrPwdList(String issubbed, int startIndex,
int maxResults, String typeTree, String nodeName, String col,
String by, String queryType, String queryValue) throws Exception {
Map<String, Object> map = new HashMap<String, Object>();
List list = new ArrayList();
try{

StringBuilder select = new StringBuilder("select b.ahqc,b.ajbs  from t_sp_ajjbxx b where   dyyg>''  and  dybg>'' ");

StringBuilder hql = new StringBuilder("from TSpAjjbxx b  where  dyyg>''  and  dybg>'' ");
select.append(" "+queryValue);
hql.append(" "+queryType);

StringBuilder orderby = new StringBuilder(" order by  ");
orderby.append(col).append(" " + by);

String sqlcount = select.toString();

int size=(Integer)daoTool.createSQLQuery("select count(1) from ("+sqlcount+") d  ").uniqueResult();

hql.append(orderby);
list = daoTool.createQuery(hql.toString()).setFirstResult(startIndex).setMaxResults(maxResults).list();

map.put("list", list);
map.put("rows", size);
}catch (Exception e) {
e.printStackTrace();
}
return map;
}
-----------------------------------------------------------------------
public void loadDsrPwdList()  throws Exception{

HttpServletResponse response = ServletActionContext.getResponse();
String page = super.getRequest().getParameter("page");
String pageSize = super.getRequest().getParameter("rp");
String issubbed = super.getRequest().getParameter("subflag") == null ? "0"
: super.getRequest().getParameter("subflag");
String typeTree = super.getRequest().getParameter("typeTree") == null ? ""
: super.getRequest().getParameter("typeTree");
String nodeName = super.getRequest().getParameter("nodeName") == null ? ""
: java.net.URLDecoder.decode(super.getRequest().getParameter(
"nodeName"), "utf-8");
String col = (super.getRequest().getParameter("sortname") == null || super
.getRequest().getParameter("sortname").equals("undefined")) ? "b.ajbs"
: super.getRequest().getParameter("sortname");
String by = (super.getRequest().getParameter("sortorder") == null || super
.getRequest().getParameter("sortorder").equals("undefined")) ? "desc"
: super.getRequest().getParameter("sortorder");
//
StringBuffer hql = new StringBuffer("");

String ah = getRequest().getParameter("qtype") ;
String ahqc= getRequest().getParameter("query");
if (ahqc != null && !ahqc.trim().equals("")) {
hql.append(" and b."+ah+"  like '%" + ahqc + "%' ");
}else{
hql.append(" and 1=2");
}
StringBuffer sql = new StringBuffer("");
sql = new StringBuffer(hql.toString());

int maxResults = Integer.parseInt(pageSize);
int startIndex = (Integer.parseInt(page) - 1) * maxResults;

Map  map= ajcxmanager.getDsrPwdList(issubbed, startIndex, maxResults, typeTree, nodeName, col, by, hql
.toString(), sql.toString());
List<Object> AJList = map.get("list") == null ? null
: (List<Object>) map.get("list");

Map<String, Object> pageInfo = new HashMap<String, Object>();
if (AJList != null && AJList.size() >0) {
List mapList = new ArrayList();
pageInfo.put("page", page);
pageInfo.put("total",map.get("rows"));

for (int i = 0; i < AJList.size(); i++) {
TSpAjjbxx jbxx = (TSpAjjbxx) AJList.get(i);

String fah=jbxx.getAhqc();
String bg =jbxx.getDybg();
String yg = jbxx.getDyyg();
//

String ajbs=jbxx.getAjbs();
List <TSpZxDsr>  dsrlist = ajcxmanager.getDsrByAjbs(ajbs);

//
if(bg==null){
bg="";
}
if(yg==null){
yg="";
}
String[]  dsrbg=bg.split(",");
String[]  dsryg=yg.split(",") ;

Map<String, Object> cellMap = new HashMap<String, Object>();

String a = "";
String b="";
String jlid ="";
for(int j = 0;j<dsrbg.length;j++){
for(int g = 0;g<dsrlist.size();g++){
if(dsrlist.get(g).getMc().equals(dsrbg[j])) {
jlid = dsrlist.get(g).getJlid();
a +="<a href='javascript:void(0);'   onclick=\"javascript:findDsrPwd('"+fah+"','"+jlid+"','"+dsrbg[j]+"');return false;\" >"+dsrbg[j]+"</a>,";
}
}
}
for(int o= 0;o<dsryg.length;o++){
for(int h = 0;h<dsrlist.size();h++){
if(dsrlist.get(h).getMc().equals(dsryg[o])) {
jlid = dsrlist.get(h).getJlid();

b += "<a href='javascript:void(0);'    onclick=\"javascript:findDsrPwd('"+fah+"','"+jlid+"','"+dsryg[o]+"');return false;\"  >"+dsryg[o]+"</a>,";
}
}
}
String dsr = "";
if(a != null && !"".equals(a)){
if(b != null && !"".equals(b)){
dsr = a+","+b;
}
dsr = a;
}else{
if(b != null && !"".equals(b)){
dsr =b;
}
}
cellMap.put("cell", new Object[] {fah,dsr});
mapList.add(cellMap);
}
pageInfo.put("rows", mapList);
}
else {
pageInfo.put("page", 0);
pageInfo.put("total", 0);
}
JSONObject object = new JSONObject(pageInfo);
response.setContentType("html/txt");
response.setCharacterEncoding("utf-8");
response.setHeader("Cache-Control", "no-cache, must-revalidate");
response.setHeader("Pragma", "no-cache");
response.getWriter().write(object.toString());
response.getWriter().flush();
response.getWriter().close();



}

你可能感兴趣的:(JavaScript,java,map)