@Transactional
  public void update(GlobalHobby gh, String reg) {
    try {
      // 1:update一个,2:批量update
      if (reg.equals("2")) {
        String[] ids = gh.getId().split("-");
        for (int i = 0; i < ids.length; i++) {
          if (!ids[i].equals("on")) {
            GlobalHobby glModel = new GlobalHobby();
            glModel.setId(ids[i]);
            glModel.setHobby_status(gh.getHobby_status());
            glModel.setUpdate_adminuser(gh.getUpdate_adminuser());
            this.globalHobbyDao.update(glModel);
          }
        }
      } else if (reg.equals("1")) {
        // 删除之前的中间表数据
        List<GlobalHobbyAttr> ghaList1 = this.globalHobbyAttrDao.get(gh.getId());
        if (ghaList1 != null) {
          this.globalHobbyAttrDao.deleteBatch(ghaList1);
        }
        // 添加新的中间表数据
        String[] levels = gh.getLevel_id().split(",");
        List<GlobalHobbyAttr> ghaList = new ArrayList<GlobalHobbyAttr>();
        for (int i = 0; i < levels.length; i++) {
          GlobalHobbyAttr gha = new GlobalHobbyAttr();
          gha.setLevel_id(levels[i]);
          gha.setHobby_id(gh.getId());
          ghaList.add(gha);
        }
        this.globalHobbyAttrDao.insertBatch(ghaList);

        this.globalHobbyDao.update(gh);
      }
    } catch (Exception e) {
      throw new RuntimeException("GlobalHobby修改不成功");
    }
  }