💎一站式轻松地调用各大LLM模型接口,支持GPT4、智谱、星火、月之暗面及文生图 广告
# 组件源码 /** * <b>方法描述:</b> 批量获取字段值 <br/> * <b>创建者:</b> admin <br/> * <b>创建时间:</b> 2020-06-10 15:12:25 <br/> * * @param key * 入参|key|{@link java.lang.String} * @param fields * 入参|字段列表|{@link java.util.List} * @param values * 出参|值列表|{@link java.util.List} * @return -1 异常<br/> * 1 成功<br/> */ @Component(label = "批量获取字段值", style = "判断型", type = "同步组件", comment = "获取多个字段的值,若字段不存在,则其值为nil", version = "1.0.0", deprecated = false, author = "admin", date = "2020-06-10 03:12:25") @InParams(param = { @Param(name = "key", comment = "key", type = java.lang.String.class), @Param(name = "fields", comment = "字段列表", type = java.util.List.class) }) @OutParams(param = { @Param(name = "values", comment = "值列表", type = java.util.List.class) }) @Returns(returns = { @Return(id = "-1", desp = "异常"), @Return(id = "1", desp = "成功") }) public static ResultBase P_hmget(String key, List fields) { try { List list = redisTemplate.opsForHash().multiGet(key, fields); return ResultBase.newSuccessResult(list); } catch (Exception e) { AppLog.error(e); return ResultBase.newExceptionResult("TPTR1007", "批量获取字段值 异常:" + AppLog.errorMsg(e)); } } 交易中组件使用方式: ![](https://img.kancloud.cn/bf/12/bf12a6d2e1c272ec447b87e21a92991d_1524x1135.jpg) ## 参数说明及示例 key:redis中的key,示例: `"test"` 字段列表:需要获取值的字段集合,示例: `["qwer","asdf"]` 值列表:字段值集合,示例: `__INNER__["result"]` > 获取多个字段的值,若字段不存在,则其值为null