Пример #1
0
  @RequestMapping
  public ModelAndView create_city(String proId, String name) {
    ModelAndView mv = new ModelAndView();
    if (StringUtil.isEmpty(proId) || StringUtil.isEmpty(name)) {
      return mv;
    }
    City city = areaService.createCity(new ObjectId(proId), name);
    if (city == null) {

    } else {
      mv.setViewName("forward:findAllCities.do?proId=" + proId);
    }
    return mv;
  }
Пример #2
0
  @RequestMapping
  public ModelAndView create_area(String cityId, String name) {
    ModelAndView mv = new ModelAndView();
    if (StringUtil.isEmpty(cityId) || StringUtil.isEmpty(name)) {
      return mv;
    }
    Area area = areaService.createArea(new ObjectId(cityId), name);
    if (area == null) {

    } else {
      mv.setViewName("forward:findAllAreas.do?cityId=" + cityId);
    }
    return mv;
  }
Пример #3
0
 @RequestMapping
 public ModelAndView create_start_area(String cityId) {
   ModelAndView mv = new ModelAndView("area/create_area");
   if (StringUtil.isEmpty(cityId)) {
     return mv;
   }
   City city = areaService.findCity(new ObjectId(cityId));
   mv.addObject("city", city);
   return mv;
 }
Пример #4
0
 @RequestMapping
 public ModelAndView create_start_city(String proId) {
   ModelAndView mv = new ModelAndView("area/create_city");
   if (StringUtil.isEmpty(proId)) {
     return mv;
   }
   Province province = areaService.findProvince(new ObjectId(proId));
   mv.addObject("province", province);
   return mv;
 }
Пример #5
0
 @Override
 public Province createProvince(String name) {
   if (StringUtil.isEmpty(name)) {
     return null;
   }
   Province province = new Province();
   province.setName(name);
   dao.save(province);
   return province;
 }
Пример #6
0
 @Override
 public City createCity(ObjectId proId, String name) {
   if (proId == null || StringUtil.isEmpty(name)) {
     return null;
   }
   Province province = findProvince(proId);
   if (province == null) {
     return null;
   }
   City city = new City();
   city.setName(name);
   city.setProvince(province);
   dao.save(city);
   province.getCities().add(city);
   dao.save(province);
   return city;
 }