/**
  * 获取时间限定sql语句。。。该函数还会顺北将参数设置到 params列表中。。 要求是表别名必须是 t !!!!!
  *
  * @param aqm
  * @param thisYearDateResult
  * @param flightDateFieldName 飞行日期 e3为 lcl_dpt_dt e4为 flight_date
  * @param aiplanTypeFieldName 机型 e3为plane_model e4为aircraft_type
  * @return
  * @throws Exception
  */
 public static String limitSqlString(
     AirlineQueryModel aqm,
     List<Map<String, Object>> thisYearDateResult,
     Map<String, String> fieldName,
     List<Object> params)
     throws Exception {
   // 1 为时间段 2 为时间点。
   String dateType = thisYearDateResult.get(0).get("dateType").toString();
   StringBuffer result = new StringBuffer(" on t.client_id = '" + aqm.getClientId() + "'");
   // StringBuffer result = new StringBuffer(" on 1 = 1 ");
   if (StringUtils.equals(dateType, "1")) {
     result.append(" and (");
     for (Map<String, Object> m : thisYearDateResult) {
       String beginDt = m.get("beginDate").toString();
       String endDt = m.get("endDate").toString();
       result.append(
           " t."
               + fieldName.get("flightDate")
               + " between to_date(?, 'yyyy/MM/dd') and to_date(?, 'yyyy/MM/dd') or");
       params.add(beginDt);
       params.add(endDt);
     }
     result.append(" 1=2)");
   } else if (StringUtils.equals(dateType, "2")) {
     String dt = thisYearDateResult.get(0).get("searchDate").toString();
     String[] dtL = dt.split(",");
     result.append(
         " and to_char(t."
             + fieldName.get("flightDate")
             + ",'yyyy/MM/dd') in ("
             + Stringer.formatStr(Statics.gson.toJson(dtL))
             + ")");
   }
   if (aqm.getWeeks().length() > 2) {
     result.append(
         " and t." + fieldName.get("week") + " in (" + Stringer.formatStr(aqm.getWeeks()) + ")");
   }
   if (aqm.getCompany().length() > 2) {
     result.append(
         " and t."
             + fieldName.get("company")
             + " in ("
             + Stringer.formatStr(aqm.getCompany())
             + ")");
   }
   if (aqm.getAirplaneType().length() > 2) {
     result.append(
         " and t."
             + fieldName.get("airlineType")
             + " in ("
             + Stringer.formatStr(aqm.getAirplaneType())
             + ")");
   }
   return result.toString();
 }