找回密码
 注册账号

QQ登录

只需一步,快速开始

手机号码,快捷登录

手机号码,快捷登录

初学者课程:T3自学|T6自学|U8自学软件下载课件下载工具下载资料:通资料|U8资料|NC|培训|年结积分规则 | 使用常见问题Q&A
知识库:U8 | | NC | U9 | OA | 政务U8|U9|NCC|NC65|NC65客开|NCC客开新手必读 | 任务 | 快速增金币用友QQ群[微信群]
查看: 8158|回复: 2

[学习] 如何分批执行insql 查询语句,解决输入参数多的问题。

[复制链接]
发表于 2020-12-27 12:55:19 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。

您需要 登录 才可以下载或查看,没有账号?注册账号

×

InSqlBatchCaller caller = new InSqlBatchCaller(cuserids);
      caller.execute(new IInSqlBatchCallBack()
      {
        public Object doWithInSql(String inSql) throws BusinessException, SQLException
        {
          String sql = "cuserid in " + inSql;
          Collection col = qry.retrieveByClause(UserVO.class, sql, UserMatcher.SUPPORTED_FIELDS);
          withinList.addAll(col);
          return null;
        } } );



示例:
public List<UserVO> matchWithin(String[] cuserids, String matchString) throws BusinessException {
    final IUAPQueryBS qry = (IUAPQueryBS)NCLocator.getInstance().lookup(IUAPQueryBS.class);
    final List withinList = new ArrayList();
    try
    {
      InSqlBatchCaller caller = new InSqlBatchCaller(cuserids);
      caller.execute(new IInSqlBatchCallBack()
      {
        public Object doWithInSql(String inSql) throws BusinessException, SQLException
        {
          String sql = "cuserid in " + inSql;
          Collection col = qry.retrieveByClause(UserVO.class, sql, UserMatcher.SUPPORTED_FIELDS);
          withinList.addAll(col);
          return null;
        } } );
    }
    catch (Exception e) {
      throw new BusinessException(e);
    }

    List resultList = new ArrayList();

    for (UserVO uvo : withinList) {
      for (String field : SUPPORTED_FIELDS) {
        if (matches(uvo, field, matchString)) {
          resultList.add(uvo);

          break;
        }
      }
    }

    return resultList;
  }

 楼主| 发表于 2022-3-30 15:37:04 | 显示全部楼层
批量查询物料的最近采购价:

select * From (
select po.vbillcode,po.dbilldate, pob.nqtorigtaxprice,pob.pk_material,
        row_number() over(partition by pob.pk_material order by po.dbilldate desc) rn
from po_order_b pob
inner join po_order po on pob.pk_order =po.pk_order
where po.dr=0 and pob.dr=0
) where rn=1
回复 点赞 拍砖

使用道具 举报

 楼主| 发表于 2022-6-23 11:33:47 | 显示全部楼层
nc.vo.trade.sqlutil.InSqlBatchCaller  类全名
回复 点赞 拍砖

使用道具 举报

您需要登录后才可以回帖 登录 | 注册账号

本版积分规则

QQ|站长微信|Archiver|手机版|小黑屋|用友之家 ( 蜀ICP备07505338号|51072502110008 )

GMT+8, 2024-6-11 20:29 , Processed in 0.022057 second(s), 8 queries , Gzip On, Redis On.

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表