Exemplo n.º 1
0
  @Override
  @Transactional
  public long addUser(final User user) {
    try {
      // 添加用户记录
      long userId = (Long) this.sqlMapClientTemplate.insert("tbl_user.addUser", user);
      user.setUserId(userId);

      Map<String, Object> params = new HashMap<String, Object>();
      params.put("userIds", new long[] {user.getUserId()});

      return userId;

    } catch (DuplicateKeyException e) {
      throw new RpcException("用户名或邮箱重复", e);
    } catch (Exception e) {
      throw new RpcException("添加用户出错", e);
    }
  }