示例#1
0
 public void update(FoodVo foodVo) throws Exception {
   FoodData foodData = (FoodData) this.get(FoodData.class, foodVo.getFoodId());
   if (null == foodVo.getImg()) {
     foodVo.setImg(foodData.getImg());
   }
   BeanUtilsHelp.copyProperties(foodData, foodVo);
   this.update(foodData);
 }
示例#2
0
 public List<FoodVo> loadAll() throws Exception {
   List<FoodVo> foodVoList = this.findByNamedQuery("loadAllFood");
   System.out.println(foodVoList.size());
   for (FoodVo fv : foodVoList) {
     System.out.println("饮食名称 ---->>> " + fv.getName());
   }
   return foodVoList;
 }
示例#3
0
 public FoodVo save(FoodVo foodVo) throws Exception {
   foodVo.setFoodId(StringUtil.getUUID());
   FoodData foodData = new FoodData();
   BeanUtilsHelp.copyProperties(foodData, foodVo);
   this.save(foodData);
   foodVo.setFoodId(foodData.getFoodId());
   return foodVo;
 }
示例#4
0
 public FoodVo get(String id) throws Exception {
   FoodData foodData = (FoodData) this.get(FoodData.class, id);
   FoodVo foodVo = new FoodVo();
   BeanUtilsHelp.copyProperties(foodVo, foodData);
   if (null != foodData.getRestaurantId()) {
     RestaurantData restaurant =
         (RestaurantData) super.get(RestaurantData.class, foodData.getRestaurantId());
     foodVo.setRestaurantId(restaurant.getRestaurantId());
     foodVo.setRestaurantName(restaurant.getName());
   }
   if (null != foodData.getFood_kindId()) {
     Food_kindData food_kind =
         (Food_kindData) super.get(Food_kindData.class, foodData.getFood_kindId());
     foodVo.setFood_kindId(food_kind.getFood_kind_Id());
     foodVo.setFood_kind_Name(food_kind.getName());
   }
   return foodVo;
 }