| | |
| | | return number;
|
| | | }
|
| | | //查询设备总数(全部)
|
| | | public int serchByDeviceId_all(Object obj){
|
| | | public List serchByDeviceId_all(Object obj){
|
| | | User_inf uinf=(User_inf) obj;
|
| | | String sql=" SELECT COUNT(DISTINCT fbsdeviceid) number FROM db_battinf.tb_battinf " +
|
| | | " left outer join db_user.tb_user_battgroup_baojigroup_battgroup on db_user.tb_user_battgroup_baojigroup_battgroup.BattGroupId=db_battinf.tb_battinf.BattGroupId " +
|
| | | " 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=? " +
|
| | | " limit 1 ";
|
| | | List<BattInf> list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{uinf.getUId()}, new CallBack() {
|
| | | String sql=" SELECT DISTINCT fbsdeviceid,station_install,monvolstd 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() {
|
| | |
|
| | | public List getResults(ResultSet rs) {
|
| | | List list=new ArrayList();
|
| | | int num_2_install=0;//2v已安装
|
| | | int num_2=0;//2v全部
|
| | | int num_12_install=0;//12v已安装
|
| | | int num_12=0;//12v全部
|
| | | int num_install=0;//已安装
|
| | | int num=0;//全部
|
| | | try {
|
| | | while(rs.next()){
|
| | | BattInf binf=new BattInf();
|
| | | binf.setNum(rs.getInt("number"));
|
| | | list.add(binf);
|
| | | int insatll=rs.getInt("station_install");
|
| | | float monvolstd=rs.getFloat("monvolstd");
|
| | | if(insatll==1){
|
| | | num_install+=1;
|
| | | if(monvolstd==2.0){
|
| | | num_2_install+=1;
|
| | | }else{
|
| | | num_12_install+=1;
|
| | | }
|
| | | }
|
| | | if(monvolstd==2.0){
|
| | | num_2+=1;
|
| | | }else{
|
| | | num_12+=1;
|
| | | }
|
| | | num+=1;
|
| | | }
|
| | | } catch (SQLException e) {
|
| | | // TODO Auto-generated catch block
|
| | | e.printStackTrace();
|
| | | }
|
| | | list.add(num_2_install);
|
| | | list.add(num_2);
|
| | | list.add(num_12_install);
|
| | | list.add(num_12);
|
| | | list.add(num_install);
|
| | | list.add(num);
|
| | | return list;
|
| | | }
|
| | |
|
| | | });
|
| | | int number=0;//存放总数
|
| | | if(list!=null&&list.size()>0){
|
| | | number=list.get(list.size()-1).getNum();
|
| | | }
|
| | | return number;
|
| | | return list;
|
| | | }
|
| | | //-----------根据蓄电池组查不重复的MonCount(monNum)(单体编号)
|
| | | public List serchByMonNum(Object obj){
|