| | |
| | | package com.fgkj.mapper.impl; |
| | | |
| | | import java.sql.ResultSet; |
| | | import java.sql.SQLException; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | |
| | | import com.fgkj.mapper.BaseDAO; |
| | | import com.fgkj.mapper.CallBack; |
| | | import com.fgkj.mapper.DAOHelper; |
| | | import com.fgkj.db.DBUtil; |
| | | import com.fgkj.dto.Batt_devdischarge_param; |
| | | |
| | | public class Batt_devdischarge_paramImpl implements BaseDAO,CallBack{ |
| | | |
| | | public List getResults(ResultSet rs) { |
| | | List list=new ArrayList(); |
| | | try { |
| | | while(rs.next()){ |
| | | Batt_devdischarge_param bdparam=new Batt_devdischarge_param(); |
| | | bdparam.setNum(rs.getInt("num")); |
| | | bdparam.setDev_param_type(rs.getInt("dev_param_type")); |
| | | bdparam.setDev_param_value(rs.getInt("dev_param_value")); |
| | | bdparam.setNote(rs.getString("note")); |
| | | list.add(bdparam); |
| | | } |
| | | } catch (SQLException e) { |
| | | // TODO Auto-generated catch block |
| | | e.printStackTrace(); |
| | | } |
| | | return list; |
| | | } |
| | | |
| | | public boolean add(Object obj) { |
| | | Batt_devdischarge_param bdparam=(Batt_devdischarge_param) obj; |
| | | String sql="insert into web_site.tb_batt_devdischarge_param(dev_param_type,dev_param_value) values(?,?)"; |
| | | Boolean bl=DAOHelper.executeUpdate(DBUtil.getConn(), sql, new Object[]{bdparam.getDev_param_type(),bdparam.getDev_param_value()}); |
| | | return bl; |
| | | } |
| | | |
| | | public boolean update(Object obj) { |
| | | Batt_devdischarge_param bdparam=(Batt_devdischarge_param) obj; |
| | | String sql="update web_site.tb_batt_devdischarge_param set dev_param_value=? where dev_param_type=?"; |
| | | Boolean bl=DAOHelper.executeUpdate(DBUtil.getConn(), sql, new Object[]{bdparam.getDev_param_value(),bdparam.getDev_param_type()}); |
| | | return bl; |
| | | } |
| | | |
| | | public boolean del(Object obj) { |
| | | Batt_devdischarge_param bdparam=(Batt_devdischarge_param) obj; |
| | | String sql="delete from web_site.tb_batt_devdischarge_param where dev_param_type=?"; |
| | | Boolean bl=DAOHelper.executeUpdate(DBUtil.getConn(), sql, new Object[]{bdparam.getDev_param_type()}); |
| | | return bl; |
| | | } |
| | | |
| | | public List searchAll() { |
| | | String sql="select num,dev_param_type,dev_param_value,note from web_site.tb_batt_devdischarge_param "; |
| | | List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), null, new BattDischarge_paramImpl() ); |
| | | return list; |
| | | } |
| | | //11.1根据参数类型dev_param_type查询参数值dev_param_value |
| | | public List serchByCondition(Object obj) { |
| | | Batt_devdischarge_param bdparam=(Batt_devdischarge_param) obj; |
| | | String sql="select dev_param_value from web_site.tb_batt_devdischarge_param where dev_param_type=? limit 1 "; |
| | | List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), new Object[]{bdparam.getDev_param_type()}, new CallBack() { |
| | | |
| | | public List getResults(ResultSet rs) { |
| | | List list=new ArrayList(); |
| | | try { |
| | | while(rs.next()){ |
| | | Batt_devdischarge_param bdparam =new Batt_devdischarge_param(); |
| | | bdparam.setDev_param_value(rs.getInt("dev_param_value")); |
| | | list.add(bdparam); |
| | | } |
| | | } 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; |
| | | } |
| | | |
| | | } |
| | | // package com.fgkj.mapper.impl; |
| | | // |
| | | // import java.sql.ResultSet; |
| | | // import java.sql.SQLException; |
| | | // import java.util.ArrayList; |
| | | // import java.util.List; |
| | | // |
| | | // import com.fgkj.mapper.BaseDAO; |
| | | // import com.fgkj.mapper.CallBack; |
| | | // |
| | | // import com.fgkj.db.DBUtil; |
| | | // import com.fgkj.dto.Batt_devdischarge_param; |
| | | // @Deprecated |
| | | // public class Batt_devdischarge_paramImpl implements BaseDAO,CallBack{ |
| | | // |
| | | // public List getResults(ResultSet rs) { |
| | | // List list=new ArrayList(); |
| | | // try { |
| | | // while(rs.next()){ |
| | | // Batt_devdischarge_param bdparam=new Batt_devdischarge_param(); |
| | | // bdparam.setNum(rs.getInt("num")); |
| | | // bdparam.setDev_param_type(rs.getInt("dev_param_type")); |
| | | // bdparam.setDev_param_value(rs.getInt("dev_param_value")); |
| | | // bdparam.setNote(rs.getString("note")); |
| | | // list.add(bdparam); |
| | | // } |
| | | // } catch (SQLException e) { |
| | | // // TODO Auto-generated catch block |
| | | // e.printStackTrace(); |
| | | // } |
| | | // return list; |
| | | // } |
| | | // |
| | | // public boolean add(Object obj) { |
| | | // Batt_devdischarge_param bdparam=(Batt_devdischarge_param) obj; |
| | | // String sql="insert into web_site.tb_batt_devdischarge_param(dev_param_type,dev_param_value) values(?,?)"; |
| | | // Boolean bl=DateUtil.executeUpdate(DBUtil.getConn(), sql, new Object[]{bdparam.getDev_param_type(),bdparam.getDev_param_value()}); |
| | | // return bl; |
| | | // } |
| | | // |
| | | // public boolean update(Object obj) { |
| | | // Batt_devdischarge_param bdparam=(Batt_devdischarge_param) obj; |
| | | // String sql="update web_site.tb_batt_devdischarge_param set dev_param_value=? where dev_param_type=?"; |
| | | // Boolean bl=DateUtil.executeUpdate(DBUtil.getConn(), sql, new Object[]{bdparam.getDev_param_value(),bdparam.getDev_param_type()}); |
| | | // return bl; |
| | | // } |
| | | // |
| | | // public boolean del(Object obj) { |
| | | // Batt_devdischarge_param bdparam=(Batt_devdischarge_param) obj; |
| | | // String sql="delete from web_site.tb_batt_devdischarge_param where dev_param_type=?"; |
| | | // Boolean bl=DateUtil.executeUpdate(DBUtil.getConn(), sql, new Object[]{bdparam.getDev_param_type()}); |
| | | // return bl; |
| | | // } |
| | | // |
| | | // public List searchAll() { |
| | | // String sql="select num,dev_param_type,dev_param_value,note from web_site.tb_batt_devdischarge_param "; |
| | | // List list=DateUtil.executeQuery(sql, DBUtil.getConn(), null, new BattDischarge_paramImpl() ); |
| | | // return list; |
| | | // } |
| | | // //11.1根据参数类型dev_param_type查询参数值dev_param_value |
| | | // public List serchByCondition(Object obj) { |
| | | // Batt_devdischarge_param bdparam=(Batt_devdischarge_param) obj; |
| | | // String sql="select dev_param_value from web_site.tb_batt_devdischarge_param where dev_param_type=? limit 1 "; |
| | | // List list=DateUtil.executeQuery(sql, DBUtil.getConn(), new Object[]{bdparam.getDev_param_type()}, new CallBack() { |
| | | // |
| | | // public List getResults(ResultSet rs) { |
| | | // List list=new ArrayList(); |
| | | // try { |
| | | // while(rs.next()){ |
| | | // Batt_devdischarge_param bdparam =new Batt_devdischarge_param(); |
| | | // bdparam.setDev_param_value(rs.getInt("dev_param_value")); |
| | | // list.add(bdparam); |
| | | // } |
| | | // } 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; |
| | | // } |
| | | // |
| | | // } |