fix:优化数据统计查询用户组项目统计

This commit is contained in:
2026-03-13 11:09:21 +08:00
parent 58cd804dde
commit 93d84e18b2
4 changed files with 37 additions and 6 deletions

View File

@@ -204,6 +204,9 @@ public class SimulationNodeController implements ISimulationNodeFeignClient {
/**
* 用户组项目统计
* 只统计 经理、负责人、执行人
* simulation_node_member NodeMemberTypeEnum.MANAGER 经理
* simulation_task_member MemberTypeEnum.PRINCIPAL 负责人/ MemberTypeEnum.EXECUTOR
*/
@GetMapping("/getUserGroupProjectStatistics")
@Operation(summary = "用户组项目统计", description = "用户组项目统计")

View File

@@ -87,7 +87,7 @@ public interface SimulationNodeMapper extends BaseMapper<SimulationNode> {
List<SpdmNodeVo> getNodeListByIds(@Param("nodeIdList") List<String> nodeIdList);
List<UserGroupProjectVo> getUserGroupProjectStatistics(@Param("userIds")Set<Long> userIds, @Param("tenantId")Long tenantId);
List<UserGroupProjectVo> getUserGroupProjectStatistics(@Param("userIds")Set<Long> userIds, @Param("tenantId")Long tenantId,@Param("nodeMemberTypeList") List<Integer> nodeMemberTypeList,@Param("taskMemberTypeList") List<Integer> taskMemberTypeList);
List<UserGroupTaskCompleteVo> getUserGroupTaskCompleteStatistics(@Param("req") GetUserGroupTaskCompleteStatisticsReq req);

View File

@@ -2580,8 +2580,7 @@ public class NodeServiceImpl extends ServiceImpl<SimulationNodeMapper, Simulatio
}else {
userIds.add(userId);
}
List<UserGroupProjectVo> userGroupProjectStatistics = this.baseMapper.getUserGroupProjectStatistics(userIds,tenantId );
List<UserGroupProjectVo> userGroupProjectStatistics = this.baseMapper.getUserGroupProjectStatistics(userIds,tenantId, Collections.singletonList(NodeMemberTypeEnum.MANAGER.getCode()), Arrays.asList(MemberTypeEnum.PRINCIPAL.getCode(),MemberTypeEnum.EXECUTOR.getCode()));
if (CollectionUtils.isEmpty(userGroupProjectStatistics)) {
return SdmResponse.success(new ArrayList<>());
}

View File

@@ -419,19 +419,48 @@
)
</select>
<select id="getUserGroupProjectStatistics" resultType="com.sdm.project.model.vo.UserGroupProjectVo">
select distinct nodeId,userId from (
select
nodeId,
user_id as userId
from simulation_node_member
left join simulation_node on simulation_node_member.nodeId = simulation_node.uuid
join simulation_node on simulation_node_member.nodeId = simulation_node.uuid
where
simulation_node.tenantId = #{tenantId}
and
user_id in (
and
simulation_node_member.type in(
<foreach collection="nodeMemberTypeList" item="nodeMemberType" index="index" separator=",">#{nodeMemberType}
</foreach>
)
and
user_id in (
<foreach collection='userIds' item='userId' index='index' separator=','>
#{userId}
</foreach>
)
union
select
simulation_task.tag1 as nodeId,
simulation_task_member.user_id as userId
from simulation_task_member
join simulation_task on simulation_task.uuid = simulation_task_member.task_id
where
simulation_task.tenant_Id = #{tenantId}
and
simulation_task_member.type in(
<foreach collection="taskMemberTypeList" item="taskMemberType" index="index" separator=",">
#{taskMemberType}
</foreach>
)
and
simulation_task_member.user_id in (
<foreach collection='userIds' item='userId' index='index' separator=','>
#{userId}
</foreach>
)
) as tmp
</select>
<select id="getUserGroupTaskCompleteStatistics"