From acd46c13a2a74b00f933629887c8093fe419278b Mon Sep 17 00:00:00 2001
From: 星伟 <星伟@192.168.10.25>
Date: 星期二, 25 九月 2018 10:34:43 +0800
Subject: [PATCH] 左侧导航4层提交
---
gx_tieta/src/com/fgkj/actions/BattInfAction.java | 37 +++++++--
gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java | 131 +++++++++++++++++++-------------
gx_tieta/src/com/fgkj/db/DBUtil.java | 3
gx_tieta/src/com/fgkj/services/BattInfServices.java | 61 +++++++++++----
4 files changed, 152 insertions(+), 80 deletions(-)
diff --git a/gx_tieta/src/com/fgkj/actions/BattInfAction.java b/gx_tieta/src/com/fgkj/actions/BattInfAction.java
index e1558df..5c91a30 100644
--- a/gx_tieta/src/com/fgkj/actions/BattInfAction.java
+++ b/gx_tieta/src/com/fgkj/actions/BattInfAction.java
@@ -243,13 +243,7 @@
return SUCCESS;
}
- //鏌ヨ鎵�鏈夌殑鏈烘埧
- public String serchAllStation(){
- User_inf u = (User_inf)getUser();
- ServiceModel model = service.serchAllStation(u);
- result = ActionUtil.tojson(model);
- return SUCCESS;
- }
+
//鎼滅储鏈烘埧鎴栫數姹犵粍
public String serchStationOrBattgroup(){
@@ -258,7 +252,34 @@
result = ActionUtil.tojson(model);
return SUCCESS;
}
- //鏍规嵁鏈烘埧id鏌ヨ鏈烘埧涓嬬殑鐢垫睜缁勪俊鎭�
+ //鏌ヨ鎵�鏈夌殑鐪佷唤(宸︿晶瀵艰埅绗竴灞傦紝鏌ユ墍鏈夌殑鐪佷唤,num涓瓨鏀緐id)
+ public String serchAllStation(){
+ User_inf u = (User_inf)getUser();
+ BattInf binf=new BattInf();
+ binf.setNum(u.getUId());
+ ServiceModel model = service.serchAllStation(binf);
+ result = ActionUtil.tojson(model);
+ return SUCCESS;
+ }
+ //鏌ヨ绠$悊鐨勫競(宸︿晶瀵艰埅绗簩灞傦紝鏌ユ墍鏈夌殑甯�,num涓瓨鏀緐id)
+ public String serchStationName2(){
+ User_inf u = (User_inf)getUser();
+ BattInf binf = ActionUtil.getGson().fromJson(json, BattInf.class);
+ binf.setNum(u.getUId());
+ ServiceModel model = service.serchStationName2(binf);
+ result = ActionUtil.tojson(model);
+ return SUCCESS;
+ }
+ //鏌ヨ绠$悊鐨勬満鎴�(宸︿晶瀵艰埅绗笁灞傦紝鏌ユ墍鏈夌殑鏈烘埧,num涓瓨鏀緐id)
+ public String serchStationName3(){
+ User_inf u = (User_inf)getUser();
+ BattInf binf = ActionUtil.getGson().fromJson(json, BattInf.class);
+ binf.setNum(u.getUId());
+ ServiceModel model = service.serchStationName3(binf);
+ result = ActionUtil.tojson(model);
+ return SUCCESS;
+ }
+ //鏍规嵁鏈烘埧id鏌ヨ鏈烘埧涓嬬殑鐢垫睜缁勪俊鎭�(宸︿晶瀵艰埅绗洓灞�,鏍规嵁鏈烘埧鏌ヨ涓嬮潰鐨勭數姹犵粍,num涓瓨鏀緐id)
public String serchBattByStation(){
BattInf binf = ActionUtil.getGson().fromJson(json, BattInf.class);
ServiceModel model = service.serchBattByStation(binf);
diff --git a/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java b/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java
index 96b9411..81d2fca 100644
--- a/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java
+++ b/gx_tieta/src/com/fgkj/dao/impl/BattInfImpl.java
@@ -3244,83 +3244,106 @@
}
- //鏌ヨ鎵�鏈夌殑鏈烘埧
+ //鏌ヨ鎵�鏈夌殑鐪佷唤(宸︿晶瀵艰埅绗竴灞傦紝鏌ユ墍鏈夌殑鐪佷唤,num涓瓨鏀緐id)
public List serchAllStation(Object obj){
- User_inf uinf=(User_inf) obj;
- String sql="select DISTINCT stationid,StationName,StationName1,StationName2,StationName3,StationName4,StationName5,StationName6,StationName7,StationName8,StationName9,fBSDeviceId " +
+ BattInf binf=(BattInf) obj;;
+ String sql="select DISTINCT StationName " +
" FROM db_battinf.tb_battinf " +
" where StationId in(" +
" select distinct db_user.tb_user_battgroup_baojigroup_battgroup.StationId from db_user.tb_user_battgroup_baojigroup_battgroup,db_user.tb_user_battgroup_baojigroup_usr where db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id=db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id and db_user.tb_user_battgroup_baojigroup_usr.uId=?" +
" )";
- List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{uinf.getUId()},new CallBack() {
+ List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{binf.getNum()},new CallBack() {
public List getResults(ResultSet rs) {
List list=new ArrayList();
- String conStr="-";//杩炴帴鏈烘埧鍚嶇О鐨勭鍙�
- try {
- while(rs.next()){
- BattInf batt = new BattInf();
- String stationName="";
- if(!rs.getString("StationName1").trim().equals("")){
- stationName+=rs.getString("StationName1");
+ try {
+ while(rs.next()){
+ BattInf batt = new BattInf();
+ batt.setStationName1(rs.getString("stationName1"));
+ list.add(batt);
}
- if(!rs.getString("StationName2").trim().equals("")){
- stationName+=conStr;
- stationName+=rs.getString("StationName2");
- }
- if(!rs.getString("StationName3").trim().equals("")){
- stationName+=conStr;
- stationName+=rs.getString("StationName3");
- }
- if(!rs.getString("StationName4").trim().equals("")){
- stationName+=conStr;
- stationName+=rs.getString("StationName4");
- }
- if(!rs.getString("StationName5").trim().equals("")){
- stationName+=conStr;
- stationName+=rs.getString("StationName5");
- }
- if(!rs.getString("StationName6").trim().equals("")){
- stationName+=conStr;
- stationName+=rs.getString("StationName6");
- }
- if(!rs.getString("StationName7").trim().equals("")){
- stationName+=conStr;
- stationName+=rs.getString("StationName7");
- }
- if(!rs.getString("StationName8").trim().equals("")){
- stationName+=conStr;
- stationName+=rs.getString("StationName8");
- }
- if(!rs.getString("StationName9").trim().equals("")){
- stationName+=conStr;
- stationName+=rs.getString("StationName9");
- }
- batt.setStationName(stationName);
- batt.setStationId(rs.getString("StationId"));
- batt.setFBSDeviceId(rs.getInt("fBSDeviceId"));
- list.add(batt);
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
}
- } catch (SQLException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
return list;
}
} );
return list;
}
- //鏍规嵁鏈烘埧id鏌ヨ鏈烘埧涓嬬殑鐢垫睜缁勪俊鎭�
+ //鏌ヨ绠$悊鐨勫競(宸︿晶瀵艰埅绗簩灞傦紝鏌ユ墍鏈夌殑甯�,num涓瓨鏀緐id)
+
+ //鏌ヨ绠$悊鐨勫競(宸︿晶瀵艰埅绗簩灞傦紝鏌ユ墍鏈夌殑甯�,num涓瓨鏀緐id)
+ public List serchStationName2(Object obj){
+ BattInf binf=(BattInf) obj;
+ String sql="select DISTINCT StationName2 " +
+ " FROM db_battinf.tb_battinf " +
+ " where StationId in(" +
+ " select distinct db_user.tb_user_battgroup_baojigroup_battgroup.StationId from db_user.tb_user_battgroup_baojigroup_battgroup,db_user.tb_user_battgroup_baojigroup_usr where db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id=db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id and db_user.tb_user_battgroup_baojigroup_usr.uId=?" +
+ " ) and StationName1 like ?";
+ List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{binf.getNum(),"%"+binf.getStationName1()+"%"},new CallBack() {
+
+ public List getResults(ResultSet rs) {
+ List list=new ArrayList();
+ try {
+ while(rs.next()){
+ BattInf batt = new BattInf();
+ batt.setStationName2(rs.getString("stationName2"));
+ list.add(batt);
+ }
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return list;
+ }
+ } );
+ return list;
+ }
+ //鏌ヨ绠$悊鐨勬満鎴�(宸︿晶瀵艰埅绗笁灞傦紝鏌ユ墍鏈夌殑鏈烘埧,num涓瓨鏀緐id)
+ public List serchStationName3(Object obj){
+ BattInf binf=(BattInf) obj;
+ String sql="select DISTINCT StationName3,stationid,fbsdeviceid " +
+ " FROM db_battinf.tb_battinf " +
+ " where StationId in(" +
+ " select distinct db_user.tb_user_battgroup_baojigroup_battgroup.StationId from db_user.tb_user_battgroup_baojigroup_battgroup,db_user.tb_user_battgroup_baojigroup_usr where db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id=db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id and db_user.tb_user_battgroup_baojigroup_usr.uId=?" +
+ " ) and StationName1 like ? and StationName2 like ? ";
+ List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{binf.getNum(),"%"+binf.getStationName1()+"%","%"+binf.getStationName2()+"%"},new CallBack() {
+
+ public List getResults(ResultSet rs) {
+ List list=new ArrayList();
+ try {
+ while(rs.next()){
+ BattInf batt = new BattInf();
+ batt.setStationName3(rs.getString("stationName3"));
+ batt.setStationId(rs.getString("stationId"));
+ batt.setFBSDeviceId(rs.getInt("fBSDeviceId"));
+ list.add(batt);
+ }
+ } catch (SQLException e) {
+ // TODO Auto-generated catch block
+ e.printStackTrace();
+ }
+ return list;
+ }
+ } );
+ return list;
+ }
+
+
+ //鏍规嵁鏈烘埧id鏌ヨ鏈烘埧涓嬬殑鐢垫睜缁勪俊鎭�(宸︿晶瀵艰埅绗洓灞�,鏍规嵁鏈烘埧鏌ヨ涓嬮潰鐨勭數姹犵粍,num涓瓨鏀緐id)
public List serchBattByStation(Object obj){
BattInf binf=(BattInf) obj;
String sql="select DISTINCT StationName,StationId,StationIP,FBSDeviceId,BattGroupName,BattGroupName1,BattGroupName2,MonCount,battgroupId,MonCapStd,MonVolStd,MonResStd,MonSerStd,BattProducer,BattInUseDate,GroupIndexInFBSDevice " +
"from db_battinf.tb_battinf where stationid=? " +
+ "and StationId in(" +
+ " select distinct db_user.tb_user_battgroup_baojigroup_battgroup.StationId from db_user.tb_user_battgroup_baojigroup_battgroup,db_user.tb_user_battgroup_baojigroup_usr where db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id=db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id and db_user.tb_user_battgroup_baojigroup_usr.uId=?" +
+ " ) " +
"ORDER BY StationName1,battgroupId ";
- List list=DAOHelper.executeQuery(sql, DBUtil.getConn(),new Object[]{binf.getStationId()},new CallBack() {
+ List list=DAOHelper.executeQuery(sql, DBUtil.getConn(),new Object[]{binf.getNum(),binf.getStationId()},new CallBack() {
public List getResults(ResultSet rs) {
List list = new ArrayList();
- String conStr="-";//杩炴帴鏈烘埧鍚嶇О鐨勭鍙�
try {
while (rs.next()) {
BattInf batt = new BattInf();
diff --git a/gx_tieta/src/com/fgkj/db/DBUtil.java b/gx_tieta/src/com/fgkj/db/DBUtil.java
index 4c6e1bc..4195765 100644
--- a/gx_tieta/src/com/fgkj/db/DBUtil.java
+++ b/gx_tieta/src/com/fgkj/db/DBUtil.java
@@ -15,9 +15,10 @@
//private static String username="website";
//private static String password="amtb3737";
- //private static String url="jdbc:mysql://118.89.139.230:3360/db_user";
+
private static String username="root";
private static String password="lmx8688139";
+ //private static String url="jdbc:mysql://118.89.139.230:3360/db_user";
private static String url="jdbc:mysql://123.207.82.239:3360/db_user";
//private static String url="jdbc:mysql://192.168.0.34:3360/db_user";
//private static String url="jdbc:mysql://127.0.0.1:3360/db_user";
diff --git a/gx_tieta/src/com/fgkj/services/BattInfServices.java b/gx_tieta/src/com/fgkj/services/BattInfServices.java
index b292edb..a6c5028 100644
--- a/gx_tieta/src/com/fgkj/services/BattInfServices.java
+++ b/gx_tieta/src/com/fgkj/services/BattInfServices.java
@@ -641,21 +641,7 @@
}
return model;
}
- //鏌ヨ鎵�鏈夌殑鏈烘埧
- public ServiceModel serchAllStation(Object obj){
- List list=((BattInfImpl)dao).serchAllStation(obj);
- if (list != null && list.size() > 0) {
- model.setCode(1);
- model.setData(list);
- model.setMsg("鏌ヨ鎴愬姛!");
- }else{
- model.setCode(0);
- model.setData(list);
- model.setMsg("鏌ヨ澶辫触!");
- }
- //System.out.println(model);
- return model;
- }
+
//鎼滅储鏈烘埧鎴栫數姹犵粍
public ServiceModel serchStationOrBattgroup(Object obj){
List list=((BattInfImpl)dao).serchStationOrBattgroup(obj);
@@ -671,7 +657,49 @@
//System.out.println(list.size());
return model;
}
- //鏍规嵁鏈烘埧id鏌ヨ鏈烘埧涓嬬殑鐢垫睜缁勪俊鎭�
+ //鏌ヨ鎵�鏈夌殑鐪佷唤(宸︿晶瀵艰埅绗竴灞傦紝鏌ユ墍鏈夌殑鐪佷唤)
+ public ServiceModel serchAllStation(Object obj){
+ List list=((BattInfImpl)dao).serchAllStation(obj);
+ if (list != null && list.size() > 0) {
+ model.setCode(1);
+ model.setData(list);
+ model.setMsg("鏌ヨ鎴愬姛!");
+ }else{
+ model.setCode(0);
+ model.setData(list);
+ model.setMsg("鏌ヨ澶辫触!");
+ }
+ return model;
+ }
+ //鏌ヨ绠$悊鐨勫競(宸︿晶瀵艰埅绗簩灞傦紝鏌ユ墍鏈夌殑甯�,num涓瓨鏀緐id)
+ public ServiceModel serchStationName2(Object obj){
+ List list=((BattInfImpl)dao).serchStationName2(obj);
+ if (list != null && list.size() > 0) {
+ model.setCode(1);
+ model.setData(list);
+ model.setMsg("鏌ヨ鎴愬姛!");
+ }else{
+ model.setCode(0);
+ model.setData(list);
+ model.setMsg("鏌ヨ澶辫触!");
+ }
+ return model;
+ }
+ //鏌ヨ绠$悊鐨勬満鎴�(宸︿晶瀵艰埅绗笁灞傦紝鏌ユ墍鏈夌殑鏈烘埧,num涓瓨鏀緐id)
+ public ServiceModel serchStationName3(Object obj){
+ List list=((BattInfImpl)dao).serchStationName3(obj);
+ if (list != null && list.size() > 0) {
+ model.setCode(1);
+ model.setData(list);
+ model.setMsg("鏌ヨ鎴愬姛!");
+ }else{
+ model.setCode(0);
+ model.setData(list);
+ model.setMsg("鏌ヨ澶辫触!");
+ }
+ return model;
+ }
+ //鏍规嵁鏈烘埧id鏌ヨ鏈烘埧涓嬬殑鐢垫睜缁勪俊鎭�(宸︿晶瀵艰埅绗洓灞�,鏍规嵁鏈烘埧鏌ヨ涓嬮潰鐨勭數姹犵粍,num涓瓨鏀緐id)
public ServiceModel serchBattByStation(Object obj){
List list=((BattInfImpl)dao).serchBattByStation(obj);
if (list != null && list.size() > 0) {
@@ -683,7 +711,6 @@
model.setData(list);
model.setMsg("鏌ヨ澶辫触!");
}
- //System.out.println(model);
return model;
}
//鏌ヨ鎵�鏈夌殑鐢垫睜缁勬暟
--
Gitblit v1.9.1