1
0
forked from erp-dev/erp

feat: change param_valueto 'like' search for by-process-node

This commit is contained in:
2026-02-06 20:52:43 +08:00
parent 6a638e56cf
commit 72597ce81f
3 changed files with 30 additions and 2 deletions

View File

@@ -4,6 +4,7 @@ from django.utils import timezone
from django.db import transaction
from django.db import models as django_models
from django.db.models import Q, Count, CharField, Prefetch, Exists, OuterRef, Subquery
from django.db.models.fields.json import KeyTextTransform
from django.db.models.functions import Cast, Coalesce
from rest_framework import serializers, status, permissions
from rest_framework.pagination import LimitOffsetPagination
@@ -577,7 +578,11 @@ class PlateOrderByProcessNodeView(APIView):
business_object_id=OuterRef('business_object_id'),
state_id=target_state_id,
is_cancelled=False,
parameter_records__parameters__contains={param_key: param_value},
parameter_records__parameters__has_key=param_key,
).annotate(
_param_value=KeyTextTransform(param_key, 'parameter_records__parameters')
).filter(
_param_value__icontains=param_value,
)
queryset = queryset.annotate(_has_state_param=Exists(matching_logs)).filter(_has_state_param=True)