@Transactional(propagation = Propagation.REQUIRED)
  public String insert(Menu entity) {
    if (entity == null) {
      return "传入了空对象";
    }

    // 验证分栏名称

    if (entity.getMenuName() == null || entity.getMenuName().length() == 0) {
      return "请输入分栏名称";
    }

    List<User> list =
        hibernateDao.queryListByHql(
            QUERY_MENU_BY_NAME, new String[][] {new String[] {"menuName", entity.getMenuName()}});
    if (list != null && list.size() > 0) {
      return "分栏名称已存在,请重新输入";
    }

    // 数据持久化

    hibernateDao.insert(entity);

    return null;
  }
 @Transactional(propagation = Propagation.REQUIRED)
 public String delete(Menu entity) {
   String[][] param = new String[][] {new String[] {"menuId", entity.getMenuId()}};
   hibernateDao.excuteHQL(DELETE_GROUP_BY_MENU, param);
   hibernateDao.excuteHQL(DELETE_MENU_BY_RESOURCE, param);
   hibernateDao.excuteHQL(DELETE_BY_MENU, param);
   return null;
 }
  @Transactional(propagation = Propagation.REQUIRED)
  public String update(Menu entity) {
    if (entity == null) {
      return "传入了空对象";
    }

    // 获取原数据

    Menu oldMenu = hibernateDao.get(new Menu(), entity.getMenuId());
    BeanUtil.beanToBean(entity, oldMenu);

    // 验证组名称

    if (!entity.getMenuName().equals(oldMenu.getMenuName())) {
      if (entity.getMenuName() == null || entity.getMenuName().length() == 0) {
        return "请输入分栏名称";
      }

      List<User> list =
          hibernateDao.queryListByHql(
              QUERY_MENU_BY_NAME, new String[][] {new String[] {"menuName", entity.getMenuName()}});
      if (list != null && list.size() > 0) {
        return "分栏名称已存在,请重新输入";
      }
    }

    // 数据持久化

    hibernateDao.update(entity);

    return null;
  }