ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# 组件源码 /** * <b>方法描述:</b> 设置列表元素(按下标) <br/> * <b>创建者:</b> admin <br/> * <b>创建时间:</b> 2018-05-09 09:57:18 <br/> * * @param key * 入参|key|{@link java.lang.String} * @param index * 入参|下标|{@link long} * @param value * 入参|值|{@link java.lang.String} * @return -1 异常<br/> * 1 成功<br/> */ @Component(label = "设置列表元素(按下标)", style = "判断型", type = "同步组件", comment = "index 位置的list元素的值为 value", version = "1.0.0", deprecated = false, author = "admin", date = "2018-05-09 09:57:18") @InParams(param = { @Param(name = "key", comment = "key", type = java.lang.String.class), @Param(name = "index", comment = "下标", type = long.class), @Param(name = "value", comment = "值", type = java.lang.String.class) }) @Returns(returns = { @Return(id = "-1", desp = "异常"), @Return(id = "1", desp = "成功") }) public static ResultBase P_lset(String key, long index, String value) { try { redisTemplate.opsForList().set(key, index, value); } catch (Exception e) { AppLog.error(e); return ResultBase.newExceptionResult("TPTR2007", "设置列表元素(按下标) 异常:" + AppLog.errorMsg(e)); } return ResultBase.newSuccessResult(); } 交易中组件使用方式: ![](https://img.kancloud.cn/6a/d0/6ad0b80c083d4690d00898f1f8ca17aa_950x750.jpg) ## 参数说明及示例 key:redis中的key,示例: `"qwer"` 下标:List数据的下标值,示例: `4` 值:设置redis对应key的list中对应下标的值,示例: `"ceshi"` > index 位置的list元素的值为 value