ludc
2023-11-08 fb4762049abdca953db1ed4528d128dd8d887710
代码提交
已修改3个文件
36 ■■■■■ 文件已修改
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CommonsMapper.java 2 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java 30 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CommonsMapper.xml 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CommonsMapper.java
@@ -24,6 +24,8 @@
    String queryCountStringBySql(@Param("inSql") String inSql);
    String selectCountByTableName(@Param("tableName") String tableName);
    List<Map> selectBySql(@Param("inSql") String inSql);
    List<Map<String,String>> queryByOnlySqlForMap(@Param("inSql") String inSql);
Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java
@@ -528,7 +528,7 @@
            lcStatus = treeQueryObject.getConditionMap().getOrDefault("lcStatus",null);
        }
        if(StringUtils.isNotBlank(id) || StringUtils.isNotBlank(lcStatus) ){
            String tableName = VciBaseUtil.getTableName(treeQueryObject.getConditionMap().get("btmTypeId"),true);
            String tableName = this.getTableName(treeQueryObject.getConditionMap().get("btmTypeId"),treeQueryObject.getConditionMap().get("id"), treeQueryObject.getConditionMap().get("lcStatus"));
            doList = codeClassifyMapper
                .selectCodeClassifyDOByTree(
                    treeQueryObject.getConditionMap().get("id"),
@@ -537,6 +537,12 @@
                    VciBaseUtil.checkAdminTenant() ? null:AuthUtil.getTenantId(),
                    tableName
                );
            // 证明是查顶层节点
            if(StringUtils.isNotBlank(id)){
                // 有时候查询total过慢会导致无法加载,现在修改查询总数为连表查询但是就导致顶层节点无法查询出总数
                String total = commonsMapper.selectCountByTableName(tableName);
                doList.get(0).setTotal(total);
            }
        }else{
            // 只要前端会传参数过来就不会出现走这句的情况,所以查询总数没在这儿添加
            doList =codeClassifyMapper.selectCodeClassifyVOByTree(
@@ -567,6 +573,28 @@
    }
    /**
     * 分类加载时获取业务类型id,拼接业务类型表名
     * @return
     */
    private String getTableName(String btmTypeId,String id,String lcStatus){
        if(Func.isNotEmpty(btmTypeId)){
            return VciBaseUtil.getTableName(btmTypeId,true);
        }
        LambdaQueryWrapper<CodeClassify> wrapper = Wrappers.<CodeClassify>query()
            .lambda().select(CodeClassify::getBtmTypeId)
            .eq(CodeClassify::getLcStatus, lcStatus)
            .isNotNull(CodeClassify::getBtmTypeId)
            .last("limit 1")
            .eq(CodeClassify::getId,id).isNull(CodeClassify::getParentCodeClassifyOid);
        CodeClassify codeClassify = codeClassifyMapper.selectOne(wrapper);
        if(Func.isEmpty(codeClassify) || Func.isEmpty(codeClassify.getBtmTypeId())){
            throw new ServiceException("查询主数据总数时,未获取到业务类型ID!");
        }
        return VciBaseUtil.getTableName(codeClassify.getBtmTypeId(),true);
    }
    /**
     * 根据树形查询对象来查询数据对象
     *
     * @param treeQueryObject 树形查询对象
Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CommonsMapper.xml
@@ -17,6 +17,10 @@
        ${inSql}
    </select>
    <select id="selectCountByTableName" resultType="java.lang.String">
        select COUNT(*) FROM ${tableName}
    </select>
    <select id="selectBySql" resultType="java.util.Map">
        ${inSql}
    </select>