Beispiel #1
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;
    }
  }
Beispiel #2
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;
   }
 }