企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# 组件源码 /** * <b>方法描述:</b> 批量设置字段值 <br/> * <b>创建者:</b> admin <br/> * <b>创建时间:</b> 2018-05-09 09:44:47 <br/> * * @param key * 入参|key|{@link java.lang.String} * @param map * 入参|field:value列表|{@link java.util.Map} * @return -1 异常<br/> * 1 成功<br/> */ @Component(label = "批量设置字段值", style = "判断型", type = "同步组件", comment = "设置多个字段和值,如果字段存在,则覆盖", version = "1.0.0", deprecated = false, author = "admin", date = "2018-05-09 09:44:47") @InParams(param = { @Param(name = "key", comment = "key", type = java.lang.String.class), @Param(name = "map", comment = "field:value列表", type = java.util.Map.class) }) @Returns(returns = { @Return(id = "-1", desp = "异常"), @Return(id = "1", desp = "成功") }) public static ResultBase P_hmset(String key, Map<String, String> map) { try { redisTemplate.opsForHash().putAll(key, map); } catch (Exception e) { AppLog.error(e); return ResultBase.newExceptionResult("TPTR1006", "批量设置字段值 异常:" + AppLog.errorMsg(e)); } return ResultBase.newSuccessResult(); } 交易中组件使用方式: ![](https://img.kancloud.cn/c9/30/c930a4f8f9892e6f7f8ab5e8eaf84261_1517x1131.jpg) ## 参数说明及示例 key:redis中的key,示例: `"test"` field:value列表:键值对格式批量传递需要设置的值,示例: `{ "label1":"value", "label2":"valuew" }` > 设置多个字段和值,如果字段存在,则覆盖