任务管理删除

This commit is contained in:
zhangheng 2025-01-21 15:52:44 +08:00
parent 3fc17aec6e
commit 5c61ae2e2f
3 changed files with 24 additions and 4 deletions

View File

@ -239,4 +239,12 @@ public interface SignPatientManageRouteNodeMapper {
* @return SignPatientManageRouteNode
*/
List<SignPatientManageRouteNode> selectSameManageRouteNodeIdByRouteIds(List<Long> ids);
/**
* 查询节点id的路径id
*
* @param ids
* @return Long
*/
List<Long> selectManageRouteIdByIds(Long[] ids);
}

View File

@ -741,17 +741,22 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
if (deleteNodeCount < 0) {
return AjaxResult.error("删除失败,请联系管理员!");
}
List<Long> manageRouteIdByIds = signPatientManageRouteNodeMapper.selectManageRouteIdByIds(ids);
//根据节点ids查询同路径的节点ids
List<SignPatientManageRouteNode> signPatientManageRouteNodes = signPatientManageRouteNodeMapper.selectSameManageRouteNodeIdByNodeIds(ids);
//无同级节点id
List<Long> noSameLevelNodeIds = new ArrayList<>();
//有同级节点且同级节点状态不为0不删除上级路径
for (Long aLong : ids) {
List<SignPatientManageRouteNode> collect = signPatientManageRouteNodes.stream().filter(Objects::nonNull).filter(item -> item.getId().equals(aLong)).collect(Collectors.toList());
for (Long aLong : manageRouteIdByIds) {
List<SignPatientManageRouteNode> collect = signPatientManageRouteNodes.stream().filter(Objects::nonNull).filter(item -> item.getManageRouteId().equals(aLong)).collect(Collectors.toList());
if (CollectionUtils.isEmpty(collect) || collect.size() == 0) {
noSameLevelNodeIds.add(aLong);
}
}
//都存在同级节点返回不删除其他数据
if (CollectionUtils.isEmpty(noSameLevelNodeIds) || noSameLevelNodeIds.size() == 0) {
return AjaxResult.success();
}
//无同级节点查询上级路径 signPatientManageRoutes 上级路径ids
List<SignPatientManageRoute> signPatientManageRoutes = signPatientManageRouteMapper.selectRouteByNodeIds(noSameLevelNodeIds);
if (CollectionUtils.isEmpty(signPatientManageRoutes) || signPatientManageRoutes.size() == 0) {
@ -764,9 +769,9 @@ public class SignPatientManageRouteServiceImpl implements ISignPatientManageRout
//List<SignPatientManageRoute> patientManageRouteIds = new ArrayList<>();
//上级为主路径查询是否有子路径上级为子路径继续查询同级信息
for (SignPatientManageRoute signPatientManageRoute : signPatientManageRoutes) {
if (Objects.nonNull(signPatientManageRoute.getParentRouteId())) {
if (Objects.nonNull(signPatientManageRoute.getParentRouteId()) && signPatientManageRoute.getParentRouteId() != 0) {
patientManageRouteIds.add(signPatientManageRoute.getId());
} else {
} else if (Objects.isNull(signPatientManageRoute.getParentRouteId()) || signPatientManageRoute.getParentRouteId() == 0) {
manageRouteIds.add(signPatientManageRoute.getId());
}
}

View File

@ -1390,4 +1390,11 @@
#{id}
</foreach>
</select>
<select id="selectManageRouteIdByIds" resultType="java.lang.Long">
select manage_route_id from sign_patient_manage_route_node where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</select>
</mapper>