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; }
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); }
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; }