package com.fgkj.dao.impl; import java.sql.ResultSet; import java.sql.SQLException; import java.text.ParseException; import java.text.SimpleDateFormat; import java.util.ArrayList; import java.util.Date; import java.util.List; import com.fgkj.actions.ActionUtil; import com.fgkj.dao.BaseDAO; import com.fgkj.dao.CallBack; import com.fgkj.dao.DAOHelper; import com.fgkj.db.DBUtil; import com.fgkj.db.IDatabaseName; import com.fgkj.dto.BattInf; import com.fgkj.dto.Batt_Maint_Dealarm; import com.fgkj.dto.Batt_maint_inf; import com.fgkj.dto.Batt_maint_process; import com.fgkj.dto.Batt_maintenance_inf; import com.fgkj.dto.Batttestdata_inf; import com.fgkj.dto.Page; import com.fgkj.dto.User_inf; public class Batt_maint_infImpl implements BaseDAO,CallBack{ public Batt_maint_infImpl() { DAOHelper.sdf=new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"); } public List getResults(ResultSet rs) { List list = new ArrayList(); int id=0; try { while (rs.next()) { Batt_Maint_Dealarm bmd = new Batt_Maint_Dealarm(); BattInf binf = new BattInf(); Page p=new Page(); binf.setBattGroupId(rs.getInt("battGroupId")); if(id==rs.getInt("battGroupId")){ continue; }else{ id=rs.getInt("battGroupId"); } binf.setStationName(rs.getString("stationName")); binf.setBattGroupName(rs.getString("battGroupName")); /*Batt_maintenance_inf minf=new Batt_maintenance_inf(); if (rs.getString("maintenance_time") != null) minf.setMaintenance_time(DAOHelper.sdf.parse(rs .getString("maintenance_time"))); */ Batt_maint_inf mainf=new Batt_maint_inf(); mainf.setNum(rs.getInt("num")); mainf.setUsr_id(rs.getInt("usr_id")); mainf.setFault_type_id(rs.getInt("fault_type_id")); mainf.setFault_level(rs.getInt("fault_level")); mainf.setFault_caption(rs.getString("fault_caption")); if(rs.getString("record_time")!=null) mainf.setRecord_time(DAOHelper.sdf.parse(rs.getString("record_time"))); if(rs.getString("maint_time_limit")!=null) mainf.setMaint_time_limit(DAOHelper.sdf.parse(rs.getString("maint_time_limit"))); mainf.setMaint_type_id(rs.getInt("maint_type_id")); mainf.setMaint_result(rs.getString("maint_result")); mainf.setMaint_done(rs.getInt("maint_done")); if(rs.getString("maint_done_time")!=null) mainf.setMaint_done_time(DAOHelper.sdf.parse(rs.getString("maint_done_time"))); mainf.setMaint_close(rs.getInt("maint_close")); mainf.setMaster_id(rs.getInt("master_id")); mainf.setMaster_audit(rs.getInt("master_audit")); mainf.setCopy_uids(rs.getString("copy_uids"));//数据库存储时用的字符串 mainf.setAppoint_uid(rs.getInt("appoint_uid")); bmd.setBinf(binf); // bmd.setMinf(minf); bmd.setPage(p); bmd.setMainf(mainf); list.add(bmd); } } catch (SQLException e) { e.printStackTrace(); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } return list; } public boolean add(Object obj) { Batt_maint_inf binf=(Batt_maint_inf) obj; String sql="insert into db_battinf.tb_batt_maint_inf(BattGroupId,usr_id,fault_type_id,fault_type,fault_level,fault_cation," + "fault_time,record_uid,record_time,maint_time_limit,maint_type_id,maint_type,maint_result," + "maint_done,maint_done_time,maint_close,master_id,master_audit,copy_uids,appoint_check,remark) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"; Boolean bl=DAOHelper.executeUpdate(DBUtil.getConn(), sql, new Object[]{binf.getBattGroupId(),binf.getUsr_id(),binf.getFault_type_id(), binf.getFault_type(),binf.getFault_level(),binf.getFault_caption(),binf.getFault_time(),binf.getRecord_uid(),binf.getRecord_time(),binf.getMaint_time_limit(), binf.getMaint_type_id(),binf.getMaint_type(),binf.getMaint_result(),binf.getMaint_done(),binf.getMaint_done_time(),binf.getMaint_close(),binf.getMaster_id(), binf.getMaster_audit(),binf.getCopy_uids(),binf.getAppoint_uid(),binf.getMaster_check(),binf.getRemark()}); return bl; } //2.1 电池维护记录查询(编辑记录)<故障类型和排除方法对应问题?> public boolean update(Object obj) { Batt_maint_inf mainf = (Batt_maint_inf) obj; String sql = "update db_battinf.tb_batt_maint_inf set usr_id=?,fault_type_id=?,fault_level=?,fault_caption=?," + "record_time=?,maint_time_limit=?,maint_type_id=?," + "maint_done=?,maint_done_time=?,maint_result=?,maint_close=?,master_audit=?,copy_uids=?,appoint_uid=? where num=?"; Boolean bl = DAOHelper.executeUpdate( DBUtil.getConn(), sql, new Object[] { mainf.getUsr_id(), mainf.getFault_type_id(), mainf.getFault_level(), mainf.getFault_caption(), mainf.getFault_time(), mainf.getMaint_time_limit(), mainf.getMaint_type_id(), mainf.getMaint_done(), mainf.getMaint_done_time(), mainf.getMaint_result(), mainf.getMaint_close(), mainf.getMaster_audit(), mainf.getCopy_uids(), mainf.getAppoint_uid(), mainf.getNum() }); return bl; } //2.1 电池维护记录查询(删除记录) public boolean del(Object obj) { Batt_maint_inf mainf = (Batt_maint_inf) obj; String sql = "delete from db_battinf.tb_batt_maint_inf where num=?"; Boolean bl = DAOHelper.executeUpdate( DBUtil.getConn(), sql, new Object[] { mainf.getNum()}); return bl; } // 3.1 根据battgroupid查维护数据信息 public List serchByCondition(Object obj) { Batt_Maint_Dealarm bmd = (Batt_Maint_Dealarm) obj; List list = null; BattInf binf = bmd.getBinf(); Batt_maint_inf mainf = bmd.getMainf(); Batttestdata_inf tdata = bmd.getTdata(); User_inf uinf=bmd.getUinf(); String sql=""; String baseSql="select distinct(db_battinf.tb_batt_maint_inf.battgroupid),StationName,BattGroupName " + ",db_battinf.tb_batt_maint_inf.num,usr_id,fault_type_id,fault_level,fault_caption,db_battinf.tb_batt_maint_inf.record_time,maint_time_limit,maint_type_id" + ",maint_result,maint_done,maint_done_time,maint_close,master_id,master_audit" + ",copy_uids,appoint_uid " + "from db_battinf.tb_batt_maint_inf " + "left outer join db_battinf.tb_battinf on db_battinf.tb_battinf.BattgroupId=db_battinf.tb_batt_maint_inf.BattGroupId " + "left outer join db_batt_testdata.tb_batttestdata_inf on db_battinf.tb_batt_maint_inf.BattGroupId=db_batt_testdata.tb_batttestdata_inf.BattGroupId " + "left outer join db_user.tb_user_battgroup_baojigroup_battgroup on db_user.tb_user_battgroup_baojigroup_battgroup.battgroupid=db_battinf.tb_batt_maint_inf.BattGroupId " + "left outer join db_user.tb_user_battgroup_baojigroup_usr on db_user.tb_user_battgroup_baojigroup_battgroup.baoji_group_id= db_user.tb_user_battgroup_baojigroup_usr.baoji_group_id " + "left outer join db_user.tb_user_inf on db_user.tb_user_inf.uId=db_user.tb_user_battgroup_baojigroup_usr.uid " + "where to_days(battproductdate)>=to_days(?) and to_days(battproductdate)<=to_days(?) and to_days(battinusedate)>=to_days(?) and to_days(battinusedate)<=to_days(?)"; //用于维护区 String station1SqlT=" and stationname1!=? ";//全部 String station1SqlF=" and stationname1=? "; if(binf.getStationName1().equals("")){ baseSql+=station1SqlT; }else{ baseSql+=station1SqlF; } //用于机房站点 String stationSqlT=" and stationname!=? ";//全部 String stationSqlF=" and stationname=? "; if(binf.getStationName().equals("")){ baseSql+=stationSqlT; }else{ baseSql+=stationSqlF; } //用于电池类型 String producerSqlT=" and battproducer!=? ";//全部 String producerSqlF=" and battproducer=? "; if(binf.getBattProducer().equals("")){ baseSql+=producerSqlT; }else{ baseSql+=producerSqlF; } //用于电池测试记录条件: //放电/充电单个/有在线监测记录 String testSqlH="and db_battinf.tb_batt_maint_inf.BattGroupId in(select distinct(db_batt_testdata.tb_batttestdata_inf.BattGroupId ) from db_batt_testdata.tb_batttestdata_inf where db_batt_testdata.tb_batttestdata_inf.test_type=? and to_days(record_time)>=to_days(?) and to_days(record_time)<=to_days(?)) "; //内阻/电导 String testSqlF="and db_battinf.tb_batt_maint_inf.BattGroupId in(select distinct(db_batt_testdata.tb_battresdata_inf.BattGroupId ) from db_batt_testdata.tb_battresdata_inf where db_batt_testdata.tb_battresdata_inf.test_type=? and to_days(record_time)>=to_days(?) and to_days(record_time)<=to_days(?)) "; //充电或者放电都行 String testSqlT="and db_battinf.tb_batt_maint_inf.BattGroupId in(select distinct(db_batt_testdata.tb_batttestdata_inf.BattGroupId ) from db_batt_testdata.tb_batttestdata_inf where db_batt_testdata.tb_batttestdata_inf.test_type in(?,2,3) and to_days(record_time)>=to_days(?) and to_days(record_time)<=to_days(?)) "; //无记录 String testSqlN="and db_battinf.tb_batt_maint_inf.BattGroupId not in(select distinct(db_batt_testdata.tb_batttestdata_inf.BattGroupId ) from db_batt_testdata.tb_batttestdata_inf where db_batt_testdata.tb_batttestdata_inf.test_type in(?,2,3) and to_days(record_time)>=to_days(?) and to_days(record_time)<=to_days(?)) " ; //全部 String testSqlA="and db_battinf.tb_batt_maint_inf.BattGroupId!=(select count(distinct(db_batt_testdata.tb_batttestdata_inf.BattGroupId )) from db_batt_testdata.tb_batttestdata_inf where db_batt_testdata.tb_batttestdata_inf.test_type in(?,2,3) and to_days(record_time)>=to_days(?) and to_days(record_time)<=to_days(?)) " ; if(tdata.getTest_type()==2){ baseSql+=testSqlH; }else if(tdata.getTest_type()==3){ baseSql+=testSqlH; }else if(tdata.getTest_type()==9){//有在线监测记录 baseSql+=testSqlH; }else if(tdata.getTest_type()==5){ baseSql+=testSqlF; }else if(tdata.getTest_type()==3000){//充电或放电 baseSql+=testSqlT; }else if(tdata.getTest_type()==4000){//无记录 baseSql+=testSqlN; }else if(tdata.getTest_type()==0){ baseSql+=testSqlA; } //选取蓄电池组条件 String idSqlT=" and db_battinf.tb_battinf.battgroupid!=? "; String idSqlF=" and db_battinf.tb_battinf.battgroupid=? "; if(binf.getBattGroupId()==0){ baseSql+=idSqlT; }else{ baseSql+=idSqlF; } //选取系统类型 String nameSqlT=" and BattGroupName1 like ? "; String nameSqlF=" and BattGroupName1 not like '%开关电源系统%' and BattGroupName1 not like '%UPS系统%' and BattGroupName1 not like ? "; if(binf.getBattGroupName1().equals("其他")){ baseSql+=nameSqlF; }else{ baseSql+=nameSqlT; } //用于单体电压 String volSqlT=" and monVolStd!=? ";//全部 String volSqlF=" and monVolStd=?" ; if(binf.getMonVolStd()==0){ baseSql+=volSqlT; }else{ baseSql+=volSqlF; } //用于电池容量 String capSqlT=" and monCapStd!=? ";//全部 String capSqlF=" and monCapStd=?" ; if(binf.getMonCapStd()==0){ baseSql+=capSqlT; }else{ baseSql+=capSqlF; } //包机人 String userSqlF=" and db_user.tb_user_inf.uname=? and db_user.tb_user_inf.ubaojiusr=1 "; if(uinf.getUName().equals("0")){ baseSql=baseSql; }else{ baseSql+=userSqlF; } //用于测试类型 //全部 String start_typeA=" "; //拉闸放电 String start_typeF=" and test_starttype<5 and test_type not in(2,9) and test_starttype!=2 "; //核对性放电 String start_typeT=" and test_starttype>=5 or (test_type not in(2,9) and test_starttype=2) "; if(tdata.getTest_starttype()==0){ baseSql+=start_typeA; }else if(tdata.getTest_starttype()==1){ baseSql+=start_typeF; }else if(tdata.getTest_starttype()==2){ baseSql+=start_typeT; } //用于电池维护记录条件 //有维护记录 String maintSqlT=" and db_battinf.tb_battinf.BattGroupId in(select db_battinf.tb_batt_maint_inf.battgroupid from db_battinf.tb_batt_maint_inf where to_days(maint_done_time)>=to_days(?) and to_days(maint_done_time)<=to_days(?)) " ; //无维护记录 String maintSqlF=" and db_battinf.tb_battinf.BattGroupId not in(select db_battinf.tb_batt_maint_inf.battgroupid from db_battinf.tb_batt_maint_inf where to_days(maint_done_time)>=to_days(?) and to_days(maint_done_time)<=to_days(?)) " ; //全部 String maintSqlA=" and db_battinf.tb_battinf.BattGroupId!=(select count(distinct(db_battinf.tb_batt_maint_inf.battgroupid )) from db_battinf.tb_batt_maint_inf where to_days(maint_done_time)>=to_days(?) and to_days(maint_done_time)<=to_days(?)) " ; if(mainf.getRemark().equals("0")){ baseSql+=maintSqlF; }else if(mainf.getRemark().equals("1")){ baseSql+=maintSqlT; }else if(mainf.getRemark().equals("100")){ baseSql+=maintSqlA; } String endSql=" order by StationName1 asc,db_battinf.tb_battinf.BattgroupId asc,test_starttime asc "; sql=baseSql+endSql; //System.out.println(sql); if(uinf.getUName().equals("0")){ list = DAOHelper.executeQuery( sql, DBUtil.getConn(), new Object[] { binf.getBattProductDate(), binf.getBattProductDate1(), binf.getBattInUseDate(), binf.getBattInUseDate1(), binf.getStationName1(), binf.getStationName(), binf.getBattProducer(), tdata.getTest_type(), tdata.getRecord_time(), tdata.getRecord_time1(), binf.getBattGroupId(), "%"+binf.getBattGroupName1()+"%", binf.getMonVolStd(), binf.getMonCapStd(), mainf.getMaint_done_time(), mainf.getMaint_done_time1() }, new CallBack() { public List getResults(ResultSet rs) { List list = new ArrayList(); try { while (rs.next()) { Batt_Maint_Dealarm bmd = new Batt_Maint_Dealarm(); BattInf binf = new BattInf(); Page p=new Page(); binf.setBattGroupId(rs.getInt("battGroupId")); binf.setStationName(rs.getString("stationName")); binf.setBattGroupName(rs.getString("battGroupName")); Batt_maint_inf mainf=new Batt_maint_inf(); mainf.setNum(rs.getInt("num")); mainf.setUsr_id(rs.getInt("usr_id")); mainf.setFault_type_id(rs.getInt("fault_type_id")); mainf.setFault_level(rs.getInt("fault_level")); mainf.setFault_caption(rs.getString("fault_caption")); if(rs.getString("record_time")!=null) mainf.setRecord_time(DAOHelper.sdf.parse(rs.getString("record_time"))); if(rs.getString("maint_time_limit")!=null) mainf.setMaint_time_limit(DAOHelper.sdf.parse(rs.getString("maint_time_limit"))); mainf.setMaint_type_id(rs.getInt("maint_type_id")); mainf.setMaint_result(rs.getString("maint_result")); mainf.setMaint_done(rs.getInt("maint_done")); if(rs.getString("maint_done_time")!=null) mainf.setMaint_done_time(DAOHelper.sdf.parse(rs.getString("maint_done_time"))); mainf.setMaint_close(rs.getInt("maint_close")); mainf.setMaster_id(rs.getInt("master_id")); mainf.setMaster_audit(rs.getInt("master_audit")); mainf.setCopy_uids(rs.getString("copy_uids"));//数据库存储时用的字符串 mainf.setAppoint_uid(rs.getInt("appoint_uid")); bmd.setBinf(binf); // bmd.setMinf(minf); bmd.setPage(p); bmd.setMainf(mainf); list.add(bmd); } } catch (SQLException e) { e.printStackTrace(); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } return list; } }); }else{ list = DAOHelper.executeQuery( sql, DBUtil.getConn(), new Object[] { binf.getBattProductDate(), binf.getBattProductDate1(), binf.getBattInUseDate(), binf.getBattInUseDate1(), binf.getStationName1(), binf.getStationName(), binf.getBattProducer(), tdata.getTest_type(), tdata.getRecord_time(), tdata.getRecord_time1(), binf.getBattGroupId(), "%"+binf.getBattGroupName1()+"%", binf.getMonVolStd(), binf.getMonCapStd(), uinf.getUName(), mainf.getMaint_done_time(), mainf.getMaint_done_time1() }, new CallBack() { public List getResults(ResultSet rs) { List list = new ArrayList(); try { while (rs.next()) { Batt_Maint_Dealarm bmd = new Batt_Maint_Dealarm(); BattInf binf = new BattInf(); Page p=new Page(); binf.setBattGroupId(rs.getInt("battGroupId")); binf.setStationName(rs.getString("stationName")); binf.setBattGroupName(rs.getString("battGroupName")); Batt_maint_inf mainf=new Batt_maint_inf(); mainf.setNum(rs.getInt("num")); mainf.setUsr_id(rs.getInt("usr_id")); mainf.setFault_type_id(rs.getInt("fault_type_id")); mainf.setFault_level(rs.getInt("fault_level")); mainf.setFault_caption(rs.getString("fault_caption")); if(rs.getString("record_time")!=null) mainf.setRecord_time(DAOHelper.sdf.parse(rs.getString("record_time"))); if(rs.getString("maint_time_limit")!=null) mainf.setMaint_time_limit(DAOHelper.sdf.parse(rs.getString("maint_time_limit"))); mainf.setMaint_type_id(rs.getInt("maint_type_id")); mainf.setMaint_result(rs.getString("maint_result")); mainf.setMaint_done(rs.getInt("maint_done")); if(rs.getString("maint_done_time")!=null) mainf.setMaint_done_time(DAOHelper.sdf.parse(rs.getString("maint_done_time"))); mainf.setMaint_close(rs.getInt("maint_close")); mainf.setMaster_id(rs.getInt("master_id")); mainf.setMaster_audit(rs.getInt("master_audit")); mainf.setCopy_uids(rs.getString("copy_uids"));//数据库存储时用的字符串 mainf.setAppoint_uid(rs.getInt("appoint_uid")); bmd.setBinf(binf); // bmd.setMinf(minf); bmd.setPage(p); bmd.setMainf(mainf); list.add(bmd); } } catch (SQLException e) { e.printStackTrace(); } catch (ParseException e) { // TODO Auto-generated catch block e.printStackTrace(); } return list; } }); } List listd=new ArrayList(); /*for(int i=0;i0){ //System.out.println(rs.getString("record_time")); mainf.setRecord_time(rs.getTimestamp("record_time")); //mainf.setRecord_time(rs.getDate("record_time")); //System.out.println("-----"+rs.getString("maint_time_limit")+"-----"); } if (rs.getString("maint_time_limit") != null && rs.getString("maint_time_limit").length()>0){ mainf.setMaint_time_limit(rs.getTimestamp("maint_time_limit")); } //mainf.setMaint_time_limit(rs.getDate("maint_time_limit")); mainf.setMaint_type_id(rs.getInt("maint_type_id")); mainf.setMaint_result(rs.getString("maint_result")); //System.out.println("-----"+rs.getString("maint_done_time")+"-----"); if (rs.getString("maint_done_time") != null && rs.getString("maint_done_time").length()>0){ //System.out.println(rs.getString("maint_done_time")); mainf.setMaint_done_time(rs.getTimestamp("maint_done_time")); //System.out.println(mainf.getMaint_done_time()); } //mainf.setMaint_done_time(rs.getDate("maint_done_time")); mainf.setMaint_close(rs.getInt("maint_close")); mainf.setMaster_id(rs.getInt("master_id")); mainf.setMaster_audit(rs.getInt("master_audit")); mainf.setCopy_uids(rs.getString("copy_uids"));// 数据库存储时用的字符串 mainf.setAppoint_uid(rs.getInt("appoint_uid")); Batt_maint_process mprocess=new Batt_maint_process(); mprocess.setUname(rs.getString("uname")); mprocess.setBatt_maint_rec_id(rs.getInt("batt_maint_rec_id")); mprocess.setUsr_id(rs.getInt("usr_id")); mprocess.setWork_caption(rs.getString("work_caption")); if(rs.getString("work_caption_time")!=null && rs.getString("work_caption_time").length()>0){ mprocess.setWork_caption_time(rs.getTimestamp("work_caption_time")); //mprocess.setWork_caption_time(rs.getDate("work_caption_time")); } BattInf binf=new BattInf(); binf.setBattGroupName(rs.getString("battGroupName")); binf.setStationName(rs.getString("stationName")); Page page=new Page(); bmd.setBinf(binf); bmd.setMainf(mainf); bmd.setMprocess(mprocess); bmd.setPage(page); list.add(bmd); } } catch (SQLException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); } return list; } }); // List listd=new ArrayList(); /*for(int i=0;i0) mainf.setRecord_time(rs.getTimestamp(("record_time"))); if (rs.getString("maint_time_limit").length()>0) mainf.setMaint_time_limit(rs.getTimestamp("maint_time_limit")); mainf.setMaint_type_id(rs.getInt("maint_type_id")); mainf.setMaint_result(rs.getString("maint_result")); if (rs.getString("maint_done_time").length()>0) mainf.setMaint_done_time(rs.getTimestamp("maint_done_time")); mainf.setMaint_close(rs.getInt("maint_close")); mainf.setMaster_id(rs.getInt("master_id")); mainf.setMaster_audit(rs.getInt("master_audit")); mainf.setCopy_uids(rs.getString("copy_uids"));// 数据库存储时用的字符串 mainf.setAppoint_uid(rs.getInt("appoint_uid")); list.add(mainf); } } catch (SQLException e) { e.printStackTrace(); } return list; } }); return list; } //根据电池组id查询电池的维护记录 public List searchByBattgroupId(Object obj) { Batt_maint_inf bmi=(Batt_maint_inf)obj; String sql="select num,BattGroupId,usr_id,fault_type_id,fault_type,fault_level,fault_caption," + "fault_time,record_uid,record_time,maint_time_limit,maint_type_id,maint_type,maint_result," + "maint_done,maint_done_time,maint_close,master_id,master_audit,copy_uids,appoint_uid,master_check,remark " + "from db_battinf.tb_batt_maint_inf where BattGroupId=?"; return DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{bmi.getBattGroupId()}, new CallBack() { public List getResults(ResultSet rs) { List list=new ArrayList(); try { while (rs.next()) { Batt_maint_inf b=new Batt_maint_inf(); b.setNum(rs.getInt("num")); b.setBattGroupId(rs.getInt("BattGroupId")); b.setUsr_id(rs.getInt("usr_id")); b.setFault_type_id(rs.getInt("fault_type_id")); b.setFault_type(rs.getString("fault_type")); b.setFault_level(rs.getInt("fault_level")); b.setFault_caption(rs.getString("fault_caption")); b.setFault_time(rs.getTimestamp("fault_time")); b.setRecord_uid(rs.getInt("record_uid")); b.setRecord_time(rs.getTimestamp("record_time")); b.setMaint_time_limit(rs.getTimestamp("maint_time_limit")); b.setMaint_type_id(rs.getInt("maint_type_id")); b.setMaint_type(rs.getString("maint_type")); b.setMaint_result(rs.getString("maint_result")); b.setMaint_done(rs.getInt("maint_done")); b.setMaint_done_time(rs.getTimestamp("maint_done_time")); b.setMaint_close(rs.getInt("maint_close")); b.setMaster_id(rs.getInt("master_id")); b.setCopy_uids(rs.getString("copy_uids")); b.setAppoint_uid(rs.getInt("appoint_uid")); b.setMaster_check(rs.getString("master_check")); b.setRemark(rs.getString("remark")); list.add(b); } } catch (SQLException e) { e.printStackTrace(); } return list; } }); } public static void main(String[] args) throws ParseException { Batt_maint_infImpl bimpl=new Batt_maint_infImpl(); BattInfImpl biml =new BattInfImpl(); BattInf binf = new BattInf(); binf.setStationName(""); binf.setStationName1("一枢纽"); //binf.setBattGroupName(""); binf.setBattGroupId(0); binf.setBattGroupName1(""); binf.setBattProducer("光宇"); binf.setMonCapStd(0f); binf.setMonVolStd(0f); SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd"); Date date1 = sdf.parse("2000-01-01"); Date date2 = sdf.parse("2016-07-14"); binf.setBattProductDate(ActionUtil.getSimpDate(date1)); binf.setBattProductDate1(ActionUtil.getSimpDate(date2)); binf.setBattInUseDate(ActionUtil.getSimpDate(date1)); binf.setBattInUseDate1(ActionUtil.getSimpDate(date2)); Batt_maint_inf mainf = new Batt_maint_inf(); mainf.setRemark("100"); mainf.setMaint_done_time(ActionUtil.getSimpDate(date1)); mainf.setMaint_done_time1(ActionUtil.getSimpDate(date2)); Batttestdata_inf tdata = new Batttestdata_inf(); tdata.setTest_type(0); tdata.setTest_starttype(0); tdata.setRecord_time(ActionUtil.getSimpDate(date1)); tdata.setRecord_time1(ActionUtil.getSimpDate(date2)); User_inf uinf=new User_inf(); uinf.setUName("0"); Page p=new Page(); p.setPageCurr(1); p.setPageSize(1); Batt_Maint_Dealarm bmd = new Batt_Maint_Dealarm(); bmd.setBinf(binf); bmd.setMainf(mainf); bmd.setTdata(tdata); bmd.setPage(p); bmd.setUinf(uinf); //List list = bimpl.serchByCondition(bmd); // for (Batt_Maint_Dealarm b : list) { // System.out.println(b.getMainf()); // } } }