示例#1
0
 /**
  * 废弃 获得所有巡检员
  *
  * @param deptid
  * @return
  */
 public List getPatrolList(String deptid) {
   String sql =
       "select p.patrolid id,p.patrolname patrolname from patrolmaninfo p where  p.parentid='"
           + deptid
           + "'";
   QueryUtil query;
   try {
     query = new QueryUtil();
     List patrollist = query.queryBeans(sql);
     return patrollist;
   } catch (Exception e) {
     logger.error(e);
     e.printStackTrace();
     return null;
   }
 }
示例#2
0
 private List queryList(String sql) {
   List result = new ArrayList();
   QueryUtil query;
   try {
     query = new QueryUtil();
     ResultSet rs = query.executeQuery(sql);
     while (rs.next()) {
       result.add(rs.getString("field"));
     }
     return result;
   } catch (Exception e) {
     logger.error(e);
     e.printStackTrace();
     return null;
   }
 }
示例#3
0
  /**
   * 功能:检查指定的线能否被删除,
   *
   * <p>参数:指定线的id
   *
   * <p>返回值:能删除返回true,否则返回false;
   */
  public boolean valiLineCanDele(String lineid) {

    ResultSet rst = null;
    String sql = "select count(*) aa from  sublineinfo  where lineid='" + lineid + "'";
    try {
      QueryUtil excu = new QueryUtil();
      rst = excu.executeQuery(sql);
      rst.next();
      if (rst.getInt("aa") == 0) {
        rst.close();
        return true;
      } else {
        rst.close();
        return false;
      }
    } catch (Exception e) {
      logger.error("检查指定的线能否被删除出错:" + e.getMessage());
      return false;
    }
  }
示例#4
0
 /**
  * 查询批量计划
  *
  * @param user
  * @param batchname
  * @return
  */
 public List queryBatch(UserInfo user, String batchname) {
   String sql =
       "select id,batchname,to_char(startdate,'yyyy/mm/dd') startdate,to_char(enddate,'yyyy/mm/dd')enddate,to_char(createdate,'yyyy/mm/dd')createdate from batchplan where contractorid='"
           + user.getDeptID()
           + "' ";
   logger.info(batchname);
   if (batchname != null) {
     sql += " and batchname like ('%" + batchname + "%')";
   }
   logger.info(sql);
   QueryUtil query;
   try {
     query = new QueryUtil();
     List list = query.queryBeans(sql);
     return list;
   } catch (Exception e) {
     logger.error(e);
     e.printStackTrace();
     return null;
   }
 }
示例#5
0
 /**
  * 检验LineName 是否存在
  *
  * @param name String
  * @return boolean
  */
 public boolean validateLineName(String name, String type, String region) {
   String sql =
       "select count(lineid) i from lineinfo where linename='"
           + name
           + "' and regionid='"
           + region
           + "'";
   ResultSet rs = null;
   try {
     QueryUtil query = new QueryUtil();
     logger.info("validateLineName() sql :" + sql);
     rs = query.executeQuery(sql);
     rs.next();
     int i = rs.getInt("i");
     logger.info("i=" + i);
     if ("edit".equals(type)) {
       if (i < 1) {
         rs.close();
         return true;
       } else {
         rs.close();
         return false;
       }
     } else {
       if (i == 0) {
         rs.close();
         return true;
       } else {
         rs.close();
         return false;
       }
     }
   } catch (Exception ex) {
     logger.error("检查线路是否重名时出错: " + ex.getMessage());
     return false;
   }
 }
示例#6
0
 public List getLine(String sql) {
   QueryUtil query = null;
   BasicDynaBean dynaBean = null;
   // Vector resultVct = new Vector();
   ArrayList lableList = new ArrayList();
   logger.info("SQL :" + sql);
   try {
     query = new QueryUtil();
     Iterator it = query.queryBeans(sql).iterator();
     while (it.hasNext()) {
       dynaBean = (BasicDynaBean) it.next();
       // logger.info("lavel :"+dynaBean.get("linename")+"  value :"+dynaBean.get("lineid"));
       lableList.add(
           new LabelValueBean(
               (String) (dynaBean.get("linename")), (String) (dynaBean.get("lineid"))));
     }
     // resultVct.add(lableList);
     logger.info(lableList);
     return lableList;
   } catch (Exception ex) {
     logger.error("加载线路时出错:" + ex.getMessage());
     return null;
   }
 }