| | |
| | | //用户手动添加问题
|
| | | public boolean add(Object obj) {
|
| | | Deverror_record dev_record=(Deverror_record) obj;
|
| | | String sql=" insert into db_battinf.tb_deverror_record(stationId,record_time,error_descript,uid,picture_num ";
|
| | | String endsql=") values(?,?,?,?,?";
|
| | | String sql=" insert into db_battinf.tb_deverror_record(stationId,record_time,error_descript,error_dispose,uid,uname,picture_num,error_state ";
|
| | | String endsql=") values(?,?,?,?,?,?,?,?";
|
| | | List list=new ArrayList();
|
| | | list.add(dev_record.getStationId());
|
| | | list.add(dev_record.getRecord_time());
|
| | | list.add(dev_record.getError_descript());
|
| | | list.add(dev_record.getError_dispose());
|
| | | list.add(dev_record.getUid());
|
| | | list.add(dev_record.getUname());
|
| | | list.add(dev_record.getPicture_num());
|
| | | list.add(dev_record.getError_state());
|
| | | if(dev_record.getPicture_num()>=1){
|
| | | sql+=",picture_one";
|
| | | endsql+=",? ";
|
| | |
| | | boolean bl=DAOHelper.executeUpdatePicture(DBUtil.getConn(), sql, list);
|
| | | return bl;
|
| | | }
|
| | |
|
| | | //用户处理的结果
|
| | | public boolean update(Object obj) {
|
| | | // TODO Auto-generated method stub
|
| | | return false;
|
| | | Deverror_record dev_record=(Deverror_record) obj;
|
| | | List list=new ArrayList();
|
| | | //System.out.println(dev_record);
|
| | | String sql=" update db_battinf.tb_deverror_record set error_dispose=?,error_en=?,solve_uid=?,solve_uname=?,solve_picture_num=?,solve_record_time=? "; |
| | | String endSql=" where num=? ";
|
| | | list.add(dev_record.getError_dispose());
|
| | | list.add(dev_record.getError_en());
|
| | | list.add(dev_record.getSolve_uid());
|
| | | list.add(dev_record.getSolve_uname());
|
| | | list.add(dev_record.getSolve_picture_num());
|
| | | list.add(dev_record.getSolve_record_time());
|
| | | if (dev_record.getSolve_picture_num()>=1) {
|
| | | sql+=",solve_picture_one=? ";
|
| | | list.add(dev_record.getSolve_picture_one());
|
| | | }
|
| | | if (dev_record.getSolve_picture_num()>=2) {
|
| | | sql+=",solve_picture_two=? ";
|
| | | list.add(dev_record.getSolve_picture_two());
|
| | | }
|
| | | if (dev_record.getSolve_picture_num()>=3) {
|
| | | sql+=",solve_picture_three=? ";
|
| | | list.add(dev_record.getSolve_picture_three());
|
| | | }
|
| | | if (dev_record.getSolve_picture_num()>=4) {
|
| | | sql+=",solve_picture_four=? ";
|
| | | list.add(dev_record.getSolve_picture_four());
|
| | | }
|
| | | sql+=endSql;
|
| | | list.add(dev_record.getNum());
|
| | | boolean bl=DAOHelper.executeUpdatePicture(DBUtil.getConn(), sql,list);
|
| | | return bl;
|
| | | }
|
| | |
|
| | | public boolean del(Object obj) {
|
| | |
| | | Page p=binf.getPage();
|
| | | Connection conn=DBUtil.getConn();
|
| | | String numberSql=" SELECT FOUND_ROWS() number";
|
| | | String sql=" select SQL_CALC_FOUND_ROWS distinct tb_deverror_record.num,tb_deverror_record.stationid,record_time,error_descript,error_en,picture_num " +
|
| | | String sql=" select SQL_CALC_FOUND_ROWS distinct tb_deverror_record.num,tb_deverror_record.stationid,record_time,error_descript,error_en,error_dispose,picture_num,error_state,solve_uid,solve_picture_num,uid,uname,solve_uname,solve_record_time " +
|
| | | " ,db_battinf.tb_battinf.stationname,stationname1,stationname2,stationname3,stationname5 " +
|
| | | " from db_battinf.tb_deverror_record,db_battinf.tb_battinf " +
|
| | | " where tb_deverror_record.stationid=tb_battinf.stationid " +
|
| | | " and tb_deverror_record.stationid like ? and stationname1 like ? and stationname2 like ? and stationname5 like ? " +
|
| | | " and tb_deverror_record.uid=? and error_en=0 " ;
|
| | | " and tb_deverror_record.stationid like ? and stationname1 like ? and stationname2 like ? and stationname5 like ? " ;
|
| | | //问题类型
|
| | | String errSqlT=" and error_state!=?";
|
| | | String errSqlF=" and error_state=?";
|
| | | if(binf.getMonCount()==-1) {
|
| | | sql+=errSqlT;
|
| | | }else {
|
| | | sql+=errSqlF;
|
| | | }
|
| | | //用户管理
|
| | | String userSql=" and db_battinf.tb_battinf.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=? "+
|
| | |
| | | sql+=orderSql;
|
| | | String limitSql=" limit ?,? ";
|
| | | sql+=limitSql;
|
| | | List<Deverror_record> list=DAOHelper.executeQueryLimit(sql, conn, new Object[]{"%"+binf.getStationId()+"%","%"+binf.getStationName1()+"%","%"+binf.getStationName2()+"%","%"+binf.getStationName5()+"%",binf.getNum()
|
| | | ,binf.getNum(),(p.getPageCurr()-1)*p.getPageSize(),p.getPageSize()}, new CallBack() {
|
| | | List<Deverror_record> list=DAOHelper.executeQueryLimit(sql, conn, new Object[]{"%"+binf.getStationId()+"%","%"+binf.getStationName1()+"%","%"+binf.getStationName2()+"%","%"+binf.getStationName5()+"%"
|
| | | ,binf.getMonCount(),binf.getNum(),(p.getPageCurr()-1)*p.getPageSize(),p.getPageSize()}, new CallBack() {
|
| | |
|
| | | public List getResults(ResultSet rs) {
|
| | | List list=new ArrayList();
|
| | |
| | | dev_record.setRecord_time(rs.getTimestamp("record_time"));
|
| | | dev_record.setError_descript(rs.getString("error_descript"));
|
| | | dev_record.setError_en(rs.getInt("error_en"));
|
| | | dev_record.setError_dispose(rs.getString("error_dispose"));
|
| | | dev_record.setPicture_num(rs.getInt("picture_num"));
|
| | | dev_record.setError_state(rs.getInt("error_state"));
|
| | | dev_record.setUid(rs.getInt("uid"));
|
| | | dev_record.setUname(rs.getString("uname"));
|
| | | dev_record.setSolve_uid(rs.getInt("solve_uid"));
|
| | | dev_record.setSolve_uname(rs.getString("solve_uname"));
|
| | | dev_record.setSolve_picture_num(rs.getInt("solve_picture_num"));
|
| | | dev_record.setSolve_record_time(rs.getTimestamp("solve_record_time"));
|
| | | Page page=new Page();
|
| | | dev_record.setPage(page);
|
| | | list.add(dev_record);
|
| | |
| | | //去掉limit条件后的总数
|
| | | int number=LimitNumberFactory.GetLimtitNumber(conn, numberSql);
|
| | | if(list!=null&&list.size()>0){
|
| | | list.get(list.size()-1).getPage().setPageSize(number);
|
| | | list.get(list.size()-1).getPage().setPageAll(number);
|
| | | }
|
| | | return list;
|
| | | }
|
| | |
| | | binf.setStationName3("");
|
| | | binf.setStationName5("");
|
| | | binf.setStationId("");
|
| | | binf.setMonCount(-1);
|
| | | Page p=new Page();
|
| | | p.setPageCurr(1);
|
| | | p.setPageSize(10);
|
| | | binf.setPage(p);
|
| | | List list=dimpl.serchByCondition(binf);
|
| | | for (Object object : list) {
|
| | | System.out.println(object);
|
| | | }
|
| | | System.out.println(list.size());
|
| | | }
|
| | |
|