<%@ page language="java" import="java.util.*,com.fiberhome.bcs.appprocess.common.util.*"
contentType="application/uixml+xml; charset=UTF-8" pageEncoding="UTF-8"%>
<%@ include file="/client/adapt.jsp"%>
<%@ include file="../Public/utility.jsp"%>
<%
StringBuilder sb=new StringBuilder();
sb.append("{\"users\":[");
String dbid=request.getSession().getAttribute("dbid").toString();
//缓存用户信息
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 "+
"from sys_user a left join sys_orgmenber b on a.username = b.member "+
"left join xt_ygda c on a.username = c.XM "+
"where b.ispriduty = 1 and a.ison=1 order by a.username";
List<TableRow> rows = aa.query(dbid,sql,null);
String email="";
for (TableRow row : rows){
email=row.getField("email","");
email=Utility.checkEmail(email)?email:"";
sb.append("{")
.append("\"guid\":\""+row.getField("guid","")+"\",")
.append("\"userid\":\""+row.getField("userid","")+"\",")
.append("\"username\":\""+row.getField("username","")+"\",")
.append("\"username_py\":\""+row.getField("username_py","")+"\",")
.append("\"org\":\""+row.getField("org","")+"\",")
.append("\"email\":\""+email+"\",")
.append("\"telephone\":\""+row.getField("telephone","")+"\",")
.append("\"mobilephone\":\""+row.getField("mobilephone","").replaceAll("\n", "").replaceAll("\r", "").replaceAll("\t", "")+"\",")
.append("\"duty\":\""+row.getField("duty","")+"\",")
.append("\"xb\":\""+row.getField("xb","")+"\",")
.append("\"zp\":\""+row.getField("zp","")+"\",")
.append("\"xh\":\""+row.getField("orderid","")+"\",")
.append("},");
}
sb.append("],");
//缓存部门信息
sb.append("\"orgs\":[");
sql="select orgname,suporg,orgtype,cast(orderid AS VARCHAR) as xh,guid,"+
"usercount=(select count(1) from sys_user a left join sys_orgmenber b on a.username=b.member "+
"where b.ispriduty = 1 and a.ison=1 and b.org=VXT_SysOrg.orgname) from VXT_SysOrg order by VXT_SysOrg.orgname";
rows = aa.query(dbid,sql,null);
for (TableRow row : rows){
sb.append("{")
.append("\"orgname\":\""+row.getField("orgname","").replace("\n"," ").replace("\r"," ")+"\",")
.append("\"suporg\":\""+row.getField("suporg","").replace("\n"," ").replace("\r"," ")+"\",")
.append("\"orgtype\":\""+row.getField("orgtype","").replace("\n"," ").replace("\r"," ")+"\",")
.append("\"xh\":\""+row.getField("xh","")+"\",")
.append("\"usercount\":\""+row.getField("usercount","")+"\",")
.append("\"guid\":\""+row.getField("guid","")+"\",")
.append("},");
}
sb.append("]}");
//System.out.println("cachedata4:"+sb.toString());
%>
<%=sb.toString()%>