📄 listcustomer.jsp
字号:
<%@ page language="java" contentType="text/html; charset=GBK" pageEncoding="GBK"%>
<%@ page import="com.utils.service.Impl.*" %>
<%@ page import="com.utils.model.*" %>
<%@ page import="java.util.*" %>
<%
System.out.println("执行查询页面");
int start = Integer.parseInt(request.getParameter("start"));
int limit = Integer.parseInt(request.getParameter("limit"));
//查询条件
String customerName = request.getParameter("customerName");
String customerAchor = request.getParameter("customerAchor");
String id = request.getParameter("id");
String str = "select * from Customer";
if(customerName!=null&&!customerName.equals("")){
str = str +" where customerName='"+new String((customerName).getBytes("ISO-8859-1"),"gb2312")+"'";
}
if(customerAchor!=null&&!customerAchor.equals("")){
str = str +" and customerAchor='"+new String((customerAchor).getBytes("ISO-8859-1"),"gb2312")+"'";
}
if(id!=null&&!id.equals("")){
str = str +" where id='"+id+"'";
}
String json = "";
UtilsServiceImpl utilsControl = new UtilsServiceImpl();
List it = utilsControl.checkCustomer(str);
if(it==null||it.size()==0){
json = "{totalProperty:0,'user':[]}";
//json = json + "{id:'03101114',personName:'周俊',personDept:'aaaaa',personPost:'职员',personNational:'汉族',personNarriage:'未婚',personSex:'男',"+
//"personBirthday:'1985-3-18',personCulture:'本科',personProfessional:'计算机',personYear:'2年',personLanguage:'4级',personSalary:'4500',personAddress:'柳洲',personIDCard:'111',personSocialID:'111',personAge:25,personTel:'111'}"+
//"]}";
}else{
json = "{totalProperty:"+it.size()+",'user':[";
}
if(it!=null&&it.size()>0){
if(it.size()==1){
Customer cus = (Customer)it.get(it.size()-1);
json = json + "{id:'"+cus.getId()+"',customerName:'"+cus.getCustomerName()+"',customerAchor:'"+cus.getCustomerAchor()+"',customerTel:"+cus.getCustomerTel()+",customerAddress:'"+cus.getCustomerAddress()+"',customerEmail:'"+cus.getCustomerEmail()+"',customerNet:'"+cus.getCustomerNet()+"',customerBusiness:'"+cus.getCustomerBusiness()+"'}]}";
}else{
int length = 0;
for(int i=start;i<it.size()-1&&i<start+limit-1;i++){
Customer cus = (Customer)it.get(i);
length = i;
json = json + "{id:'"+cus.getId()+"',customerName:'"+cus.getCustomerName()+"',customerAchor:'"+cus.getCustomerAchor()+"',customerTel:"+cus.getCustomerTel()+",customerAddress:'"+cus.getCustomerAddress()+"',customerEmail:'"+cus.getCustomerEmail()+"',customerNet:'"+cus.getCustomerNet()+"',customerBusiness:'"+cus.getCustomerBusiness()+"'},";
}
Customer cus = (Customer)it.get(length+1);
json = json + "{id:'"+cus.getId()+"',customerName:'"+cus.getCustomerName()+"',customerAchor:'"+cus.getCustomerAchor()+"',customerTel:"+cus.getCustomerTel()+",customerAddress:'"+cus.getCustomerAddress()+"',customerEmail:'"+cus.getCustomerEmail()+"',customerNet:'"+cus.getCustomerNet()+"',customerBusiness:'"+cus.getCustomerBusiness()+"'}]}";
}
}
//String json = "";
//json = "{totalProperty:2,'user':["+
//"{id:'03101058',personName:'刘建明',personDept:'开发一部',personPost:'Java程序员',personNational:'汉族',personNarriage:'未婚',personSex:'男',"+
//"personBirthday:'1984-4-1',personCulture:'本科',personProfessional:'计算机',personYear:'2年',personLanguage:'4级',personSalary:'3500',personAddress:'茂名',personIDCard:'111',personSocialID:'111',personAge:25,personTel:'111'},"+
//"{id:'03101114',personName:'周俊',personDept:'aaaaa',personPost:'职员',personNational:'汉族',personNarriage:'未婚',personSex:'男',"+
//"personBirthday:'1985-3-18',personCulture:'本科',personProfessional:'计算机',personYear:'2年',personLanguage:'4级',personSalary:'4500',personAddress:'柳洲',personIDCard:'111',personSocialID:'111',personAge:25,personTel:'111'}"+
//"]}";
response.getWriter().write(json);
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -