@Override
  public List existsOrderListByProductId(String userId, String productId) {

    String sql =
        "select count(*) from tb_order_list orders,tb_order_detail detail where detail.orderId=orders.orderId and orders.userId=? and detail.productId=?";
    List list = commonDao.findBySql(sql, null, userId, productId);
    return list;
  }
  @Override
  public List<Order_list> getOrder_listByMethod(
      Oper oper, int type, String providerId, String... params) {

    List<Order_list> orderLists = new ArrayList();
    String hql = "from Order_list where validflag=1 ";
    if (oper.getPartnerflag() != 0) {
      hql += " and providerId=" + providerId + "  ";
    }

    if (params.length >= 1 && params[0] != null && !"".equals(params[0])) {
      hql += " and status='" + params[0] + "'  ";
    }
    if (params.length >= 2 && params[1] != null && !"".equals(params[1])) {
      hql += " and createTime>= '" + params[1] + "'  ";
    }
    if (params.length >= 3 && params[2] != null && !"".equals(params[2])) {
      hql += " and createTime<= '" + params[2] + " 23:59:99'  ";
    }

    switch (type) {
      case 1:
        orderLists = commonDao.findByHql(hql + "and orderType=1  order by createTime desc");
        break;
      case 2:
        orderLists = commonDao.findByHql(hql + "and orderType=2  order by createTime desc");
        break;
      case 3:
        orderLists = commonDao.findByHql(hql + "and orderType=3  order by createTime desc");
        break;
        // 合作社订单暂时没有用到
      case 4:
        orderLists = commonDao.findByHql(hql + "and orderType=4  order by createTime desc");
        break;
      case 5:
        List<Order_detail> orderDetails =
            commonDao.findByHql(
                "from Order_detail where orderType=2 and productId='" + params[0] + "'");
        for (Order_detail order_detail : orderDetails) {
          List<Order_list> tempList =
              commonDao.findBySql(
                  "select * from tb_order_list where orderId=?",
                  Order_list.class,
                  order_detail.getOrderId());

          if (tempList != null && tempList.size() > 0) {

            Order_list order_list = tempList.get(0);
            User user = (User) userService.getUserByMethod(11, order_list.getUserId()).get(0);
            switch (user.getUserType()) {
              case 1:
                User_Ext_Personal personal =
                    (User_Ext_Personal)
                        userService.getUserByMethod(12, order_list.getUserId()).get(0);
                user.setPersonal(personal);
                break;
              case 2:
                User_Ext_Enterprise enterprise =
                    (User_Ext_Enterprise)
                        userService.getUserByMethod(13, order_list.getUserId()).get(0);
                user.setEnterprise(enterprise);
                break;
              default:
                break;
            }
            order_list.setUser(user);
            orderLists.add(order_list);
          }
        }
        return orderLists;
      case 6:
        // 查询出影响删除团购的订单
        orderLists =
            commonDao.findBySql(
                "select list.* from tb_order_detail detail,tb_order_list list where "
                    + "detail.orderid = list.orderid and list.validflag=1 and list.status not in ('02','08','13') and detail.productId in ("
                    + params[0]
                    + ") and list.orderType=2",
                Order_list.class);
        break;

      case 7:
        orderLists =
            commonDao.findByHql(
                "from Order_list where userId=? and validflag = 1 and (status<>'02' and status<>'08' and status<>'13')",
                params[0]);
        break;
      case 8:
        orderLists =
            commonDao.findByHql("from Order_list where orderId=? and validflag=1", params[0]);
        break;
      case 9:
        orderLists =
            commonDao.findByHql(
                "from Order_list where orderId=? and status=? and validflag=1", params);
        break;
      case 10:
        orderLists = commonDao.findByHql(hql + " and (status='09' or status='10' or status='11')");
        break;
      case 11:
        orderLists = commonDao.findByHql(hql + " and (status='10' or status='12' or status='13')");
        break;
      case 12:
        orderLists =
            commonDao.findByHql(
                "from Order_list where orderId = '"
                    + params[0]
                    + "' and validflag=1 and (status<>'02' and status<>'08' and status<>'13')");
        break;
      case 13:
        orderLists =
            commonDao.findByHql(
                "from Order_list where providerId=? and status not in ('02','08','13')",
                providerId);
        return orderLists;
    }

    for (Order_list order_list : orderLists) {

      User user = (User) userService.getUserByMethod(11, order_list.getUserId()).get(0);
      order_list.setUser(user);

      if (order_list.getOrderType() == 3) {
        List<Order_detail> detailsList =
            detailService.getOrderdetailByMethod(1, oper, order_list.getOrderId());
        // .findByHql("from Order_detail where orderId=?", );
        for (Order_detail order_detail : detailsList) {
          Product_ext_bigDeal bigDeal =
              bigDealService.getbigDealProductByMethod(5, order_detail.getProductId(), "1").get(0);
          order_detail.setProduct(bigDeal.getProduct());
        }
        order_list.setOrder_detail(detailsList);
      } else if (order_list.getOrderType() == 2) {
        List<Order_detail> detailsList =
            detailService.getOrderdetailByMethod(1, oper, order_list.getOrderId());
        // .findByHql("from Order_detail where orderId=?", );
        for (Order_detail order_detail : detailsList) {
          Product_ext_groupBuy bigDeal =
              groupBuyService.getgroupBuyProductByMethod(5, order_detail.getProductId()).get(0);
          order_detail.setProduct(bigDeal.getProduct());
        }
        order_list.setOrder_detail(detailsList);
      } else {
        order_list.setUserAddress(
            userAddressService
                .getUserAddressByMethod(3, order_list.getUserAddressId(), order_list.getUserId())
                .get(0));
        order_list.setPayment_Method(
            payment_MethodService.getPayMentByMethod(2, order_list.getPaymentway()).get(0));
      }

      // order_list.setExpress(expressService.getExpressByMethod(2,
      // order_list.getExpressvendor()).get(0));

    }
    return orderLists;
  }