ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# 组件源码 /** * <b>方法描述:</b> 集合排序(正序) <br/> * <b>创建者:</b> admin <br/> * <b>创建时间:</b> 2018-05-09 10:35:53 <br/> * * @param key * 入参|key|{@link java.lang.String} * @param list * 出参|排序后的集合|{@link java.util.List} * @return -1 异常<br/> * 1 成功<br/> */ @Component(label = "集合排序(正序)", style = "判断型", type = "同步组件", comment = "集合,有序集合,或者列表的value进行排序。默认情况下排序只对数字排序", version = "1.0.0", deprecated = false, author = "admin", date = "2018-05-09 10:35:53") @InParams(param = { @Param(name = "key", comment = "key", type = java.lang.String.class) }) @OutParams(param = { @Param(name = "list", comment = "排序后的集合", type = java.util.List.class) }) @Returns(returns = { @Return(id = "-1", desp = "异常"), @Return(id = "1", desp = "成功") }) public static ResultBase P_sort(String key) { try { List<Object> list=redisTemplate.sort(SortQueryBuilder.sort(key).build()); return ResultBase.newSuccessResult(list); } catch (Exception e) { AppLog.error(e); return ResultBase.newExceptionResult("TPTR3019", "key 不是集合或者列表,不支持排序:" + e.getMessage()); } } 交易中组件使用方式: ![](https://img.kancloud.cn/d7/1a/d71a496735e915a1464680f99b33e5a2_1146x750.jpg) ## 参数说明及示例 key:redis中的key,示例: `"qwer"` 排序后的集合:返回排序后的redis集合,示例: `__INNER__["redisResult"]` > 集合,有序集合,或者列表的value进行排序。默认情况下排序只对数字排序