package server;
//业务实体的查询
import java.sql.ResultSet;
import java.sql.SQLException;
public class search {
public Object[][] searchCar() {
connect connect1=new connect();
connect connect2=new connect();
String carTableName="car";
connect1.setTableName(carTableName);
connect2.setTableName(carTableName);
String carSQL="select * from "+carTableName;
String countSQL = "select count(*) from "+carTableName;
Object[][] result = null;
connect1.setSQL(carSQL);
connect2.setSQL(countSQL);
try{
ResultSet rs1=connect1.inputConnectResult();
ResultSet rs2=connect2.inputConnectResult();
rs2.next();
result = new Object[rs2.getInt(1)][10];
int index = 0;
while(rs1.next()){//将查询结果存入二位数组中
result[index][0] = rs1.getString(1);
result[index][1] = rs1.getString(2);
result[index][2] = rs1.getString(3);
result[index][3] = rs1.getString(4);
result[index][4] = rs1.getString(5);
result[index][5] = rs1.getString(6);
result[index][6] = rs1.getString(7);
result[index][7] = rs1.getString(8);
result[index][8] = rs1.getString(9);
result[index][9] = rs1.getString(10);
index ++;
}
} catch (SQLException e){
e.printStackTrace();
}
return result;
}
public Object[][] searchbyCarID(String carId) {//根据整车的编号进行查询
connect connect1=new connect();
connect connect2=new connect();
String carTableName="car";
connect1.setTableName(carTableName);
connect2.setTableName(carTableName);
String carID =carId;
String carSQL="select * from "+carTableName+" where id LIKE'%"+carID+"%'";
String countSQL = "select count(*) from "+carTableName+" where id LIKE'%"+carID+"%'";
Object[][] result = null;
connect1.setSQL(carSQL);
connect2.setSQL(countSQL);
try{
ResultSet rs1=connect1.inputConnectResult();
ResultSet rs2=connect2.inputConnectResult();
rs2.next();
result = new Object[rs2.getInt(1)][10];
int index = 0;
while(rs1.next()){//将查询结果存入二位数组中
result[index][0] = rs1.getString(1);
result[index][1] = rs1.getString(2);
result[index][2] = rs1.getString(3);
result[index][3] = rs1.getString(4);
result[index][4] = rs1.getString(5);
result[index][5] = rs1.getString(6);
result[index][6] = rs1.getString(7);
result[index][7] = rs1.getString(8);
result[index][8] = rs1.getString(9);
result[index][9] = rs1.getString(10);
index ++;
}
} catch (SQLException e){
e.printStackTrace();
}
return result;
}
public Object[][] searchbyCarName(String carName) {//根据整车的名称进行查询
connect connect1=new connect();
connect connect2=new connect();
String carTableName="car";
connect1.setTableName(carTableName);
connect2.setTableName(carTableName);
String carname =carName;
String carSQL="select * from "+carTableName+" where name LIKE'%"+carname+"%'";
String countSQL = "select count(*) from "+carTableName+" where name LIKE'%"+carname+"%'";
Object[][] result = null;
connect1.setSQL(carSQL);
connect2.setSQL(countSQL);
try{
ResultSet rs1=connect1.inputConnectResult();
ResultSet rs2=connect2.inputConnectResult();
rs2.next();
result = new Object[rs2.getInt(1)][10];
int index = 0;
while(rs1.next()){//将查询结果存入二位数组中
result[index][0] = rs1.getString(1);
result[index][1] = rs1.getString(2);
result[index][2] = rs1.getString(3);
result[index][3] = rs1.getString(4);
result[index][4] = rs1.getString(5);
result[index][5] = rs1.getString(6);
result[index][6] = rs1.getString(7);
result[index][7] = rs1.getString(8);
result[index][8] = rs1.getString(9);
result[index][9] = rs1.getString(10);
index ++;
}
} catch (SQLException e){
e.printStackTrace();
}
return result;
}
public Object[][] searchbyCarType(String carType) {//根据整车的类型进行查询
connect connect1=new connect();
connect connect2=new connect();
String carTableName="car";
connect1.setTableName(carTableName);
connect2.setTableName(carTableName);
String cartype =carType;
String carSQL="select * from "+carTableName+" where type='"+cartype+"'";
String countSQL = "select count(*) from "+carTableName+" where type='"+cartype+"'";
Object[][] result = null;
connect1.setSQL(carSQL);
connect2.setSQL(countSQL);
try{
ResultSet rs1=connect1.inputConnectResult();
ResultSet rs2=connect2.inputConnectResult();
rs2.next();
result = new Object[rs2.getInt(1)][10];
int index = 0;
while(rs1.next()){//将查询结果存入二位数组中
result[index][0] = rs1.getString(1);
result[index][1] = rs1.getString(2);
result[index][2] = rs1.getString(3);
result[index][3] = rs1.getString(4);
result[index][4] = rs1.getString(5);
result[index][5] = rs1.getString(6);
result[index][6] = rs1.getString(7);
result[index][7] = rs1.getString(8);
result[index][8] = rs1.getString(9);
result[index][9] = rs1.getString(10);
index ++;
}
} catch (SQLException e){
e.printStackTrace();
}
return result;
}
public Object[][] searchBJ() {
connect connect1=new connect();
connect connect2=new connect();
String bjTableName="bujian";
connect1.setTableName(bjTableName);
connect2.setTableName(bjTableName);
String bjSQL="select * from "+bjTableName;
String countSQL = "select count(*) from "+bjTableName;
Object[][] result = null;
connect1.setSQL(bjSQL);
connect2.setSQL(countSQL);
try{
ResultSet rs1=connect1.inputConnectResult();
ResultSet rs2=connect2.inputConnectResult();
rs2.next();
result = new Object[rs2.getInt(1)][7];
int index = 0;
while(rs1.next()){//将查询结果存入二位数组中
result[index][0] = rs1.getString(1);
result[index][1] = rs1.getString(2);
result[index][2] = rs1.getString(3);
result[index][3] = rs1.getString(4);
result[index][4] = rs1.getString(5);
result[index][5] = rs1.getString(6);
result[index][6] = rs1.getString(7);
index ++;
}
} catch (SQLException e){
e.printStackTrace();
}
return result;
}
public Object[][] searchbyBJID(String bjId) {//根据部件的编号进行查询
connect connect1=new connect();
connect connect2=new connect();
String bjTableName="bujian";
connect1.setTableName(bjTableName);
connect2.setTableName(bjTableName);
String bjID =bjId;
String bjSQL="select * from "+bjTableName+" where id LIKE'%"+bjID+"%'";
String countSQL = "select count(*) from "+bjTableName+" where id LIKE'%"+bjID+"%'";
Object[][] result = null;
connect1.setSQL(bjSQL);
connect2.setSQL(countSQL);
try{
ResultSet rs1=connect1.inputConnectResult();
ResultSet rs2=connect2.inputConnectResult();
rs2.next();
result = new Object[rs2.getInt(1)][7];
int index = 0;
while(rs1.next()){//将查询结果存入二位数组中
result[index][0] = rs1.getString(1);
result[index][1] = rs1.getString(2);
result[index][2] = rs1.getString(3);
result[index][3] = rs1.getString(4);
result[index][4] = rs1.getString(5);
result[index][5] = rs1.getString(6);
result[index][6] = rs1.getString(7);
index ++;
}
} catch (SQLException e){
e.printStackTrace();
}
return result;
}
public Object[][] searchbyBJName(String bjName) {//根据部件的名称进行查询
connect connect1=new connect();
connect connect2=new connect();
String bjTableName="bujian";
connect1.setTableName(bjTableName);
connect2.setTableName(bjTableName);
String bjname =bjName;
Stri
Casablanca07
- 粉丝: 3
- 资源: 3
最新资源
- 基于SSM框架的课堂签到系统设计源码分享
- 力荐!Qt中的C++技术(含源码).7z
- 基于Java技术的成人职业技能教育网络课堂系统设计源码
- 基于Python的AI车牌识别系统、微信小程序助农驿站及图书管理系统设计源码
- 基于PHP的o2o同城系统交通服务模块设计源码
- 永磁同步电机基于滑膜的无速度传感器控制仿真 simulink pmsm+smo
- 基于C#开发的全面功能开源称重软件设计源码
- Golang-alpine 镜像文件
- 基于Java、CSS、JavaScript的三平台通用小说下载器与阅读器设计源码
- 带遗忘因子的递推最小二乘轮胎线性侧偏刚度估计 matlab与simulink联合仿真轮胎侧偏刚度估计,可用于车辆动力学模型建模
- 基于Python语言的多语言支持QQ/频道/OneBot ChatGPT机器人设计源码
- 基于Vue的hao123网页简洁版设计源码
- 基于Vue的海外短剧系统多语言版H5与APP双端设计源码
- 拉丁超立方抽样 分层随机抽样 实现多种概率分布数据的生成 图1、2展示了正态分布的拉丁超立方抽样与简单随机抽样的对比,拉丁超立方抽样生成的数据更加光滑、分布范围更加均匀,可考虑到小概率事件的生成 案例
- 基于C++和C语言的武汉理工大学2020数据结构与算法综合实验设计源码
- 阀测试项目软件,上位机通过Labwindows CVI编写,下位机使用的是倍福PLC,下位机软件通过TwinCAT3编写,上位机和下位机通过ADS通讯,还包括一台S7-200 smart,通过OPC进
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈