| | |
| | | }
|
| | | return list;
|
| | | }
|
| | | public static void main(String[] args) {
|
| | | |
| | | //查询出当前存在内存中最大的电池组id(很重要**********)
|
| | | public int searchMaxBattgroupId(){
|
| | | String sql=" select max(battgroupId) as id from db_ram_db.tb_batt_rtstate limit 1";
|
| | | List list=DAOHelper.executeQuery(sql, DBUtil.getConn(), null, new CallBack() {
|
| | | |
| | | public List getResults(ResultSet rs) {
|
| | | List list=new ArrayList();
|
| | | try {
|
| | | while(rs.next()){
|
| | | int battgroupid=1010000;
|
| | | if(rs.getString("id")!=null){
|
| | | battgroupid=rs.getInt("id");
|
| | | }
|
| | | list.add(battgroupid);
|
| | | }
|
| | | } catch (SQLException e) {
|
| | | // TODO Auto-generated catch block
|
| | | e.printStackTrace();
|
| | | }
|
| | | return list;
|
| | | }
|
| | | });
|
| | | int battgroupid=0;
|
| | | if(list!=null&&list.size()>0){
|
| | | battgroupid=(Integer) list.get(list.size()-1);
|
| | | }
|
| | | return battgroupid;
|
| | | }
|
| | | public static void main(String[] args) {
|
| | | User_inf uinf=new User_inf();
|
| | | uinf.setUId(1001);
|
| | | Batt_rtstateDAOImpl bimpl=new Batt_rtstateDAOImpl();
|
| | |
| | | }*/
|
| | | Batt_rtstate br=new Batt_rtstate();
|
| | | br.setBattGroupId(1002101);
|
| | | List<Batt_rtstate> list=bimpl.serchByCondition_ky(br);
|
| | | /*List<Batt_rtstate> list=bimpl.serchByCondition_ky(br);
|
| | | for (Batt_rtstate b : list) {
|
| | | System.out.println(b);
|
| | | }
|
| | | }*/
|
| | | int battgroupid=bimpl.searchMaxBattgroupId();
|
| | | System.out.println(battgroupid);
|
| | | }
|
| | | }
|