⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 adminpurviewbean.java

📁 WAP PUSH后台源码,WAP PUSH后台源码
💻 JAVA
字号:
package com.sxit.wap.adminpurview;import java.sql.*;import java.util.*;import com.sxit.wap.common.*;import com.sxit.wap.exception.*;import com.sxit.wap.admin.*;public class AdminPurviewBean extends AdminPurviewDao {  public static boolean validPurview(AdminInfoModel adminInfoModel, short purviewCode) throws SysException {    Hashtable table = adminInfoModel.getAdminPurview();    if (table.get(new Short(purviewCode)) == null) {      return false;    } else {      return true;    }  }  public static Hashtable getAdminPurview(AdminModel adminModel) throws SysException {    Hashtable table = new Hashtable();    Collection coll = queryBySql("SELECT PURVIEW_CODE FROM " + tableName + " WHERE ADMIN_NAME = '" + adminModel.getAdminName() + "'");    Iterator it = coll.iterator();    while (it.hasNext()) {      Hashtable element = (Hashtable)it.next();      table.put(new Short((String)element.get("purviewCode")), "1");    }    return table;  }  public static Hashtable getAdminPurview(String adminName) throws SysException {    Hashtable table = new Hashtable();    Collection coll = queryBySql("SELECT PURVIEW_CODE FROM " + tableName + " WHERE ADMIN_NAME = '" + adminName + "'");    Iterator it = coll.iterator();    while (it.hasNext()) {      Hashtable element = (Hashtable)it.next();      table.put(new Short((String)element.get("purviewCode")), "1");    }    return table;  }  public static String checked(Hashtable purviews, int purviewCode) {    if (purviews == null) return "";    short code = (short)purviewCode;    return purviews.get(new Short(code))!=null?"checked":"";  }  public static boolean isExists(String adminName, int purviewCode) throws SysException {    try {      findByPK(adminName, purviewCode);      return true;    } catch(FinderException e) {      return false;    }  }  public static void updateAdminPurview(String adminName, int[] purviews) throws SysException {    String sql = "DELETE FROM " + tableName + " WHERE ADMIN_NAME = '" + adminName + "'";    Connection conn = null;    try {      conn = Database.getConnection();      conn.setAutoCommit(false);      updateBySql(sql, conn);      for (int i=0; i<purviews.length; i++) {        AdminPurviewModel model = new AdminPurviewModel();        model.setAdminName(adminName);        model.setPurviewCode(purviews[i]);        insert(model, conn);      }      conn.commit();    } catch (Exception e) {      e.printStackTrace();      try {conn.rollback();} catch (Exception ex) {}      throw new SysException("Exception while execute updateAdminPurview");    } finally {      try {conn.setAutoCommit(false);} catch (Exception ex) {}      try {conn.close();} catch (Exception ex) {}    }  }}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -