| | |
| | | package com.fgkj.dao.impl;
|
| | |
|
| | | import java.sql.ResultSet;
|
| | | import java.sql.SQLException;
|
| | | import java.util.ArrayList;
|
| | | import java.util.List;
|
| | |
|
| | | import com.fgkj.dao.BaseDAO;
|
| | | import com.fgkj.dao.CallBack;
|
| | | import com.fgkj.dao.DAOHelper;
|
| | | import com.fgkj.db.DBUtil;
|
| | | import com.fgkj.dto.Batt_endurance;
|
| | | import com.mysql.fabric.xmlrpc.base.Array;
|
| | |
|
| | | public class Batt_enduranceImpl implements BaseDAO,CallBack{
|
| | |
|
| | |
| | | }
|
| | | //续航时间的查询
|
| | | public List serchByCondition(Object obj) {
|
| | | |
| | | return null;
|
| | | Batt_endurance bendurance=(Batt_endurance) obj;
|
| | | String sql="select distinct num,deviceid,tb_batt_endurance.stationid,endurance_state,real_cap,tb_batt_endurance.moncapstd,real_curr,endurance_timelong " +
|
| | | ",db_battinf.tb_battinf.StationName " +
|
| | | " from web_site.tb_batt_endurance,db_battinf.tb_battinf " +
|
| | | " where tb_batt_endurance.stationid=db_battinf.tb_battinf.stationid " ;
|
| | | //机房筛选
|
| | | String stationSql=" and tb_batt_endurance.stationid like ?";
|
| | | sql+=stationSql;
|
| | | //续航状态
|
| | | String enduranceSqlT=" and endurance_state=? ";
|
| | | String enduranceSqlF=" and endurance_state!=? ";//全部
|
| | | if(bendurance.getEndurance_state()==0){
|
| | | sql+=enduranceSqlF;
|
| | | }else{
|
| | | sql+=enduranceSqlT;
|
| | | }
|
| | | //续航时间
|
| | | String timelongSqlT=" and endurance_timelong<=? ";//小于某一时间
|
| | | String timelongSqlF=" and endurance_timelong!=?";//全部
|
| | | if(bendurance.getEndurance_timelong()==0){
|
| | | sql+=timelongSqlF;
|
| | | }else{
|
| | | sql+=timelongSqlT;
|
| | | }
|
| | | //排序时间
|
| | | String orderSql=" order by endurance_timelong asc";
|
| | | List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{"%"+bendurance.getStationid()+"%",bendurance.getEndurance_state(),bendurance.getEndurance_timelong()}, new CallBack() {
|
| | | |
| | | public List getResults(ResultSet rs) {
|
| | | List list=new ArrayList();
|
| | | try {
|
| | | while(rs.next()){
|
| | | Batt_endurance b=new Batt_endurance();
|
| | | b.setNum(rs.getInt("num"));
|
| | | b.setDeviceId(rs.getInt("deviceId"));
|
| | | b.setStationid(rs.getString("stationid"));
|
| | | b.setEndurance_state(rs.getInt("endurance_state"));
|
| | | b.setReal_cap(rs.getFloat("real_cap"));
|
| | | b.setMoncapstd(rs.getFloat("moncapstd"));
|
| | | b.setReal_curr(rs.getFloat("real_curr"));
|
| | | b.setEndurance_timelong(rs.getInt("endurance_timelong"));
|
| | | b.setNote(rs.getString("stationname"));
|
| | | list.add(b);
|
| | | }
|
| | | } catch (SQLException e) {
|
| | | // TODO Auto-generated catch block
|
| | | e.printStackTrace();
|
| | | }
|
| | | return list;
|
| | | }
|
| | | });
|
| | | return list;
|
| | | }
|
| | |
|
| | | public List serchByInfo(Object obj) {
|