Exemplo n.º 1
0
 public MenuAdapterVO[] getAllMenuCategorys() throws CpbBusinessException {
   PtBaseDAO dao = new PtBaseDAO();
   String sql = "select a.pk_menucategory,a.id,a.title from cp_menucategory a";
   List<MenuAdapterVO> list;
   try {
     list = (List<MenuAdapterVO>) dao.executeQuery(sql, new MenuCategoryAdapterVOProcessor());
   } catch (DAOException e) {
     LfwLogger.error(e.getMessage(), e);
     throw new CpbBusinessException(e);
   }
   return list.toArray(new MenuAdapterVO[0]);
 }
Exemplo n.º 2
0
 @SuppressWarnings("unchecked")
 @Override
 public CpResourceVO[] queryResources(String wherePart) throws CpbBusinessException {
   PtBaseDAO dao = new PtBaseDAO();
   try {
     List<CpResourceVO> list =
         (List<CpResourceVO>) dao.retrieveByClause(CpResourceVO.class, wherePart);
     if (list != null && !list.isEmpty()) {
       return list.toArray(new CpResourceVO[0]);
     }
   } catch (DAOException e) {
     LfwLogger.error("资源查询失败!", e);
     throw new CpbBusinessException(e);
   }
   return new CpResourceVO[] {};
 }
Exemplo n.º 3
0
 public MenuAdapterVO[] getAllMenus() throws CpbBusinessException {
   PtBaseDAO dao = new PtBaseDAO();
   String sql1 = "select a.pk_menucategory,a.id,a.title from cp_menucategory as a";
   String sql2 =
       "select b.code,b.name,b.pk_menuitem,b.pk_parent,b.pk_menucategory from cp_menuitem as b";
   List<MenuAdapterVO> list1;
   List<MenuAdapterVO> list2;
   try {
     list1 = (List<MenuAdapterVO>) dao.executeQuery(sql1, new MenuCategoryAdapterVOProcessor());
     list2 = (List<MenuAdapterVO>) dao.executeQuery(sql2, new MenuItemAdapterVOProcessor());
   } catch (DAOException e) {
     LfwLogger.error(e.getMessage(), e);
     throw new CpbBusinessException(e);
   }
   list1.addAll(list2);
   return list1.toArray(new MenuAdapterVO[0]);
 }
Exemplo n.º 4
0
 @SuppressWarnings("unchecked")
 @Override
 public CpResourceVO[] getResoureces(String pk_user) throws CpbBusinessException {
   PtBaseDAO baseDAO = new PtBaseDAO();
   String sql =
       "select * from pt_resource p1 join pt_permission p2 on p1.pk_resource = p2.pk_resource where p2.pk_role in (select pk_role from pt_roleuser p3 where p3.pk_user = ?) ";
   List<CpResourceVO> list = null;
   SQLParameter param = new SQLParameter();
   param.addParam(pk_user);
   try {
     list =
         (List<CpResourceVO>)
             baseDAO.executeQuery(sql, param, new BeanListProcessor(CpResourceVO.class));
     if (list == null || list.size() < 1) return new CpResourceVO[] {};
     return list.toArray(new CpResourceVO[list.size()]);
   } catch (DAOException e) {
     LfwLogger.error(e.getMessage(), e);
     throw new CpbBusinessException(e);
   }
 }