企业🤖AI智能体构建引擎,智能编排和调试,一键部署,支持私有化部署方案 广告
# 组件源码 /** * <b>方法描述:</b> 标准数据查询方法(单表) <br/> * <b>创建者:</b> admin <br/> * <b>创建时间:</b> 2019-03-28 15:03:02 <br/> * * @param poolName * 入参|数据源,为空使用默认|{@link java.lang.String} * @param tableName * 入参|表名称|{@link java.lang.String} * @param selectValue * 入参|要查询的列字段名称(可以空,所有列)| * {@link com.ylink.ide.trade.runtime.context.JavaList} * @param conditions * 入参|查询的条件(可以传空) 传入值例子: * {"name":{"in":["zhengSan","liSi","wangWu" * ]},"age":{"between":["20","60"]},"gender":{"=":["男"]} }| * {@link com.ylink.ide.trade.runtime.context.JavaContainer} * @param groupbyValue * 入参|分组查询列名(可以传空) 例如:" ["gender"]" | * {@link com.ylink.ide.trade.runtime.context.JavaList} * @param orderByValue * 入参|排序查询列名(可以传空) 例如:" ["name desc","age asc"]" | * {@link com.ylink.ide.trade.runtime.context.JavaList} * @param rownum * 入参|传入要查询的结果条数,传入小于等于0则查全部|{@link int} * @param num * 出参|输出条数|{@link int} * @param result * 出参|输出结果|{@link com.ylink.ide.trade.runtime.context.JavaList} * @return -1 异常<br/> * 2 无数据<br/> * 1 成功<br/> */ @Component(label = "标准数据查询方法(单表)", style = "判断型", type = "同步组件", comment = "标准数据查询方法", version = "1.0.0", deprecated = false, author = "admin", date = "2019-03-28 03:03:02") @InParams(param = { @Param(name = "poolName", comment = "数据源,为空使用默认", type = java.lang.String.class), @Param(name = "tableName", comment = "表名称", type = java.lang.String.class), @Param(name = "selectValue", comment = "要查询的列字段名称(可以空,所有列)", type = com.ylink.ide.trade.runtime.context.JavaList.class), @Param(name = "conditions", comment = "查询的条件(可以传空) 传入值例子: {'name':{'in':['zhengSan','liSi','wangWu']},'age':{'between':['20','60']},'gender':{'=':['男']} }", type = com.ylink.ide.trade.runtime.context.JavaContainer.class), @Param(name = "groupbyValue", comment = "分组查询列名(可以传空) 例如:' ['gender']' ", type = com.ylink.ide.trade.runtime.context.JavaList.class), @Param(name = "orderByValue", comment = "排序查询列名(可以传空) 例如:' ['name desc','age asc']' ", type = com.ylink.ide.trade.runtime.context.JavaList.class), @Param(name = "rownum", comment = "传入要查询的结果条数,传入小于等于0则查全部", type = int.class) }) @OutParams(param = { @Param(name = "num", comment = "输出条数", type = int.class), @Param(name = "result", comment = "输出结果", type = com.ylink.ide.trade.runtime.context.JavaList.class) }) @Returns(returns = { @Return(id = "-1", desp = "异常"), @Return(id = "2", desp = "无数据"), @Return(id = "1", desp = "成功") }) public static ResultBase P_standardSelect(String poolName, String tableName, JavaList selectValue, JavaContainer conditions, JavaList groupbyValue, JavaList orderByValue, int rownum) { try { JavaList list = JdbcUtil .standardSelect(poolName, tableName, selectValue, conditions, groupbyValue, orderByValue, rownum); int size = list.size(); if (list == null || size < 1) { return new ResultBase(2); } return ResultBase.newSuccessResult(list.size(), list); } catch (Exception e) { AppLog.error(e); return ResultBase.newFailureResult("TPTJ0007", "查询异常 异常:" + AppLog.errorMsg(e)); } } 交易中组件使用方式: ![](https://img.kancloud.cn/68/ce/68ce02d480eaf9d191c210afc7982220_1697x1232.png) 数据源的来源为项目的配置文件中的数据源,以及前端页面上的数据源管理列表中添加的数据源 ## 参数说明及示例 表名称:数据库表名,示例: `"sys_user"` 要查询的列字段名称(可以空,所有列):查询结果需要展示的列,需要填入集合,示例: `["userId" ,"loginname" ,"username" ,"phone" ,"email","deptId","remark" ]` 查询的条件(可以传空):查询条件对象,示例: `{"loginname":{"in":["zhengSan","liSi","wangWu"]},"age":{"between":["20","60"]},"sex":{"=":["男"]} }` 分组查询列名(可以传空):group by传入的参数,示例: `["sex","age"]` 排序查询列名(可以传空):查询语句排序字段,示例: `["loginname desc","age asc"]` 传入要查询的结果条数,传入小于等于0则查全部:定义需要查询多少条数据,示例: `5` 输出条数:输出查询结果条数,示例: `__INNER__["totle"]` 输出结果:输出查询结果,示例: `__INNER__["result"]` > 注意:填写值如果是String字符串,则需要在前后加上英文双引号"",如果是数字或者boolean值,则不需要