zoukankan      html  css  js  c++  java
  • 递归

    public void town_data_selectforecast(){
            List<Town> t= townManager.select(town);
            if(t.size()<=0){
               Date beginDate = new Date();
               t = this.findTown(beginDate);
            }
            writeJson(t);
        }
        
        
        /**
         * 递归查询
         * @param data日期
         * @return
         */
        private List<Town> findTown(Date data){
            List<Town> townlist =new ArrayList<Town>();
            Town town=new Town();
            SimpleDateFormat dft = new SimpleDateFormat("yyyy-MM-dd");
            String startTime = dft.format(data.getTime());
            Calendar date = Calendar.getInstance();
            date.setTime(data);
            date.set(Calendar.DATE, date.get(Calendar.DATE) - 1);
            Date endDate=null;
            try {
                 endDate = dft.parse(dft.format(date.getTime()));
                String endTime = dft.format(date.getTime());
                town.setTown_time(endTime);
                town.setType("3");
                townlist=townManager.select(town);
            } catch (Exception e) {
                e.printStackTrace();
            }
            if(townlist.size()>0){
                return townlist;
            }else{
                return findTown(endDate);
            }
        }

  • 相关阅读:
    del命令
    echo命令
    什么是批处理
    ubuntu禁止ping操作(禁用ICMP协议访问)
    树莓派:raspberry pi 3b
    小tips合集
    吐个槽:bose的售后真心差劲!愧对这个顶级音响产品!
    WinSetupFromUSB
    win7 64位下vs不能以管理员身份运行的问题解决
    vs2010中如何设置Visual Assist方便地使用现成的代码编辑器风格
  • 原文地址:https://www.cnblogs.com/guolsblog/p/6047833.html
Copyright © 2011-2022 走看看