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.BattInf; import com.fgkj.dto.Battinf_ex; public class Battinf_exImpl implements BaseDAO,CallBack{ public List getResults(ResultSet rs) { // TODO Auto-generated method stub return null; } public boolean add(Object obj) { // TODO Auto-generated method stub return false; } public boolean update(Object obj) { // TODO Auto-generated method stub return false; } public boolean del(Object obj) { // TODO Auto-generated method stub return false; } public List searchAll() { // TODO Auto-generated method stub return null; } //根据电池组的信息stationid查询 public List serchByCondition(Object obj) { BattInf binf=(BattInf) obj; String sql=" select * from db_battinf.tb_battinf_ex where stationId=? "; List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{binf.getStationId()}, new CallBack() { public List getResults(ResultSet rs) { List list=new ArrayList(); try { while(rs.next()){ Battinf_ex binf_ex=new Battinf_ex(); binf_ex.setNum(rs.getInt("num")); binf_ex.setStationId(rs.getString("stationId")); binf_ex.setFBSDeviceId(rs.getInt("fBSDeviceId")); binf_ex.setStationName(rs.getString("stationName")); binf_ex.setStationCode(rs.getString("stationCode")); binf_ex.setStationRegion(rs.getString("stationRegion")); binf_ex.setKeyWords(rs.getString("keyWords")); binf_ex.setAffiliation(rs.getString("affiliation")); binf_ex.setDataSources(rs.getString("dataSources")); binf_ex.setStationType(rs.getString("stationType")); binf_ex.setLongitude(rs.getDouble("longitude")); binf_ex.setLatitude(rs.getInt("latitude")); binf_ex.setStationAddr(rs.getString("stationAddr")); binf_ex.setStationLevel(rs.getString("stationLevel")); binf_ex.setMaintenanceState(rs.getString("maintenanceState")); binf_ex.setBlockedState(rs.getString("blockedState")); binf_ex.setMaintenanceCompany(rs.getString("maintenanceCompany")); binf_ex.setBusinessScenario(rs.getString("businessScenario")); binf_ex.setCoverScenario(rs.getString("coverScenario")); binf_ex.setSiteTerrain(rs.getString("siteTerrain")); binf_ex.setPropertyRights(rs.getString("propertyRights")); binf_ex.setPropertyUnit(rs.getString("propertyUnit")); binf_ex.setIsShare(rs.getString("isShare")); binf_ex.setUseUnit(rs.getString("useUnit")); binf_ex.setSiteCode(rs.getString("siteCode")); binf_ex.setHistorySiteCode(rs.getString("historySiteCode")); binf_ex.setSiteInternalNumber(rs.getString("siteInternalNumber")); binf_ex.setSitePinyinReferred(rs.getString("sitePinyinReferred")); binf_ex.setSiteChineseReferred(rs.getString("siteChineseReferred")); binf_ex.setSiteMergeRecord(rs.getString("siteMergeRecord")); binf_ex.setIsOpenBusiness(rs.getString("isOpenBusiness")); binf_ex.setSchoolPersonnel(rs.getString("schoolPersonnel")); binf_ex.setEntryTime(rs.getString("entryTime")); binf_ex.setModifyPeople(rs.getString("modifyPeople")); binf_ex.setModifyTime(rs.getString("modifyTime")); binf_ex.setNote(rs.getString("note")); binf_ex.setSiteReceivesMark(rs.getString("siteReceivesMark")); binf_ex.setSiteValidity(rs.getString("siteValidity")); binf_ex.setSiteNameCMCC(rs.getString("siteNameCMCC")); binf_ex.setSiteNameCUCC(rs.getString("siteNameCUCC")); binf_ex.setSiteNameCTC(rs.getString("siteNameCTC")); binf_ex.setProducer(rs.getString("producer")); binf_ex.setLastTimeLong(rs.getDouble("lastTimeLong")); binf_ex.setLastTimeType(rs.getString("lastTimeType")); binf_ex.setLastTimeDate(rs.getTimestamp("lastTimeDate")); binf_ex.setShareInfo(rs.getString("shareInfo")); binf_ex.setElectPowerCMCC(rs.getInt("electPowerCMCC")); binf_ex.setElectPowerCUCC(rs.getInt("electPowerCUCC")); binf_ex.setElectPowerCTC(rs.getInt("electPowerCTC")); binf_ex.setIsCanElectPower(rs.getInt("isCanElectPower")); binf_ex.setUpperStationRoute(rs.getDouble("upperStationRoute")); binf_ex.setUpperStationDifficult(rs.getString("upperStationDifficult")); binf_ex.setClienteleErrorService(rs.getString("clienteleErrorService")); list.add(binf_ex); } } 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; } public static void main(String[] args) { Battinf_exImpl bimpl=new Battinf_exImpl(); BattInf binf=new BattInf(); binf.setStationId("42000001"); List list=bimpl.serchByCondition(binf); System.out.println(list.size()); } }