| | |
| | | import com.fgkj.db.DBUtil;
|
| | | import com.fgkj.dto.Batt_endurance;
|
| | | import com.fgkj.dto.Page;
|
| | | import com.fgkj.dto.User_inf;
|
| | | import com.mysql.fabric.xmlrpc.base.Array;
|
| | |
|
| | | public class Batt_enduranceImpl implements BaseDAO,CallBack{
|
| | |
| | | " 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=? and db_battinf.tb_battinf.station_install=1 ) " ;
|
| | | //机房筛选
|
| | | String stationSql=" and db_battinf.tb_battinf.StationName like ? and db_battinf.tb_battinf.StationName1 like ? and db_battinf.tb_battinf.StationName2 like ? and db_battinf.tb_battinf.StationName5 like ?";
|
| | | sql+=stationSql;
|
| | |
| | | }
|
| | | return list;
|
| | | }
|
| | | //续航不足1小时,2小时等的饼状图
|
| | | public List serchByState_xuhang(Object obj) {
|
| | | User_inf uinf=(User_inf) obj;
|
| | | String sql="select distinct tb_batt_endurance.deviceid,tb_batt_endurance.stationid,endurance_theory_timelong,endurance_actual_timelong " +
|
| | | " from web_site.tb_batt_endurance " +
|
| | | " where tb_batt_endurance.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 db_battinf.tb_battinf.station_install=1) " ;
|
| | | //System.out.println(sql);
|
| | | List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{uinf.getUId()}, new CallBack() {
|
| | |
|
| | | public List getResults(ResultSet rs) {
|
| | | List list=new ArrayList();
|
| | | int num_hour=0;//续航一小时内的
|
| | | int num_two=0;//续航一小时到两个小时的
|
| | | int num_three=0;//续航两小时到三小时内的
|
| | | int num_other=0;//续航三小时以上
|
| | | try {
|
| | | while(rs.next()){
|
| | | int actual_timelong=rs.getInt("endurance_actual_timelong");
|
| | | if(actual_timelong<=60){
|
| | | num_hour+=1;
|
| | | }else if(actual_timelong<=120){
|
| | | num_two+=1;
|
| | | }else if(actual_timelong<=180){
|
| | | num_three+=1;
|
| | | }else{
|
| | | num_other+=1;
|
| | | }
|
| | | }
|
| | | list.add(num_hour);
|
| | | list.add(num_two);
|
| | | list.add(num_three);
|
| | | list.add(num_other);
|
| | | } catch (SQLException e) {
|
| | | // TODO Auto-generated catch block
|
| | | e.printStackTrace();
|
| | | }
|
| | | return list;
|
| | | }
|
| | | });
|
| | | return list;
|
| | | }
|
| | | public List serchByInfo(Object obj) {
|
| | | // TODO Auto-generated method stub
|
| | | return null;
|
| | |
| | | page.setPageCurr(1);
|
| | | page.setPageSize(10);
|
| | | ben.setPage(page);
|
| | | List<Batt_endurance> list=bimpl.serchByCondition(ben);
|
| | | /*List<Batt_endurance> list=bimpl.serchByCondition(ben);
|
| | | for (Batt_endurance b : list) {
|
| | | System.out.println(b);
|
| | | }
|
| | | System.out.println(list.size());
|
| | | System.out.println(list.size());*/
|
| | | |
| | | User_inf uinf=new User_inf();
|
| | | uinf.setUId(1002);
|
| | | List<Integer> list=bimpl.serchByState_xuhang(uinf);
|
| | | for (int num : list) {
|
| | | System.out.println(num);
|
| | | }
|
| | | //System.out.println(list.size());
|
| | | }
|
| | |
|
| | |
|