<%@ page language="java" import="java.util.*" pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%> <%@ page import="cn.sinobest.framework.util.Util,cn.sinobest.framework.util.ConfUtil,cn.sinobest.framework.security.SecurityDes, cn.sinobest.framework.service.json.JSONUtilities,cn.sinobest.framework.comm.Environment,cn.sinobest.framework.service.bigdict.DictSort"%> <% String dictName = request.getParameter("dictName"); String whereCls = request.getParameter("whereCls")==null?"":(String)request.getParameter("whereCls"); //System.out.println("where-----------------------"+whereCls); String dsId = (String)Util.nvl(request.getParameter("dsId"),""); String dictStr = "{}"; if (!Util.isEmpty(dictName)) { if(dictName.equals("DICT_VERSION")){ dictStr = ConfUtil.getSysParam("DICT_VERSION","1"); }else{ List dict = null; Map> dicts = null; if (dictName.indexOf('@') != -1) { String[] value = dictName.split("\\@"); if (value[1] != null && !value[1].trim().equals("")) { String subcode = ""; String qSubCode = value[1].toUpperCase(); dicts = ConfUtil.getSubDict(value[0],value[1]); } } else if (dictName.startsWith("dyndict_")){ if (Util.isEmpty(whereCls)) { whereCls = "1=1"; dicts = ConfUtil.getDynDict(dictName, whereCls, dsId); }else if("null".equals(whereCls)){ dicts = ConfUtil.getDynDict(dictName, whereCls, dsId); }else{ if(Environment.isEncryptWhere()){ String wherekey = (String) request.getSession(true).getAttribute("whereCls_key"); if(!Util.isEmpty(wherekey)){ try{ SecurityDes de = new SecurityDes(); whereCls = de.des(wherekey, de.HexTostring(whereCls), false); de = null; Util.validateQueryStringSafty(whereCls); dicts = ConfUtil.getDynDict(dictName, whereCls, dsId); }catch(Exception e){ } } }else{ dicts = ConfUtil.getDynDict(dictName, whereCls, dsId); } } } else { dicts = ConfUtil.getDict(dictName); // if(dicts != null) { // dict = new ArrayList(dicts.size());; // for (Map.Entry> entry : dicts.entrySet()) { // dict.add(new String[]{entry.getKey(),entry.getValue().get("ITEMCODE"),entry.getValue().get("AAA103")}); // } // } } //System.out.println("dictName:"+dictName); //System.out.println("whereCls:"+whereCls); if (dicts != null) { dict = new ArrayList(dicts.size()); for (Map.Entry> entry : dicts.entrySet()) { dict.add(new String[]{entry.getKey(),entry.getValue().get("ITEMCODE"),entry.getValue().get("AAA103"), entry.getValue().get("SUBCODE")}); } //如果whereCls配置了排序语句,则按照whereCls配置排序 if(whereCls.toUpperCase().indexOf("ORDER")<=-1)Collections.sort(dict,DictSort.DICTSORTOR); dictStr = new JSONUtilities().parseObject(dict).toString(); } } } out.println(dictStr); %>