Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/entity/CodeClassify.java
@@ -123,4 +123,10 @@ @TableField(exist = false) private String idPath; /** * 该分类下主数据总数 */ @TableField(exist = false) private String total; } Source/UBCS/ubcs-service-api/ubcs-code-api/src/main/java/com/vci/ubcs/code/vo/pagemodel/CodeClassifyVO.java
@@ -86,4 +86,6 @@ */ private String codeResembleRuleOidName; private String total; } Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/revision/service/RevisionModelUtil.java
@@ -57,6 +57,7 @@ }); tree.setOid((String)oidValues.stream().collect(Collectors.joining(wrapperOptions.getOidValueSep()))); tree.setName((String) VciBaseUtil.getValueFromField("name", doObject)); tree.setCount("("+(String)VciBaseUtil.getValueFromField("total", doObject)+")"); if (f != null) { tree.setText((String)f.apply(doObject)); } else { Source/UBCS/ubcs-service-api/ubcs-util-api/src/main/java/com/vci/ubcs/starter/web/pagemodel/Tree.java
@@ -14,6 +14,7 @@ private static final long serialVersionUID = 6886695271635257882L; private String oid; private String text; private String count; private String name; private boolean leaf = false; private boolean showCheckbox = false; @@ -37,6 +38,14 @@ this.setText(text); } public String getCount() { return count; } public void setCount(String count) { this.count = count; } public String getOid() { return this.oid; } Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/mapper/CodeClassifyMapper.java
@@ -74,7 +74,7 @@ * * @return 数据集合 */ List<CodeClassify> selectCodeClassifyDOByTree(@Param("id") String id,@Param("lcstatus") String lcstatus,@Param("parentcodeclassifyoid") String parentcodeclassifyoid,@Param("tenantId") String tenantId); List<CodeClassify> selectCodeClassifyDOByTree(@Param("id") String id,@Param("lcstatus") String lcstatus,@Param("parentcodeclassifyoid") String parentcodeclassifyoid,@Param("tenantId") String tenantId,@Param("tableName") String tableName); /** * 查询数据与PL_CODE_KEYATTRREPEAT、PL_CODE_RESEMBLERULE、PL_CODE_RULE联查 Source/UBCS/ubcs-service/ubcs-code/src/main/java/com/vci/ubcs/code/service/impl/CodeClassifyServiceImpl.java
@@ -2,6 +2,7 @@ import com.alibaba.nacos.common.utils.StringUtils; import com.baomidou.mybatisplus.core.conditions.Wrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.core.toolkit.Wrappers; @@ -13,6 +14,7 @@ import com.vci.ubcs.code.enumpack.FrameworkDataLCStatus; import com.vci.ubcs.code.mapper.CodeClassifyMapper; import com.vci.ubcs.code.mapper.CodeClassifyTemplateMapper; import com.vci.ubcs.code.mapper.CommonsMapper; import com.vci.ubcs.code.po.CodeClassifyPO; import com.vci.ubcs.code.service.ICodeClassifyService; import com.vci.ubcs.code.service.ICodeKeyAttrRepeatService; @@ -69,6 +71,7 @@ import java.util.stream.Stream; import static com.vci.ubcs.code.constant.FrameWorkDefaultValueConstant.*; import static com.vci.ubcs.starter.web.util.VciBaseUtil.getTableName; @Service public class CodeClassifyServiceImpl extends ServiceImpl<CodeClassifyMapper, CodeClassify> implements ICodeClassifyService { @@ -84,6 +87,9 @@ @Resource private IBtmTypeClient btmTypeClient; @Resource private CommonsMapper commonsMapper; /** * 日志 @@ -522,20 +528,21 @@ lcStatus = treeQueryObject.getConditionMap().getOrDefault("lcStatus",null); } if(StringUtils.isNotBlank(id) || StringUtils.isNotBlank(lcStatus) ){ String tableName = this.getTableName(treeQueryObject.getParentOid(),treeQueryObject.getConditionMap().get("id"), treeQueryObject.getConditionMap().get("lcStatus")); doList = codeClassifyMapper .selectCodeClassifyDOByTree(treeQueryObject.getConditionMap().get("id"),treeQueryObject.getConditionMap().get("lcStatus"),treeQueryObject.getParentOid(), AuthUtil.getTenantId() .equals( NacosConfigCache .getAdminUserInfo() .getTenantId() ) ? null:AuthUtil.getTenantId()); .selectCodeClassifyDOByTree( treeQueryObject.getConditionMap().get("id"), treeQueryObject.getConditionMap().get("lcStatus"), treeQueryObject.getParentOid(), VciBaseUtil.checkAdminTenant() ? null:AuthUtil.getTenantId(), tableName ); }else{ doList =codeClassifyMapper.selectCodeClassifyVOByTree(treeQueryObject.getParentOid(), AuthUtil.getTenantId() .equals( NacosConfigCache .getAdminUserInfo() .getTenantId() ) ? null:AuthUtil.getTenantId()); // 只要前端会传参数过来就不会出现走这句的情况,所以查询总数没在这儿添加 doList =codeClassifyMapper.selectCodeClassifyVOByTree( treeQueryObject.getParentOid(), VciBaseUtil.checkAdminTenant() ? null:AuthUtil.getTenantId() ); } List<CodeClassifyVO> voList = codeClassifyDO2VOs(doList); TreeWrapperOptions treeWrapperOptions = new TreeWrapperOptions(PARENT_FIELD_NAME); @@ -545,6 +552,7 @@ return s.getId() + " " + s.getName() + (FrameworkDataLCStatus.DISABLED.getValue().equalsIgnoreCase(s .getLcStatus()) ? (" 【停用】 ") : ""); }); Iterator var6 = tree.listIterator(); while(var6.hasNext()){ Tree trees = (Tree) var6.next(); @@ -559,6 +567,28 @@ } /** * 分类加载时获取业务类型id,拼接业务类型表名 * @return */ private String getTableName(String parentCodeClassifyOid,String id,String lcStatus){ LambdaQueryWrapper<CodeClassify> wrapper = Wrappers.<CodeClassify>query() .lambda().select(CodeClassify::getBtmTypeId) .eq(CodeClassify::getLcStatus, lcStatus) .isNotNull(CodeClassify::getBtmTypeId) .last("limit 1"); if(Func.isNotBlank(id)){ wrapper.eq(CodeClassify::getId,id).isNull(CodeClassify::getParentCodeClassifyOid); }else{ wrapper.eq(CodeClassify::getParentCodeClassifyOid,parentCodeClassifyOid); } CodeClassify codeClassify = codeClassifyMapper.selectOne(wrapper); if(Func.isEmpty(codeClassify) || Func.isEmpty(codeClassify.getBtmTypeId())){ throw new ServiceException("查询主数据总数时,未获取业务类型ID!"); } return VciBaseUtil.getTableName(codeClassify.getBtmTypeId().toLowerCase(Locale.ROOT),true); } /** * 根据树形查询对象来查询数据对象 * * @param treeQueryObject 树形查询对象 Source/UBCS/ubcs-service/ubcs-code/src/main/resources/mapper/CodeCLassifyMapper.xml
@@ -38,6 +38,7 @@ <result column="CODEKEYATTRREPEATOID" property="codeKeyAttrRepeatOid"/> <result column="CODERESEMBLERULEOID" property="codeResembleRuleOid"/> <result column="TENANT_ID" property="tenantId"/> <result column="TOTAL" property="total"/> </resultMap> <sql id="tableName"> @@ -294,7 +295,28 @@ codeclassify0.TENANT_ID as tenantId , coderuleoid.name as codeRuleOidName, codekeyattrrepeatoid.name as codeKeyAttrRepeatOidName, coderesembleruleoid.name as codeResembleRuleOidName coderesembleruleoid.name as codeResembleRuleOidName, ( SELECT COUNT(*) FROM PLBT_CODE_part WHERE CODECLSFID IN ( SELECT oid FROM PL_CODE_CLASSIFY WHERE lcstatus = 'Enabled' START WITH OID = codeclassify0.OID CONNECT BY PRIOR OID = parentCodeClassifyOid ) AND lastr = '1' AND lastv = '1' ) AS total from pl_code_classify codeclassify0 left join pl_code_rule coderuleoid on codeclassify0.codeRuleOid = coderuleoid.oid @@ -504,6 +526,7 @@ start with oid = #{oid} connect by prior oid = parentcodeclassifyoid; </select> <select id="selectAllParenClassifytByOid" resultMap="plCodeClassifyResultMap"> select codeclassify0.OWNER as owner, codeclassify0.BTMTYPEID as btmtypeid,