ThinkChat2.0新版上线,更智能更精彩,支持会话、画图、阅读、搜索等,送10W Token,即刻开启你的AI之旅 广告
# 组件源码 /** * <b>方法描述:</b> 行数统计 <br/> * <b>创建者:</b> admin <br/> * <b>创建时间:</b> 2018-06-20 17:22:57 <br/> * * @param poolName * 入参|数据源|{@link java.lang.String} * @param table * 入参|表名|{@link java.lang.String} * @param conditions * 入参|条件(可为空)| * {@link com.ylink.ide.trade.runtime.context.JavaContainer} * @param cnt * 出参|行数|long * @return 0 失败<br/> * 1 成功<br/> */ @Component(label = "行数统计", style = "判断型", type = "同步组件", comment = "根据查询条件统计数据行数", version = "1.0.0", deprecated = false, author = "admin", date = "2018-06-20 05:22:57") @InParams(param = { @Param(name = "poolName", comment = "数据源", type = java.lang.String.class), @Param(name = "table", comment = "表名", type = java.lang.String.class), @Param(name = "conditions", comment = "条件(可为空)", type = com.ylink.ide.trade.runtime.context.JavaContainer.class) }) @OutParams(param = { @Param(name = "cnt", comment = "行数", type = long.class) }) @Returns(returns = { @Return(id = "0", desp = "失败"), @Return(id = "1", desp = "成功") }) public static ResultBase P_count(String poolName, String table, JavaContainer conditions) { try { long cnt = JdbcUtil.count(poolName, table, conditions); return ResultBase.newSuccessResult(cnt); } catch (Exception e) { AppLog.error(e); return ResultBase.newExceptionResult("TPTJ0022", "行数统计查询 异常:" + AppLog.errorMsg(e)); } } 交易中组件使用方式: ![](https://img.kancloud.cn/b1/3e/b13e26a44e659dfb8c93da5baa4c1c33_1576x1166.jpg) 数据源的来源为项目的配置文件中的数据源,以及前端页面上的数据源管理列表中添加的数据源 ## 参数说明及示例 表名:数据库表名,示例: `"sys_user"` 条件(可为空):查询条件,为空时查询全表数据,示例: `{"name":{"in":["zhengSan","liSi","wangWu"]},"age":{"between":["20","60"]}, "gender":{"=":["男"]} }` 行数:根据查询条件得到的结果条数,示例: `__INNER__["cnt"]` > 注意:填写值如果是String字符串,则需要在前后加上英文双引号"",如果是数字或者boolean值,则不需要