安全:隔离主数据并封闭单条删除

This commit is contained in:
焦龙言
2026-09-22 18:16:30 +08:00
parent af5428d0e3
commit b6f606d9f2
13 changed files with 1382 additions and 1131 deletions
@@ -11,6 +11,8 @@ from common.enums import BusinessType
from common.router import APIRouterPro
from common.vo import DataResponseModel, PageResponseModel, ResponseBaseModel
from module_admin.entity.vo.user_vo import CurrentUserModel
from module_business.dependency.test_batch_dependency import TestBatchScopeDependency
from module_business.domain.test_batch_scope import TestBatchScope
from module_business.entity.vo.master_vo import (
DeletePalletModel,
PalletCreateModel,
@@ -37,8 +39,9 @@ async def get_master_pallet_list(
request: Request,
pallet_page_query: Annotated[PalletPageQueryModel, Query()],
query_db: Annotated[AsyncSession, DBSessionDependency()],
scope: Annotated[TestBatchScope, TestBatchScopeDependency()],
) -> Response:
result = await PalletService.list_pallet(query_db, pallet_page_query, is_page=True)
result = await PalletService.list_pallet(query_db, pallet_page_query, scope, is_page=True)
return ResponseUtil.success(model_content=result)
@@ -54,8 +57,9 @@ async def query_master_pallet_qrcode(
request: Request,
pallet_id: Annotated[int, Path(gt=0, description='托盘ID')],
query_db: Annotated[AsyncSession, DBSessionDependency()],
scope: Annotated[TestBatchScope, TestBatchScopeDependency()],
) -> Response:
png = await PalletService.get_pallet_qrcode(query_db, pallet_id)
png = await PalletService.get_pallet_qrcode(query_db, pallet_id, scope)
return Response(content=png, media_type='image/png')
@@ -70,8 +74,9 @@ async def query_detail_master_pallet(
request: Request,
pallet_id: Annotated[int, Path(gt=0, description='托盘ID')],
query_db: Annotated[AsyncSession, DBSessionDependency()],
scope: Annotated[TestBatchScope, TestBatchScopeDependency()],
) -> Response:
result = await PalletService.detail_pallet(query_db, pallet_id)
result = await PalletService.detail_pallet(query_db, pallet_id, scope)
return ResponseUtil.success(data=result)
@@ -88,8 +93,9 @@ async def add_master_pallet(
add_pallet: PalletCreateModel,
query_db: Annotated[AsyncSession, DBSessionDependency()],
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
scope: Annotated[TestBatchScope, TestBatchScopeDependency(write=True)],
) -> Response:
result = await PalletService.add_pallet(query_db, add_pallet, current_user.user.user_name)
result = await PalletService.add_pallet(query_db, add_pallet, current_user, scope)
return ResponseUtil.success(msg=result.message)
@@ -106,8 +112,9 @@ async def edit_master_pallet(
edit_pallet: PalletEditModel,
query_db: Annotated[AsyncSession, DBSessionDependency()],
current_user: Annotated[CurrentUserModel, CurrentUserDependency()],
scope: Annotated[TestBatchScope, TestBatchScopeDependency(write=True)],
) -> Response:
result = await PalletService.edit_pallet(query_db, edit_pallet, current_user.user.user_name)
result = await PalletService.edit_pallet(query_db, edit_pallet, current_user, scope)
return ResponseUtil.success(msg=result.message)