fix(产品模块): 模块处的需求数量统计错误

计算产品需求的配置项模块的所有需求时,通过数据库查询不包含无所属模块以及非固定模块的需求数量来统计

Signed-off-by: OTTO <731554297@qq.com>
This commit is contained in:
OTTO 2025-02-17 17:31:33 +08:00
parent 4058e652a0
commit efa45f7d79
5 changed files with 27 additions and 11 deletions

View File

@ -117,4 +117,6 @@ public interface PmsProductRequirementMapper
List<ReqStatusStatVo> selectReqCountGroupByStatus(@Param("pmsProductIdentifier") String pmsProductIdentifier, @Param("statusList") List<String> statusList);
PmsProductRequirement selectReqSpecsByProjectReqId(@Param("projectReqId") Long projectReqId);
Integer selectNotIncludeNoModuleAndFixedProductReqSpecsCount(@Param("pmsProductIdentifier") String pmsProductIdentifier);
}

View File

@ -136,4 +136,12 @@ public interface IPmsProductRequirementService
int batchUpdatePmsProductRequirement(JSONObject pmsProductRequirementBatchUpdateVo);
int updateRequirement(PmsProductRequirement pmsProductRequirement);
/**
* 查询不包含无所属模块和固定模块的需求数量
*
* @param pmsProductIdentifier 产品标识
* @return 需求数量
*/
Integer selectNotIncludeNoModuleAndFixedProductReqSpecsCount(String pmsProductIdentifier);
}

View File

@ -286,23 +286,16 @@ public class PmsProductModuleServiceImpl implements IPmsProductModuleService
} else {
pmsProductService.selectPmsProductByIdentifier(pmsProductModule.getPmsProductIdentifier());
}
Integer allNodeDataCount = 0;
Integer allNodeDataCount;
Integer noModuleNodeDataCount;
if (type == PmsConstants.PRODUCT_TAG_AND_MODULE_TYPE) {
// 设置各节点数量为需求数量
for (PmsProductModule module : moduleList) {
module.setNodeDataCount(module.getRequirementCount());
// 全部需求数量统计需排除固定模块以及无所属模块
if (module.getParentId().equals(0L) && !module.getIsFixedModule()) {
allNodeDataCount += module.getRequirementCount();
}
}
moduleList.forEach(x -> x.setNodeDataCount(x.getRequirementCount()));
// 计算全部需求数量
PmsProductRequirement pmsProductRequirementSearch = new PmsProductRequirement();
pmsProductRequirementSearch.setPmsProductIdentifier(pmsProductModule.getPmsProductIdentifier());
allNodeDataCount = pmsProductRequirementService.selectNotIncludeNoModuleAndFixedProductReqSpecsCount(pmsProductModule.getPmsProductIdentifier());
// 计算无所属模块的需求数量
PmsProductRequirement pmsProductRequirementSearch = new PmsProductRequirement();
pmsProductRequirementSearch.setPmsProductModuleId(0L);
noModuleNodeDataCount = pmsProductRequirementService.selectProductReqSpecsCount(pmsProductRequirementSearch);
} else if (type == PmsConstants.TESTSHEET_TAG_AND_MODULE_TYPE) {

View File

@ -936,4 +936,9 @@ public class PmsProductRequirementServiceImpl implements IPmsProductRequirementS
pmsProductService.updatePmsProductChange(pmsProductRequirement.getPmsProductIdentifier());
return pmsProductRequirementMapper.updatePmsProductRequirement(pmsProductRequirement);
}
@Override
public Integer selectNotIncludeNoModuleAndFixedProductReqSpecsCount(String pmsProductIdentifier) {
return pmsProductRequirementMapper.selectNotIncludeNoModuleAndFixedProductReqSpecsCount(pmsProductIdentifier);
}
}

View File

@ -393,4 +393,12 @@
</foreach>
group by `status`
</select>
<select id="selectNotIncludeNoModuleAndFixedProductReqSpecsCount" resultType="java.lang.Integer">
select count(1)
from pms_product_requirement ppr
left join pms_product_module ppm on ppr.pms_product_module_id = ppm.id
where ppr.pms_product_identifier = #{pmsProductIdentifier}
and ppr.pms_product_module_id is not null
and ppm.is_fixed_module = false;
</select>
</mapper>