ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# 组件源码 /** * <b>方法描述:</b> 设置字段值(覆盖) <br/> * <b>创建者:</b> admin <br/> * <b>创建时间:</b> 2018-05-09 09:41:02 <br/> * * @param key * 入参|key|{@link java.lang.String} * @param field * 入参|字段|{@link java.lang.String} * @param value * 入参|value|{@link java.lang.String} * @return -1 异常<br/> * 1 成功<br/> */ @Component(label = "设置字段值(覆盖)", style = "判断型", type = "同步组件", comment = "key不存在,则创建一个新的hash表;如果该字段已经存在,那么将会更新该字段的值;字段不存,则新建", version = "1.0.0", deprecated = false, author = "admin", date = "2018-05-09 09:41:02") @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 = java.lang.String.class) }) @Returns(returns = { @Return(id = "-1", desp = "异常"), @Return(id = "1", desp = "成功") }) public static ResultBase P_hset(String key, String field, String value) { try { redisTemplate.opsForHash().put(key, field, value); } catch (Exception e) { AppLog.error(e); return ResultBase.newExceptionResult("TPTR1001", "设置字段值(覆盖) 异常:" + AppLog.errorMsg(e)); } return ResultBase.newSuccessResult(); } 交易中组件使用方式: ![](https://img.kancloud.cn/0f/3c/0f3c1a1f10df76e7155ef96e745e91ec_1319x1139.jpg) ## 参数说明及示例 key:redis中的key,示例: `"test"` 字段:覆盖设值的字段名,示例: `"label"` value:新的字段值,示例: `"new value"` > key不存在,则创建一个新的hash表;如果该字段已经存在,那么将会更新该字段的值;字段不存,则新建