🔥码云GVP开源项目 12k star Uniapp+ElementUI 功能强大 支持多语言、二开方便! 广告
# 组件源码 /** * <b>方法描述:</b> 删除字段 <br/> * <b>创建者:</b> admin <br/> * <b>创建时间:</b> 2020-06-10 15:19:41 <br/> * * @param key * 入参|key|{@link java.lang.String} * @param fields * 入参|字段列表|{@link java.util.List} * @param cnt * 出参|删除条数|long * @return -1 异常<br/> * 0 失败<br/> * 1 成功<br/> */ @Component(label = "删除字段", style = "判断型", type = "同步组件", comment = "删除指定字段列表", version = "1.0.0", deprecated = false, author = "admin", date = "2020-06-10 03:19:41") @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 = "cnt", comment = "删除条数", type = long.class) }) @Returns(returns = { @Return(id = "-1", desp = "异常"), @Return(id = "0", desp = "失败"), @Return(id = "1", desp = "成功") }) public static ResultBase P_hdel(String key, List fields) { try { long cnt = redisTemplate.opsForHash().delete(key, fields.toArray()); return ResultBase.newSuccessResult(cnt); } catch (Exception e) { AppLog.error(e); return ResultBase.newExceptionResult("TPTR1010", "删除字段 异常:" + AppLog.errorMsg(e)); } } 交易中组件使用方式: ![](https://img.kancloud.cn/74/90/74900f33da5039fbe64a22ab6bc9ded7_1577x1151.jpg) ## 参数说明及示例 key:redis中的key,示例: `"123qwer"` 字段列表:需要删除的key中的字段集合,示例: `["qwer","asdf"]` 删除条数:redis中删除的数据条数,示例: `__INNER__["result"]`