多应用+插件架构,代码干净,二开方便,首家独创一键云编译技术,文档视频完善,免费商用码云13.8K 广告
# loop方法遍历 loop循环适用于查询数据集`select()、selectForMap()`的结果输出,针对于返回结果List和map进行循环遍历 表达式使用 ```java List<RowData> select = Db.name("tg_task").where("status", 1).select(); Loop.forEach(select, new RowDataCallback<RowData, Integer>() { @Override public void onData(RowData data, Integer index) { data.set("qq","123"); } }); 或 Map<Integer, RowData> integerRowDataMap = Db.name("tg_task").where("status", 1).selectForMap(); Loop.forEach(integerRowDataMap, new RowDataCallback<RowData, Integer>() { @Override public void onData(RowData data, Integer index) { data.set("qq","123"); } }); ``` 运行结果 ```java { "code": 1, "msg": "success", "data": [ { "qq": "123", "id": "1" }, { "qq": "123", "id": "9" } ] } 或 { "code": 1, "msg": "success", "data": { "1": { "qq": "123", "id": "1" }, "2": { "qq": "123", "id": "2" } } } ```