热乎的蠢代码

文章展示了名为`countErr`的方法,其中包含了一个查询和更新数据库记录的过程,通过多次查询以提高效率。代码涉及到`DfCatalogueEntity`对象和`docbaseService`的文件实体查询,以及`queryDictType`函数用于获取字典类型数据。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

热乎的蠢代码

我不想说了,大家自己看吧。

  @Test
    public void countErr() {
        int number = 1;
        Page<DfCatalogueEntity> page = new Page();
        page.setSize(1000);
        page.setTotal(number);
        Page<DfCatalogueEntity> page1 = idfCatalogueService.page(page);
        List<DfCatalogueEntity> records = page1.getRecords();
        for (DfCatalogueEntity dfCatalogue : records) {
            LySDocbaseEntity entity = docbaseService.selectFileEntity(dfCatalogue.getFileId());
            if (ObjectUtils.isEmpty(entity)){
                log.info(dfCatalogue.getFileId()+dfCatalogue.getCataName()+"概述表中未能找到");
                continue;
            }
            String cqly=entity.getDjlx()+"_"+ entity.getCqly();
            DictDataTypeDTO dto = new DictDataTypeDTO();
            dto.setDictName(cqly);
            List<DictDataVO> dictDataVOS = dossierManageService.queryDictType(dto);
            for (DictDataVO dictDataVO : dictDataVOS) {
                if (dictDataVO.getDictLabel().equals(dfCatalogue.getCataName())) {
                    dfCatalogue.setOrderNo(dictDataVO.getDictSort());
                }
            }
            dictDataVOS.forEach(m->{
                if (m.getDictLabel().equals(dfCatalogue.getCataName())&&m.getDictSort().equals(dfCatalogue.getOrderNo())){
                    dfCatalogue.setOrderNo(m.getDictSort());
                    idfCatalogueService.updateById(dfCatalogue);
                    log.error(dfCatalogue.getFileId()+dfCatalogue.getCataId()+"更新序号");
                }
            });


            }
        }

秉承能查多次,就查多次!

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值