cacheData

 1 <%@ page language="java" import="java.util.*,com.fiberhome.bcs.appprocess.common.util.*"
 2  contentType="application/uixml+xml; charset=UTF-8" pageEncoding="UTF-8"%>
 3 <%@ include file="/client/adapt.jsp"%>
 4 <%@ include file="../Public/utility.jsp"%>
 5 <%
 6 StringBuilder sb=new StringBuilder();
 7 sb.append("{\"users\":[");
 8 String dbid=request.getSession().getAttribute("dbid").toString();
 9 //缓存用户信息
10 String sql="select dbo.FXT_GetPinYin(a.fullname) as username_py,a.username as userid,a.fullname as username,rtrim(ltrim(a.email)) as email,a.telephone,a.mobilephone,b.duty,b.org,c.xb,c.guid,c.zp,a.orderid "+ 
11             "from sys_user a left join sys_orgmenber b on a.username = b.member "+ 
12             "left join xt_ygda c on a.username = c.XM "+
13             "where b.ispriduty = 1 and a.ison=1 order by a.username";
14 List<TableRow> rows = aa.query(dbid,sql,null);
15 String email="";
16 for (TableRow row : rows){
17     email=row.getField("email","");
18     email=Utility.checkEmail(email)?email:"";
19     sb.append("{")
20        .append("\"guid\":\""+row.getField("guid","")+"\",")
21        .append("\"userid\":\""+row.getField("userid","")+"\",")
22        .append("\"username\":\""+row.getField("username","")+"\",")
23        .append("\"username_py\":\""+row.getField("username_py","")+"\",")
24        .append("\"org\":\""+row.getField("org","")+"\",")
25        .append("\"email\":\""+email+"\",")
26        .append("\"telephone\":\""+row.getField("telephone","")+"\",")
27        .append("\"mobilephone\":\""+row.getField("mobilephone","").replaceAll("\n", "").replaceAll("\r", "").replaceAll("\t", "")+"\",")
28        .append("\"duty\":\""+row.getField("duty","")+"\",")
29        .append("\"xb\":\""+row.getField("xb","")+"\",")
30        .append("\"zp\":\""+row.getField("zp","")+"\",")
31        .append("\"xh\":\""+row.getField("orderid","")+"\",")
32        .append("},");
33 }
34 sb.append("],");
35 //缓存部门信息
36 sb.append("\"orgs\":[");
37 sql="select orgname,suporg,orgtype,cast(orderid AS VARCHAR) as xh,guid,"+
38       "usercount=(select count(1) from sys_user a left join sys_orgmenber b on a.username=b.member "+
39       "where b.ispriduty = 1 and a.ison=1 and b.org=VXT_SysOrg.orgname) from VXT_SysOrg order by VXT_SysOrg.orgname";
40 rows = aa.query(dbid,sql,null);
41 for (TableRow row : rows){
42     sb.append("{")
43        .append("\"orgname\":\""+row.getField("orgname","").replace("\n"," ").replace("\r"," ")+"\",")
44        .append("\"suporg\":\""+row.getField("suporg","").replace("\n"," ").replace("\r"," ")+"\",")
45        .append("\"orgtype\":\""+row.getField("orgtype","").replace("\n"," ").replace("\r"," ")+"\",")
46        .append("\"xh\":\""+row.getField("xh","")+"\",")
47        .append("\"usercount\":\""+row.getField("usercount","")+"\",")
48        .append("\"guid\":\""+row.getField("guid","")+"\",")
49        .append("},");
50 }
51 sb.append("]}");
52 //System.out.println("cachedata4:"+sb.toString());
53 %>
54 <%=sb.toString()%>

 

posted @ 2017-03-07 17:23  Zepx  阅读(286)  评论(0编辑  收藏  举报