更新了软删除

This commit is contained in:
27942
2025-12-31 14:17:33 +08:00
parent 8aeac4c208
commit 5d01b85f48
2 changed files with 40 additions and 28 deletions

View File

@@ -155,7 +155,7 @@ class EditRegistration(APIView):
return Response({'status': 'error', 'message': '缺少参数', 'code': 1}, status=status.HTTP_400_BAD_REQUEST)
try:
pre = PreFiling.objects.get(id=id)
pre = PreFiling.objects.get(id=id, is_deleted=False)
except PreFiling.DoesNotExist:
return Response({'status': 'error', 'message': '预立案登记不存在', 'code': 1}, status=status.HTTP_404_NOT_FOUND)
@@ -330,7 +330,10 @@ class ProjectDetail(APIView):
user_agents_page = paginator.page(paginator.num_pages)
data = []
for info in user_agents_page.object_list:
pre = PreFiling.objects.get(id=info.user_id)
try:
pre = PreFiling.objects.get(id=info.user_id, is_deleted=False)
except PreFiling.DoesNotExist:
continue # 跳过已删除的关联数据
data.append({
"id": info.id,
'times': info.times,
@@ -388,7 +391,7 @@ class EditProject(APIView):
contract = request.FILES.getlist('contract')
try:
pro = ProjectRegistration.objects.get(id=id)
pro = ProjectRegistration.objects.get(id=id, is_deleted=False)
except ProjectRegistration.DoesNotExist:
return Response({'status': 'error', 'message': '立案登记不存在', 'code': 1}, status=status.HTTP_404_NOT_FOUND)
@@ -622,7 +625,10 @@ class BidDetail(APIView):
user_agents_page = paginator.page(paginator.num_pages)
data = []
for info in user_agents_page.object_list:
pre = PreFiling.objects.get(id=info.user_id)
try:
pre = PreFiling.objects.get(id=info.user_id, is_deleted=False)
except PreFiling.DoesNotExist:
continue # 跳过已删除的关联数据
data.append({
"id": info.id,
'times': info.times,
@@ -658,7 +664,7 @@ class EditBid(APIView):
return Response({'status': 'error', 'message': '缺少参数', 'code': 1}, status=status.HTTP_400_BAD_REQUEST)
try:
bid = Bid.objects.get(id=id)
bid = Bid.objects.get(id=id, is_deleted=False)
except Bid.DoesNotExist:
return Response({'status': 'error', 'message': '投标登记不存在', 'code': 1}, status=status.HTTP_404_NOT_FOUND)
@@ -862,8 +868,11 @@ class caseManagementDetail(APIView):
user_agents_page = paginator.page(paginator.num_pages)
data = []
for info in user_agents_page.object_list:
pre = PreFiling.objects.get(id=info.user_id)
pro = ProjectRegistration.objects.get(user_id=info.user_id)
try:
pre = PreFiling.objects.get(id=info.user_id, is_deleted=False)
pro = ProjectRegistration.objects.get(user_id=info.user_id, is_deleted=False)
except (PreFiling.DoesNotExist, ProjectRegistration.DoesNotExist):
continue # 跳过已删除的关联数据
data.append({
"id": info.id,
"ContractNo": pro.ContractNo, # 合同编号
@@ -920,7 +929,7 @@ class EditCase(APIView):
return Response({'status': 'error', 'message': '缺少参数id', 'code': 1}, status=status.HTTP_400_BAD_REQUEST)
try:
case = Case.objects.get(id=id)
case = Case.objects.get(id=id, is_deleted=False)
except Case.DoesNotExist:
return Response({'status': 'error', 'message': '案件管理不存在', 'code': 1}, status=status.HTTP_404_NOT_FOUND)
@@ -1154,7 +1163,10 @@ class preFilingLinkedCases(APIView):
proa = ProjectRegistration.objects.filter(is_deleted=False)
data = []
for prefiling in proa:
pre = PreFiling.objects.get(id=prefiling.user_id)
try:
pre = PreFiling.objects.get(id=prefiling.user_id, is_deleted=False)
except PreFiling.DoesNotExist:
continue # 跳过已删除的关联数据
data.append({
"id": prefiling.user_id,
"client_username": pre.client_username,
@@ -1233,7 +1245,7 @@ class ApplicationDetail(APIView):
if seal_type:
Q_obj &= Q(seal_type=seal_type)
seas = SealApplication.objects.filter(Q_obj).order_by('-id')
seas = SealApplication.objects.filter(Q_obj, is_deleted=False).order_by('-id')
total = len(seas)
paginator = Paginator(seas, per_page)
@@ -1284,7 +1296,7 @@ class EditApplication(APIView):
return Response({'status': 'error', 'message': '缺少参数', 'code': 1}, status=status.HTTP_400_BAD_REQUEST)
try:
app = SealApplication.objects.get(id=id)
app = SealApplication.objects.get(id=id, is_deleted=False)
except SealApplication.DoesNotExist:
return Response({'status': 'error', 'message': '申请用印不存在', 'code': 1}, status=status.HTTP_404_NOT_FOUND)
@@ -1400,7 +1412,7 @@ class WarehousingDetail(APIView):
if unit:
Q_obj &= Q(unit__icontains=unit)
seas = Warehousing.objects.filter(Q_obj).order_by('-id')
seas = Warehousing.objects.filter(Q_obj, is_deleted=False).order_by('-id')
total = len(seas)
paginator = Paginator(seas, per_page)
@@ -1446,7 +1458,7 @@ class EditWarehousing(APIView):
return Response({'status': 'error', 'message': '缺少参数', 'code': 1}, status=status.HTTP_400_BAD_REQUEST)
try:
ware = Warehousing.objects.get(id=id)
ware = Warehousing.objects.get(id=id, is_deleted=False)
except Warehousing.DoesNotExist:
return Response({'status': 'error', 'message': '入库登记不存在', 'code': 1}, status=status.HTTP_404_NOT_FOUND)
@@ -1570,7 +1582,7 @@ class EditPlatformDetail(APIView):
if not all([platform, number, password, username, ID]):
return Response({'status': 'error', 'message': '缺少参数', 'code': 1}, status=status.HTTP_400_BAD_REQUEST)
reg = RegisterPlatform.objects.get(id=ID)
reg = RegisterPlatform.objects.get(id=ID, is_deleted=False)
reg.platform = platform
reg.number = number
reg.password = password
@@ -1691,7 +1703,7 @@ class EditBulletin(APIView):
return Response({'status': 'error', 'message': '缺少参数', 'code': 1}, status=status.HTTP_400_BAD_REQUEST)
try:
ann = Announcement.objects.get(id=ID)
ann = Announcement.objects.get(id=ID, is_deleted=False)
except Announcement.DoesNotExist:
return Response({'status': 'error', 'message': '公告不存在', 'code': 1}, status=status.HTTP_404_NOT_FOUND)
@@ -1813,7 +1825,7 @@ class EditLawyerFlie(APIView):
return Response({'status': 'error', 'message': '缺少参数', 'code': 1}, status=status.HTTP_400_BAD_REQUEST)
try:
law = LawyerFlie.objects.get(id=id)
law = LawyerFlie.objects.get(id=id, is_deleted=False)
except LawyerFlie.DoesNotExist:
return Response({'status': 'error', 'message': '律师文件不存在', 'code': 1}, status=status.HTTP_404_NOT_FOUND)

View File

@@ -181,7 +181,7 @@ class issueAnInvoiceDetail(APIView):
if unit:
Q_obj &= Q(unit__icontains=unit)
invos = Invoice.objects.filter(Q_obj).order_by('-id')
invos = Invoice.objects.filter(Q_obj, is_deleted=False).order_by('-id')
total = len(invos)
paginator = Paginator(invos, per_page)
@@ -235,7 +235,7 @@ class EditInvoice(APIView):
return Response({'status': 'error', 'message': '缺少参数id', 'code': 1}, status=status.HTTP_400_BAD_REQUEST)
try:
invoice = Invoice.objects.get(id=id)
invoice = Invoice.objects.get(id=id, is_deleted=False)
except Invoice.DoesNotExist:
return Response({'status': 'error', 'message': '开票申请不存在', 'code': 1}, status=status.HTTP_404_NOT_FOUND)
@@ -446,7 +446,7 @@ class confirmdisplay(APIView):
if not has_all_permission:
Q_obj &= Q(submit=user.username)
income = Income.objects.filter(Q_obj).order_by('-id')
income = Income.objects.filter(Q_obj, is_deleted=False).order_by('-id')
total = len(income)
paginator = Paginator(income, per_page)
@@ -494,7 +494,7 @@ class EditIncome(APIView):
return Response({'status': 'error', 'message': '缺少参数id', 'code': 1}, status=status.HTTP_400_BAD_REQUEST)
try:
income = Income.objects.get(id=id)
income = Income.objects.get(id=id, is_deleted=False)
except Income.DoesNotExist:
return Response({'status': 'error', 'message': '收入确认不存在', 'code': 1}, status=status.HTTP_404_NOT_FOUND)
@@ -606,7 +606,7 @@ class loandisplay(APIView):
Q_obj &= Q(times__gte=times) & Q(times__lte=end_time)
if CustomerID:
Q_obj &= Q(CustomerID__icontains=CustomerID)
acc = Accounts.objects.filter(Q_obj).order_by('-id')
acc = Accounts.objects.filter(Q_obj, is_deleted=False).order_by('-id')
total = len(acc)
paginator = Paginator(acc, per_page)
@@ -652,7 +652,7 @@ class EditAccounts(APIView):
return Response({'status': 'error', 'message': '缺少参数id', 'code': 1}, status=status.HTTP_400_BAD_REQUEST)
try:
account = Accounts.objects.get(id=id)
account = Accounts.objects.get(id=id, is_deleted=False)
except Accounts.DoesNotExist:
return Response({'status': 'error', 'message': '调账申请不存在', 'code': 1}, status=status.HTTP_404_NOT_FOUND)
@@ -765,7 +765,7 @@ class PaymentDisplay(APIView):
Q_obj &= Q(times__gte=times) & Q(times__lte=end_time)
if payee:
Q_obj &= Q(payee__icontains=payee)
pay = Payment.objects.filter(Q_obj).order_by('-id')
pay = Payment.objects.filter(Q_obj, is_deleted=False).order_by('-id')
total = len(pay)
paginator = Paginator(pay, per_page)
@@ -815,7 +815,7 @@ class EditPayment(APIView):
return Response({'status': 'error', 'message': '缺少参数id', 'code': 1}, status=status.HTTP_400_BAD_REQUEST)
try:
payment = Payment.objects.get(id=id)
payment = Payment.objects.get(id=id, is_deleted=False)
except Payment.DoesNotExist:
return Response({'status': 'error', 'message': '付款申请不存在', 'code': 1}, status=status.HTTP_404_NOT_FOUND)
@@ -926,7 +926,7 @@ class reimbursementdetail(APIView):
Q_obj &= Q(times__gte=times) & Q(times__lte=end_time)
if person:
Q_obj &= Q(person__icontains=person)
rei = Reimbursement.objects.filter(Q_obj).order_by('-id')
rei = Reimbursement.objects.filter(Q_obj, is_deleted=False).order_by('-id')
total = len(rei)
paginator = Paginator(rei, per_page)
@@ -972,7 +972,7 @@ class EditReimbursement(APIView):
return Response({'status': 'error', 'message': '缺少参数id', 'code': 1}, status=status.HTTP_400_BAD_REQUEST)
try:
reimbursement = Reimbursement.objects.get(id=id)
reimbursement = Reimbursement.objects.get(id=id, is_deleted=False)
except Reimbursement.DoesNotExist:
return Response({'status': 'error', 'message': '报销申请不存在', 'code': 1}, status=status.HTTP_404_NOT_FOUND)
@@ -1074,7 +1074,7 @@ class ChangeDetail(APIView):
Q_obj &= Q(times__gte=times) & Q(times__lte=end_time)
if username:
Q_obj &= Q(username__icontains=username)
bon = BonusChange.objects.filter(Q_obj).order_by('-id')
bon = BonusChange.objects.filter(Q_obj, is_deleted=False).order_by('-id')
total = len(bon)
paginator = Paginator(bon, per_page)
@@ -1116,7 +1116,7 @@ class EditBonusChange(APIView):
return Response({'status': 'error', 'message': '缺少参数id', 'code': 1}, status=status.HTTP_400_BAD_REQUEST)
try:
bonus = BonusChange.objects.get(id=id)
bonus = BonusChange.objects.get(id=id, is_deleted=False)
except BonusChange.DoesNotExist:
return Response({'status': 'error', 'message': '工资/奖金变更不存在', 'code': 1}, status=status.HTTP_404_NOT_FOUND)