企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# 组件源码 /** * <b>方法描述:</b> hash字段加(整数) <br/> * <b>创建者:</b> admin <br/> * <b>创建时间:</b> 2018-05-09 09:40:37 <br/> * * @param key * 入参|key|{@link java.lang.String} * @param field * 入参|字段名称|{@link java.lang.String} * @param value * 入参|value|{@link long} * @param newvalue * 出参|计算后的新值|{@link long} * @return -1 异常<br/> * 1 成功<br/> */ @Component(label = "hash字段加(整数)", style = "判断型", type = "同步组件", comment = "hash中指定字段y的值增加某个值;key或field不存在,新建并赋值0再加。", version = "1.0.0", deprecated = false, author = "admin", date = "2018-05-09 09:40:37") @InParams(param = { @Param(name = "key", comment = "key", type = java.lang.String.class), @Param(name = "field", comment = "字段名称", type = java.lang.String.class), @Param(name = "value", comment = "value", type = long.class) }) @OutParams(param = { @Param(name = "newvalue", comment = "计算后的新值", type = long.class) }) @Returns(returns = { @Return(id = "-1", desp = "异常"), @Return(id = "1", desp = "成功") }) public static ResultBase P_hincrBy(String key, String field, long value) { try { Long v = redisTemplate.opsForHash().increment(key, field, value); return ResultBase.newSuccessResult(v); } catch (Exception e) { AppLog.error(e); return ResultBase.newExceptionResult("TPTR0006", "hash字段加(整数) 异常:" + AppLog.errorMsg(e)); } } 交易中组件使用方式: ![](https://img.kancloud.cn/e3/1a/e31aefb7f1d82b05dabe617747c5657f_950x750.jpg) ## 参数说明及示例 key:redis中的key,示例: `"qwer"` 加数:加数,示例: `5` 计算后的新值:redis的值加上加数后的结果,示例: `__INNER__["result"]` > 指定key的值增加某个浮点数