refactor: region from document, not app config

- Add region column to leaudit_documents + LeauditDocument model
- AuditServiceImpl: read region from document.region, not APP_REGION
- RuleServiceImpl: ListBindings/CreateBinding accept Region parameter
- RuleBindingCreateDTO: add region field
- RuleController: pass region from query param/DTO to service
- APP_REGION removed from binding queries; region flows from document

Region is now per-document: each document carries its region at upload
time, and rules are matched to the document's region at run time.
This commit is contained in:
wren
2026-04-28 14:19:29 +08:00
parent e80e8febd8
commit c776af598a
6 changed files with 65 additions and 15 deletions
@@ -89,9 +89,9 @@ class RuleController(BaseController):
# ── 规则类型绑定 ──────────────────────────────────────────
@self.router.get("/bindings", response_model=Result[list[RuleBindingVO]])
async def ListBindings(ruleType: str | None = None):
"""列出规则类型绑定。可按规则类型过滤。"""
Data = await self.RuleService.ListBindings(RuleType=ruleType)
async def ListBindings(ruleType: str | None = None, region: str | None = None):
"""列出规则类型绑定。可按规则类型/地区过滤。"""
Data = await self.RuleService.ListBindings(RuleType=ruleType, Region=region)
return Result.success(data=Data)
@self.router.post("/{RuleType}/bindings", response_model=Result[RuleBindingVO])
@@ -100,6 +100,7 @@ class RuleController(BaseController):
Data = await self.RuleService.CreateBinding(
DocTypeId=body.docTypeId,
RuleSetId=body.ruleSetId,
Region=body.region,
BindingMode=body.bindingMode,
Priority=body.priority,
DocTypeCode=body.docTypeCode,