| | |
| | | package com.fgkj.dao.impl;
|
| | |
|
| | | import java.sql.Blob;
|
| | | import java.sql.Connection;
|
| | | import java.sql.ResultSet;
|
| | | import java.sql.SQLException;
|
| | |
| | | import com.fgkj.dto.BattInf;
|
| | | import com.fgkj.dto.Deverror_record;
|
| | | import com.fgkj.dto.Page;
|
| | | import com.fgkj.dto.User_Chart;
|
| | |
|
| | | public class Deverror_recordImpl implements BaseDAO,CallBack{
|
| | |
|
| | |
| | | //用户手动添加问题
|
| | | 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) values(?,?,?,?)";
|
| | | boolean bl=DAOHelper.executeUpdate(DBUtil.getConn(), sql, new Object[]{dev_record.getStationId(),dev_record.getRecord_time(),dev_record.getError_descript(),dev_record.getUid()});
|
| | | |
| | | 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.getUid());
|
| | | list.add(dev_record.getPicture_num());
|
| | | list.add(dev_record.getPicture_one());
|
| | | list.add(dev_record.getPicture_two());
|
| | | list.add(dev_record.getPicture_three());
|
| | | list.add(dev_record.getPicture_four());
|
| | | |
| | | |
| | | String sql=" insert into db_battinf.tb_deverror_record(stationId,record_time,error_descript,uid,picture_num,picture_one,picture_two,picture_three,picture_four) values(?,?,?,?,?,?,?,?,?)";
|
| | | boolean bl=DAOHelper.executeUpdatePicture(DBUtil.getConn(), sql, list);
|
| | | return bl;
|
| | | }
|
| | |
|
| | |
| | | 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 " +
|
| | | String sql=" select SQL_CALC_FOUND_ROWS distinct tb_deverror_record.num,tb_deverror_record.stationid,record_time,error_descript,error_en,picture_num " +
|
| | | " ,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 " +
|
| | |
| | | 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.setPicture_num(rs.getInt("picture_num"));
|
| | | Page page=new Page();
|
| | | dev_record.setPage(page);
|
| | | list.add(dev_record);
|
| | |
| | | return list;
|
| | | }
|
| | |
|
| | | public List serchByInfo(Object obj) {
|
| | | // TODO Auto-generated method stub
|
| | | return null;
|
| | | //根据num和列名查询图片(note放列名字)
|
| | | public List serchByInfo(Object obj){
|
| | | final Deverror_record dev_record=(Deverror_record) obj;
|
| | | String sql="select "+dev_record.getNote()+" from db_battinf.tb_deverror_record where num=? ";
|
| | | List list=DAOHelper.executeQueryPicture(sql, DBUtil.getConn(), new Object[]{dev_record.getNum()}, new CallBack() {
|
| | | |
| | | public List getResults(ResultSet rs) {
|
| | | List list=new ArrayList();
|
| | | try {
|
| | | while(rs.next()){
|
| | | Blob blob=rs.getBlob(dev_record.getNote());
|
| | | list.add(blob);
|
| | | }
|
| | | } catch (SQLException e) {
|
| | | // TODO Auto-generated catch block
|
| | | e.printStackTrace();
|
| | | }
|
| | | return list;
|
| | | }
|
| | | });
|
| | | return list;
|
| | | |
| | | }
|
| | | public static void main(String[] args) {
|
| | | Deverror_recordImpl dimpl=new Deverror_recordImpl();
|