| | |
| | | package com.fgkj.dao.impl;
|
| | |
|
| | | import java.sql.Connection;
|
| | | import java.sql.ResultSet;
|
| | | import java.sql.SQLException;
|
| | | import java.util.ArrayList;
|
| | |
| | | import com.fgkj.dao.BaseDAO;
|
| | | import com.fgkj.dao.CallBack;
|
| | | import com.fgkj.dao.DAOHelper;
|
| | | import com.fgkj.dao.LimitNumberFactory;
|
| | | import com.fgkj.db.DBUtil;
|
| | | import com.fgkj.db.IDatabaseName;
|
| | | import com.fgkj.dto.BattDischarge_plan;
|
| | |
| | | import com.fgkj.dto.BattMap_information;
|
| | | import com.fgkj.dto.Batt_Maint_Dealarm;
|
| | | import com.fgkj.dto.Battalarm_data;
|
| | | import com.fgkj.dto.Page;
|
| | | import com.fgkj.dto.User_inf;
|
| | |
|
| | | public class BattMap_informationImpl implements BaseDAO,CallBack{
|
| | |
| | | binformation.getAddress(),binformation.getLongitude(),binformation.getLatitude()});
|
| | | return bl;
|
| | | }
|
| | |
|
| | | //9.1录入机房信息(手机端)
|
| | | public boolean replace(Object obj) {
|
| | | BattMap_information binformation=(BattMap_information) obj;
|
| | | String sql="replace into web_site.tb_battmap_information(StationId,StationName,address,longitude,latitude) values(?,?,?,?,?)";
|
| | | Boolean bl=DAOHelper.executeUpdate(DBUtil.getConn(), sql, new Object[]{binformation.getStationId(),binformation.getStationName(),
|
| | | binformation.getAddress(),binformation.getLongitude(),binformation.getLatitude()});
|
| | | return bl;
|
| | | }
|
| | | public boolean update(Object obj) {
|
| | | BattMap_information binformation=(BattMap_information) obj;
|
| | | String sql="update web_site.tb_battmap_information set StationId=?,StationName=?,address=?,longitude=?,latitude=?,information=? where num=?";
|
| | |
| | | });
|
| | | return list;
|
| | | }
|
| | | //9.1查询已经添加物理信息的机房(用户管理的)
|
| | | //9.1查询已经添加物理信息的机房(用户管理的,l查询全部打开页面)
|
| | | public List serchInBattMapByUid(Object obj) {
|
| | | User_inf uinf=(User_inf) obj;
|
| | | String sql="select distinct tb_battmap_information.num,tb_battmap_information.StationId,tb_battmap_information.StationName,address,longitude,latitude,information,db_battinf.tb_battinf.FBSDeviceId " +
|
| | | String sql="select distinct tb_battmap_information.num,tb_battmap_information.StationId,tb_battmap_information.StationName,address,longitude,latitude,information,db_battinf.tb_battinf.FBSDeviceId,db_battinf.tb_battinf.monvolstd " +
|
| | | " from web_site.tb_battmap_information,db_battinf.tb_battinf " +
|
| | | " where tb_battmap_information.StationId=db_battinf.tb_battinf.StationId " +
|
| | | " and tb_battmap_information.StationId in (" +
|
| | |
| | | " left outer join db_user.tb_user_battgroup_baojigroup_battgroup on db_user.tb_user_battgroup_baojigroup_battgroup.stationid=db_battinf.tb_battinf.stationid " +
|
| | | " left outer join db_user.tb_user_battgroup_baojigroup_usr on db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id=db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id " +
|
| | | " left outer join db_user.tb_user_inf on tb_user_inf.uid=db_user.tb_user_battgroup_baojigroup_usr.uid " +
|
| | | " where db_user.tb_user_inf.uid=? )";
|
| | | " where db_user.tb_user_inf.uid=? ) ";
|
| | | List list=DAOHelper.executeQuery(sql, DBUtil.getConn(),new Object[]{uinf.getUId()}, new CallBack() {
|
| | |
|
| | | public List getResults(ResultSet rs) {
|
| | |
| | | binformation.setLatitude(rs.getDouble("latitude"));
|
| | | binformation.setInformation(rs.getString("information"));
|
| | | binformation.setFBSDeviceId(rs.getInt("fBSDeviceId"));
|
| | | binformation.setMonvolstd(rs.getFloat("monvolstd")); //表明设备是2V还是12V
|
| | | list.add(binformation);
|
| | | }
|
| | | } catch (SQLException e) {
|
| | | // TODO Auto-generated catch block
|
| | | e.printStackTrace();
|
| | | }
|
| | | return list;
|
| | | }
|
| | | } );
|
| | | return list;
|
| | | }
|
| | | //9.1查询已经添加物理信息的机房(用户管理的,分页刷新)
|
| | | public List serchInBattMapByUid2(Object obj) {
|
| | | Page page=(Page) obj;
|
| | | int uid=page.getPageAll();
|
| | | Connection conn=DBUtil.getConn();
|
| | | String numberSql="SELECT FOUND_ROWS() number";//存放总数
|
| | | String sql="select SQL_CALC_FOUND_ROWS distinct tb_battmap_information.num,tb_battmap_information.StationId,tb_battmap_information.StationName,address,longitude,latitude,information,db_battinf.tb_battinf.FBSDeviceId,db_battinf.tb_battinf.station_install,db_battinf.tb_battinf.monvolstd " +
|
| | | " from web_site.tb_battmap_information,db_battinf.tb_battinf " +
|
| | | " where tb_battmap_information.StationId=db_battinf.tb_battinf.StationId " +
|
| | | " and tb_battmap_information.StationId in (" +
|
| | | " select distinct db_battinf.tb_battinf.stationid " +
|
| | | " from db_battinf.tb_battinf " +
|
| | | " left outer join db_user.tb_user_battgroup_baojigroup_battgroup on db_user.tb_user_battgroup_baojigroup_battgroup.stationid=db_battinf.tb_battinf.stationid " +
|
| | | " left outer join db_user.tb_user_battgroup_baojigroup_usr on db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id=db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id " +
|
| | | " left outer join db_user.tb_user_inf on tb_user_inf.uid=db_user.tb_user_battgroup_baojigroup_usr.uid " +
|
| | | " where db_user.tb_user_inf.uid=? and tb_battinf.station_install=true) " +
|
| | | " order by tb_battmap_information.StationId "+
|
| | | " limit ?,? " ;
|
| | | List<BattMap_information> list=DAOHelper.executeQueryLimit(sql, conn,new Object[]{uid,(page.getPageCurr()-1)*page.getPageSize(),page.getPageSize()}, new CallBack() {
|
| | | |
| | | public List getResults(ResultSet rs) {
|
| | | List list=new ArrayList();
|
| | | try {
|
| | | while(rs.next()){
|
| | | BattMap_information binformation=new BattMap_information();
|
| | | binformation.setNum(rs.getInt("num"));
|
| | | binformation.setStationId(rs.getString("stationId"));
|
| | | binformation.setStationName(rs.getString("stationName"));
|
| | | binformation.setAddress(rs.getString("address"));
|
| | | binformation.setLongitude(rs.getDouble("longitude"));
|
| | | binformation.setLatitude(rs.getDouble("latitude"));
|
| | | binformation.setInformation(rs.getString("information"));
|
| | | binformation.setFBSDeviceId(rs.getInt("fBSDeviceId"));
|
| | | binformation.setInformation(rs.getString("station_install"));
|
| | | binformation.setMonvolstd(rs.getFloat("monvolstd")); //表明设备是2V还是12V
|
| | | Page p=new Page();
|
| | | binformation.setPage(p);
|
| | | list.add(binformation);
|
| | | }
|
| | | } catch (SQLException e) {
|
| | | // TODO Auto-generated catch block
|
| | | e.printStackTrace();
|
| | | }
|
| | | return list;
|
| | | }
|
| | | } );
|
| | | //去掉limit条件后的总数
|
| | | int number=LimitNumberFactory.GetLimtitNumber(conn, numberSql);
|
| | | //System.out.println("number: "+number);
|
| | | if(list!=null&&list.size()>0){
|
| | | list.get(list.size()-1).getPage().setPageAll(number);
|
| | | }
|
| | | return list;
|
| | | }
|
| | | //9.1查询已经添加物理信息的机房(用户管理的,3.根据具体id查询告警信息等)
|
| | | public List serchInBattMapByUid3(Object obj) {
|
| | | BattMap_information binfor=(BattMap_information) obj;
|
| | | String sql="select distinct tb_battmap_information.num,tb_battmap_information.StationId,tb_battmap_information.StationName,address,longitude,latitude,information,db_battinf.tb_battinf.FBSDeviceId,tb_battinf.stationName1,tb_battinf.stationName2,tb_battinf.stationName3,tb_battinf.stationName5 " +
|
| | | " from web_site.tb_battmap_information,db_battinf.tb_battinf " +
|
| | | " where tb_battmap_information.StationId=db_battinf.tb_battinf.StationId " +
|
| | | " and tb_battmap_information.StationId in (" +
|
| | | " select distinct db_battinf.tb_battinf.stationid " +
|
| | | " from db_battinf.tb_battinf " +
|
| | | " left outer join db_user.tb_user_battgroup_baojigroup_battgroup on db_user.tb_user_battgroup_baojigroup_battgroup.stationid=db_battinf.tb_battinf.stationid " +
|
| | | " left outer join db_user.tb_user_battgroup_baojigroup_usr on db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id=db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id " +
|
| | | " left outer join db_user.tb_user_inf on tb_user_inf.uid=db_user.tb_user_battgroup_baojigroup_usr.uid " +
|
| | | " where db_user.tb_user_inf.uid=? ) " +
|
| | | " and tb_battmap_information.StationId=? ";
|
| | | List list=DAOHelper.executeQuery(sql, DBUtil.getConn(),new Object[]{binfor.getNum(),binfor.getStationId()}, new CallBack() {
|
| | | |
| | | public List getResults(ResultSet rs) {
|
| | | List list=new ArrayList();
|
| | | try {
|
| | | while(rs.next()){
|
| | | BattMap_information binformation=new BattMap_information();
|
| | | binformation.setNum(rs.getInt("num"));
|
| | | binformation.setStationId(rs.getString("stationId"));
|
| | | binformation.setStationName(rs.getString("stationName"));
|
| | | binformation.setStationName1(rs.getString("stationName1"));
|
| | | binformation.setStationName2(rs.getString("stationName2"));
|
| | | binformation.setStationName3(rs.getString("stationName3"));
|
| | | binformation.setStationName5(rs.getString("stationName5"));
|
| | | binformation.setAddress(rs.getString("address"));
|
| | | binformation.setLongitude(rs.getDouble("longitude"));
|
| | | binformation.setLatitude(rs.getDouble("latitude"));
|
| | | binformation.setInformation(rs.getString("information"));
|
| | | binformation.setFBSDeviceId(rs.getInt("fBSDeviceId"));
|
| | | list.add(binformation);
|
| | | }
|
| | | } catch (SQLException e) {
|