package com.sysu.admin.controller.geo.qyz;

import com.sysu.admin.support.system.region.Region;
import com.sysu.admin.support.system.region.RegionRepository;
import com.xiesx.fastboot.base.result.BaseResult;
import com.xiesx.fastboot.base.result.R;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;
import java.util.ArrayList;
import java.util.List;

/**
 * 镇区域
 */
@RequestMapping("/qyz")
@Controller
public class QyzController {
    @Autowired
    QyzService qyzService;
    @Autowired
    RegionRepository regionRepository;

    /**
     * 种植结构
     * @return
     */
    @RequestMapping(value = "/zzjg")
    public String zzjg(Model model){
        model.addAttribute("pac","441821");
        return "page/zzjg";
    }

    @RequestMapping(value = "/findJson")
    @ResponseBody
    public BaseResult findJson(String code){
        return R.succ();
    }

    /**
     * @return
     */
    public BaseResult generateCity(){
        List<Region> cityList = new ArrayList<>();
        cityList.add(regionRepository.findByCode(441800));
        for(Region region : cityList){

        }
        return R.succ();
    }

    public static int clearEndZero(int num){
        while(num % 10 == 0 && num != 0){
            num = num / 10;
        }
        return num;
    }

    public static void main(String[] args) {
        System.out.println(clearEndZero(0));
    }




}
